From e7b2cc874496b50d6ea6ec78f7ccb465e1067d6d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Jan 2022 07:41:25 +0000 Subject: [PATCH] CodeGen from PR 16877 in Azure/azure-rest-api-specs Published/azure/azure rest api specs pr/dev orbital microsoft.orbital 2021 04 04 preview (#16877) * New Swagger Spec File * New Swagger Example Spec File * New Readme Config File * New Azure AZ Readme Config File * New Azure CLI Readme Config File * New Go Language Readme Config File * New Python Language Readme Config File * New Typescript Language Readme Config File * New C# Language Readme Config File * Orbital sdk 2021 04 04 preview (#5253) * New Readme Config File * New Go Language Readme Config File * New Typescript Language Readme Config File * New Python Language Readme Config File * New C# Language Readme Config File * New Ruby Language Readme Config File * New Swagger Spec File * New Swagger Example Spec File * Added orbital.json file * Passed linting using AutoRest for 2020-09-01 Azure Orbital Private Privew * Updated Operation object under Azure Orbital 2020-09-01 preview. * Updated Operation object under Azure Orbital 2020-09-01 preview. * Updated Satellites object for Azure Orbital 2020-09-01 preview * Updated examples for Azure Orbital Private Preview 2020-09-01 * Updated examples for Azure Orbital Private Preview 2020-09-01 * Updated examples for Azure Orbital Private Preview 2020-09-01 * Addressed feedback from ARMChangesRequested * Updated the GetAvailableContacts api to add long running operation * Updated the api version * Updated the objects based on discussion with PM. * list available ground station made a POST request (#2521) * list available ground station made a POST request * Swagger LintDiff fix Co-authored-by: Devanshu Singh * swagger specs for version-20210404-preview * removed cross version references. Copied over unchanged examples from the previous API version 2021-09-01-preview * removed availableGroundStations API * New Readme Config File New Go Language Readme Config File New Typescript Language Readme Config File New Python Language Readme Config File New C# Language Readme Config File New Ruby Language Readme Config File New Swagger Spec File New Swagger Example Spec File Added orbital.json file Passed linting using AutoRest for 2020-09-01 Azure Orbital Private Privew Updated Operation object under Azure Orbital 2020-09-01 preview. Updated Operation object under Azure Orbital 2020-09-01 preview. Updated Satellites object for Azure Orbital 2020-09-01 preview Updated examples for Azure Orbital Private Preview 2020-09-01 Updated examples for Azure Orbital Private Preview 2020-09-01 Updated examples for Azure Orbital Private Preview 2020-09-01 Addressed feedback from ARMChangesRequested Updated the GetAvailableContacts api to add long running operation Updated the api version Updated the objects based on discussion with PM. list available ground station made a POST request (#2521) * list available ground station made a POST request * Swagger LintDiff fix Co-authored-by: Devanshu Singh * validation check changes. Avocado, SpellCheck and prettier * validation checks changes * Modify readme.md for sdk generation * added system data * sdk pre namer validation changes * lintdiff warning changes * add comms scenario swagger (#3794) * add comms scenario swagger * remove unused example * fix some validation errors * fix style issues * update spec based on feedback * add updated example files * fix CI errors * change endpoints/connections list APIs to posts from gets * connections lists from endpoints return resource IDs rather than full objects. * update examples files for endpoints connections list APIs * fix operationIds and add descriptions * fix more op ids and add descriptions for real * fix typos, add constraints, and remove kbps/gbps from bandwidth (#4023) * Updates to Resource Types (Modifications and Renames) (#4294) * update orbital.json * update examples * prettier fix * unfix old api version * fix ci issues * make more fields immutable * update provisioning states * swagger specs for Available groundstation APIs, version 2021-preview (#4920) * swagger specs for Available groundstation APIs, version 2021-preview * npm prettier check * added type object * removed capability and global comms info from responses * prettier fix * changed AP id response * changes to schema to follow ARM format, resource id update * Spelling check fix * Ground Station spell check * added groundstation to custom words * Revert "added groundstation to custom words" This reverts commit 0d7e18217de98836dcb8ba991685e15436004836. * Revert "Ground Station spell check" This reverts commit ef85b3b26f9ddf81dc1f50a9b677f9d8f115c4cf. * Revert "Spelling check fix" This reverts commit 6bd95c6e013889b6d488703846bbe87bbbb9c494. * word addition * type in response * type definition in swagger * readonly add Co-authored-by: Akanksha Bhattacharyya * removed comms APIs * readme updated * fixed Swagger Avocado errors * swagger lintDiff fix 1 * swagger lintDiff fix 2 * swagger lintDiff fix 3 Co-authored-by: Sunny Patel Co-authored-by: Sunny Patel Co-authored-by: Arthur Ning <57385816+akning-ms@users.noreply.github.com> Co-authored-by: Devanshu Singh Co-authored-by: Zhenglai Zhang Co-authored-by: Jim Harris <72156062+MicrosoftJim@users.noreply.github.com> Co-authored-by: Akanksha Bhattacharyya Co-authored-by: Akanksha Bhattacharyya * operation IDs updated (#5461) Co-authored-by: Devanshu Singh * Dev orbital microsoft.orbital 2021 04 04 preview (#5491) * operation IDs updated * updated OperationListResult definition * review points implemented Co-authored-by: Devanshu Singh * Azure Orbital - Review points implemented (#5507) * operation IDs updated * updated OperationListResult definition * review points implemented * referencing CloudError, ApiVersionParameter, ResourceGroupNameParameter, SubscriptionIdParameter from common-types * reverting cloudError refs * prettify json * reorder some parameters Co-authored-by: Devanshu Singh Co-authored-by: ArcturusZhang * Removed Empty allOf (#5510) * operation IDs updated * updated OperationListResult definition * review points implemented * referencing CloudError, ApiVersionParameter, ResourceGroupNameParameter, SubscriptionIdParameter from common-types * reverting cloudError refs * prettify json * removed empty allOf * validation checks Co-authored-by: Devanshu Singh * readme.go.md fixed (#5512) * operation IDs updated * updated OperationListResult definition * review points implemented * referencing CloudError, ApiVersionParameter, ResourceGroupNameParameter, SubscriptionIdParameter from common-types * reverting cloudError refs * prettify json * removed empty allOf * validation checks * readme.go.md fixed Co-authored-by: Devanshu Singh * Remove last empty allOf (#5513) * operation IDs updated * updated OperationListResult definition * review points implemented * referencing CloudError, ApiVersionParameter, ResourceGroupNameParameter, SubscriptionIdParameter from common-types * reverting cloudError refs * prettify json * removed empty allOf * validation checks * readme.go.md fixed * remove one last empty allOf Co-authored-by: Devanshu Singh * Add EventHubUri field to Contact Profile Co-authored-by: Devanshu Singh <8132290+thisisdevanshu@users.noreply.github.com> Co-authored-by: Sunny Patel Co-authored-by: Sunny Patel Co-authored-by: Arthur Ning <57385816+akning-ms@users.noreply.github.com> Co-authored-by: Devanshu Singh Co-authored-by: Zhenglai Zhang Co-authored-by: Jim Harris <72156062+MicrosoftJim@users.noreply.github.com> Co-authored-by: Akanksha Bhattacharyya Co-authored-by: Akanksha Bhattacharyya Co-authored-by: ArcturusZhang --- sdk/orbital/azure-mgmt-orbital/_meta.json | 10 +- .../azure/mgmt/orbital/__init__.py | 9 +- .../azure/mgmt/orbital/_azure_orbital.py | 96 +- .../azure/mgmt/orbital/_configuration.py | 19 +- .../azure/mgmt/orbital/_metadata.json | 21 +- .../azure/mgmt/orbital/_patch.py | 31 + .../azure/mgmt/orbital/_vendor.py | 27 + .../azure/mgmt/orbital/aio/__init__.py | 5 + .../azure/mgmt/orbital/aio/_azure_orbital.py | 87 +- .../azure/mgmt/orbital/aio/_configuration.py | 6 +- .../azure/mgmt/orbital/aio/_patch.py | 31 + .../_available_ground_stations_operations.py | 88 +- .../_contact_profiles_operations.py | 296 ++-- .../aio/operations/_contacts_operations.py | 215 ++- .../orbital/aio/operations/_operations.py | 42 +- .../aio/operations/_spacecrafts_operations.py | 364 +++-- .../azure/mgmt/orbital/models/__init__.py | 84 +- .../orbital/models/_azure_orbital_enums.py | 41 +- .../azure/mgmt/orbital/models/_models.py | 1195 ----------------- .../azure/mgmt/orbital/models/_models_py3.py | 494 +++++-- .../_available_ground_stations_operations.py | 177 ++- .../_contact_profiles_operations.py | 622 ++++++--- .../operations/_contacts_operations.py | 447 +++--- .../mgmt/orbital/operations/_operations.py | 83 +- .../operations/_spacecrafts_operations.py | 769 +++++++---- 25 files changed, 2413 insertions(+), 2846 deletions(-) create mode 100644 sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_patch.py create mode 100644 sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_vendor.py create mode 100644 sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_patch.py delete mode 100644 sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models.py diff --git a/sdk/orbital/azure-mgmt-orbital/_meta.json b/sdk/orbital/azure-mgmt-orbital/_meta.json index d0317cc69b92b..260e5c7b77048 100644 --- a/sdk/orbital/azure-mgmt-orbital/_meta.json +++ b/sdk/orbital/azure-mgmt-orbital/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "8c7612b823f693c6d7bc607594ed30b5ecb72730", + "commit": "0ba55a0ac6a76e3539b02ac30c4edb14c1175cc6", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/orbital/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/orbital/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/orbital/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/__init__.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/__init__.py index 342c98524bd4e..0164338153a39 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/__init__.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AzureOrbital'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_azure_orbital.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_azure_orbital.py index 8e2f7cde33ce9..f15f2082e14a5 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_azure_orbital.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_azure_orbital.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import AzureOrbitalConfiguration +from .operations import AvailableGroundStationsOperations, ContactProfilesOperations, ContactsOperations, Operations, SpacecraftsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import AzureOrbitalConfiguration -from .operations import Operations -from .operations import SpacecraftsOperations -from .operations import ContactsOperations -from .operations import ContactProfilesOperations -from .operations import AvailableGroundStationsOperations -from . import models - -class AzureOrbital(object): +class AzureOrbital: """Azure Orbital service. :ivar operations: Operations operations @@ -44,56 +38,58 @@ class AzureOrbital(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureOrbitalConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureOrbitalConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.spacecrafts = SpacecraftsOperations(self._client, self._config, self._serialize, self._deserialize) + self.contacts = ContactsOperations(self._client, self._config, self._serialize, self._deserialize) + self.contact_profiles = ContactProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.available_ground_stations = AvailableGroundStationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.spacecrafts = SpacecraftsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.contacts = ContactsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.contact_profiles = ContactProfilesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.available_ground_stations = AvailableGroundStationsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py index fc8920d8f2239..da287115db635 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class AzureOrbitalConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AzureOrbitalConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AzureOrbitalConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_metadata.json b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_metadata.json index 972824a4331f6..5aece6cd9dc89 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_metadata.json +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_metadata.json @@ -5,13 +5,13 @@ "name": "AzureOrbital", "filename": "_azure_orbital", "description": "Azure Orbital service.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureOrbitalConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureOrbitalConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureOrbitalConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureOrbitalConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_patch.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_vendor.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/__init__.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/__init__.py index ecd68d66b7c71..8c5aa21245116 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/__init__.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_orbital import AzureOrbital __all__ = ['AzureOrbital'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_azure_orbital.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_azure_orbital.py index 0ccdab333b469..31edb578f68f0 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_azure_orbital.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_azure_orbital.py @@ -6,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AzureOrbitalConfiguration +from .operations import AvailableGroundStationsOperations, ContactProfilesOperations, ContactsOperations, Operations, SpacecraftsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AzureOrbitalConfiguration -from .operations import Operations -from .operations import SpacecraftsOperations -from .operations import ContactsOperations -from .operations import ContactProfilesOperations -from .operations import AvailableGroundStationsOperations -from .. import models - - -class AzureOrbital(object): +class AzureOrbital: """Azure Orbital service. :ivar operations: Operations operations @@ -37,59 +33,64 @@ class AzureOrbital(object): :ivar contact_profiles: ContactProfilesOperations operations :vartype contact_profiles: azure_orbital.aio.operations.ContactProfilesOperations :ivar available_ground_stations: AvailableGroundStationsOperations operations - :vartype available_ground_stations: azure_orbital.aio.operations.AvailableGroundStationsOperations + :vartype available_ground_stations: + azure_orbital.aio.operations.AvailableGroundStationsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureOrbitalConfiguration(credential, subscription_id, **kwargs) + self._config = AzureOrbitalConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.spacecrafts = SpacecraftsOperations(self._client, self._config, self._serialize, self._deserialize) + self.contacts = ContactsOperations(self._client, self._config, self._serialize, self._deserialize) + self.contact_profiles = ContactProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.available_ground_stations = AvailableGroundStationsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.spacecrafts = SpacecraftsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.contacts = ContactsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.contact_profiles = ContactProfilesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.available_ground_stations = AvailableGroundStationsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_configuration.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_configuration.py index 3e14ada0e4e86..b09da5dac6979 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_configuration.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AzureOrbitalConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AzureOrbitalConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_patch.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_available_ground_stations_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_available_ground_stations_operations.py index 370a35ef5dcd2..b42afeb4a43f0 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_available_ground_stations_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_available_ground_stations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._available_ground_stations_operations import build_get_request, build_list_by_capability_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_capability( self, capability: Union[str, "_models.Enum6"] = "EarthObservation", @@ -51,8 +57,10 @@ def list_by_capability( :param capability: Ground Station Capability. :type capability: str or ~azure_orbital.models.Enum6 :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailableGroundStationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.AvailableGroundStationListResult] + :return: An iterator like instance of either AvailableGroundStationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.AvailableGroundStationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableGroundStationListResult"] @@ -60,35 +68,31 @@ def list_by_capability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_capability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['capability'] = self._serialize.query("capability", capability, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_capability_request( + subscription_id=self._config.subscription_id, + capability=capability, + template_url=self.list_by_capability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_capability_request( + subscription_id=self._config.subscription_id, + capability=capability, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableGroundStationListResult', pipeline_response) + deserialized = self._deserialize("AvailableGroundStationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +110,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_capability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations'} # type: ignore + @distributed_trace_async async def get( self, ground_station_name: str, @@ -130,26 +136,16 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'groundStationName': self._serialize.url("ground_station_name", ground_station_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + ground_station_name=ground_station_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,4 +159,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName}'} # type: ignore + diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py index 0ff96e62d390d..c339997d7292d 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._contact_profiles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_subscription_request, build_list_request, build_update_tags_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,27 +71,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -99,8 +95,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -110,6 +108,7 @@ async def _create_or_update_initial( minimum_viable_contact_duration: Optional[str] = None, minimum_elevation_degrees: Optional[float] = None, auto_tracking_configuration: Optional[Union[str, "_models.AutoTrackingConfiguration"]] = None, + event_hub_uri: Optional[str] = None, links: Optional[List["_models.ContactProfileLink"]] = None, **kwargs: Any ) -> "_models.ContactProfile": @@ -119,33 +118,22 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.ContactProfile(tags=tags, location=location, minimum_viable_contact_duration=minimum_viable_contact_duration, minimum_elevation_degrees=minimum_elevation_degrees, auto_tracking_configuration=auto_tracking_configuration, links=links) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _parameters = _models.ContactProfile(tags=tags, location=location, minimum_viable_contact_duration=minimum_viable_contact_duration, minimum_elevation_degrees=minimum_elevation_degrees, auto_tracking_configuration=auto_tracking_configuration, event_hub_uri=event_hub_uri, links=links) + _json = self._serialize.body(_parameters, 'ContactProfile') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'ContactProfile') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,8 +151,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -174,6 +165,7 @@ async def begin_create_or_update( minimum_viable_contact_duration: Optional[str] = None, minimum_elevation_degrees: Optional[float] = None, auto_tracking_configuration: Optional[Union[str, "_models.AutoTrackingConfiguration"]] = None, + event_hub_uri: Optional[str] = None, links: Optional[List["_models.ContactProfileLink"]] = None, **kwargs: Any ) -> AsyncLROPoller["_models.ContactProfile"]: @@ -193,19 +185,25 @@ async def begin_create_or_update( :type minimum_elevation_degrees: float :param auto_tracking_configuration: Auto track configuration. :type auto_tracking_configuration: str or ~azure_orbital.models.AutoTrackingConfiguration + :param event_hub_uri: The URI of the Event Hub used for telemetry. + :type event_hub_uri: str :param links: Links of the Contact Profile. :type links: list[~azure_orbital.models.ContactProfileLink] :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ContactProfile or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContactProfile or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure_orbital.models.ContactProfile] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] lro_delay = kwargs.pop( 'polling_interval', @@ -221,28 +219,23 @@ async def begin_create_or_update( minimum_viable_contact_duration=minimum_viable_contact_duration, minimum_elevation_degrees=minimum_elevation_degrees, auto_tracking_configuration=auto_tracking_configuration, + event_hub_uri=event_hub_uri, links=links, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ContactProfile', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +247,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore async def _delete_initial( @@ -267,27 +261,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,6 +284,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -314,15 +300,17 @@ async def begin_delete( :type contact_profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -336,21 +324,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,8 +343,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + @distributed_trace_async async def update_tags( self, resource_group_name: str, @@ -389,32 +372,22 @@ async def update_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagsObject') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,8 +401,11 @@ async def update_tags( return cls(pipeline_response, deserialized, {}) return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -437,7 +413,8 @@ def list_by_subscription( """Returns list of contact profiles. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContactProfileListResult or the result of cls(response) + :return: An iterator like instance of either ContactProfileListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.ContactProfileListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -446,34 +423,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContactProfileListResult', pipeline_response) + deserialized = self._deserialize("ContactProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -491,11 +463,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -506,7 +480,8 @@ def list( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContactProfileListResult or the result of cls(response) + :return: An iterator like instance of either ContactProfileListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.ContactProfileListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -515,35 +490,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContactProfileListResult', pipeline_response) + deserialized = self._deserialize("ContactProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -561,6 +532,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contacts_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contacts_operations.py index a1afa1a058d35..d98196be53e24 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contacts_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contacts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._contacts_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -65,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContactListResult', pipeline_response) + deserialized = self._deserialize("ContactListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,11 +115,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -142,28 +147,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - 'contactName': self._serialize.url("contact_name", contact_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,8 +172,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -192,33 +189,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - 'contactName': self._serialize.url("contact_name", contact_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Contact') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Contact') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,8 +223,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -258,15 +248,19 @@ async def begin_create( :type parameters: ~azure_orbital.models.Contact :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Contact or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Contact or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure_orbital.models.Contact] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Contact"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,28 +273,21 @@ async def begin_create( spacecraft_name=spacecraft_name, contact_name=contact_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Contact', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - 'contactName': self._serialize.url("contact_name", contact_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -312,6 +299,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore async def _delete_initial( @@ -326,28 +314,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - 'contactName': self._serialize.url("contact_name", contact_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -360,6 +338,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -377,15 +357,17 @@ async def begin_delete( :type contact_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -400,22 +382,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - 'contactName': self._serialize.url("contact_name", contact_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -427,4 +401,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py index 127575a01ac89..c3d06a5352797 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -57,30 +63,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +101,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_spacecrafts_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_spacecrafts_operations.py index 948fbef167461..acf48ba4ac579 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_spacecrafts_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_spacecrafts_operations.py @@ -6,19 +6,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._spacecrafts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_available_contacts_request_initial, build_list_by_subscription_request, build_list_request, build_update_tags_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,6 +49,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -51,7 +57,8 @@ def list_by_subscription( """Return list of spacecrafts. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SpacecraftListResult or the result of cls(response) + :return: An iterator like instance of either SpacecraftListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.SpacecraftListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -60,34 +67,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SpacecraftListResult', pipeline_response) + deserialized = self._deserialize("SpacecraftListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,11 +107,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/spacecrafts'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -120,7 +124,8 @@ def list( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SpacecraftListResult or the result of cls(response) + :return: An iterator like instance of either SpacecraftListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.SpacecraftListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -129,35 +134,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SpacecraftListResult', pipeline_response) + deserialized = self._deserialize("SpacecraftListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -175,11 +176,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -202,27 +205,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -236,8 +229,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -257,33 +252,22 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.Spacecraft(tags=tags, location=location, norad_id=norad_id, title_line=title_line, tle_line1=tle_line1, tle_line2=tle_line2, links=links) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _parameters = _models.Spacecraft(tags=tags, location=location, norad_id=norad_id, title_line=title_line, tle_line1=tle_line1, tle_line2=tle_line2, links=links) + _json = self._serialize.body(_parameters, 'Spacecraft') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'Spacecraft') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -301,8 +285,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -338,15 +325,19 @@ async def begin_create_or_update( :type links: list[~azure_orbital.models.SpacecraftLink] :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Spacecraft or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Spacecraft or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure_orbital.models.Spacecraft] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] lro_delay = kwargs.pop( 'polling_interval', @@ -364,27 +355,21 @@ async def begin_create_or_update( tle_line1=tle_line1, tle_line2=tle_line2, links=links, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Spacecraft', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -396,6 +381,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore async def _delete_initial( @@ -409,27 +395,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -442,6 +418,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -456,15 +434,17 @@ async def begin_delete( :type spacecraft_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -478,21 +458,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -504,8 +477,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + @distributed_trace_async async def update_tags( self, resource_group_name: str, @@ -531,32 +506,22 @@ async def update_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagsObject') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -570,8 +535,10 @@ async def update_tags( return cls(pipeline_response, deserialized, {}) return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + async def _list_available_contacts_initial( self, resource_group_name: str, @@ -588,33 +555,22 @@ async def _list_available_contacts_initial( } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.ContactParameters(contact_profile=contact_profile, ground_station_name=ground_station_name, start_time=start_time, end_time=end_time) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._list_available_contacts_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _parameters = _models.ContactParameters(contact_profile=contact_profile, ground_station_name=ground_station_name, start_time=start_time, end_time=end_time) + _json = self._serialize.body(_parameters, 'ContactParameters') + + request = build_list_available_contacts_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + content_type=content_type, + json=_json, + template_url=self._list_available_contacts_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'ContactParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -628,8 +584,11 @@ async def _list_available_contacts_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _list_available_contacts_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts'} # type: ignore + + @distributed_trace_async async def begin_list_available_contacts( self, resource_group_name: str, @@ -656,15 +615,19 @@ async def begin_list_available_contacts( :type end_time: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AvailableContactsListResult or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AvailableContactsListResult or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure_orbital.models.AvailableContactsListResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -679,27 +642,21 @@ async def begin_list_available_contacts( ground_station_name=ground_station_name, start_time=start_time, end_time=end_time, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AvailableContactsListResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -711,4 +668,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_available_contacts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts'} # type: ignore diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/__init__.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/__init__.py index 76a686fe04dd7..a17929a2510bf 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/__init__.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/__init__.py @@ -6,62 +6,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AvailableContacts - from ._models_py3 import AvailableContactsListResult - from ._models_py3 import AvailableGroundStation - from ._models_py3 import AvailableGroundStationListResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import Contact - from ._models_py3 import ContactListResult - from ._models_py3 import ContactParameters - from ._models_py3 import ContactProfile - from ._models_py3 import ContactProfileLink - from ._models_py3 import ContactProfileLinkChannel - from ._models_py3 import ContactProfileListResult - from ._models_py3 import EndPoint - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceIdListResult - from ._models_py3 import ResourceIdListResultValueItem - from ._models_py3 import ResourceReference - from ._models_py3 import Spacecraft - from ._models_py3 import SpacecraftLink - from ._models_py3 import SpacecraftListResult - from ._models_py3 import SystemData - from ._models_py3 import TagsObject - from ._models_py3 import TrackedResource -except (SyntaxError, ImportError): - from ._models import AvailableContacts # type: ignore - from ._models import AvailableContactsListResult # type: ignore - from ._models import AvailableGroundStation # type: ignore - from ._models import AvailableGroundStationListResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import Contact # type: ignore - from ._models import ContactListResult # type: ignore - from ._models import ContactParameters # type: ignore - from ._models import ContactProfile # type: ignore - from ._models import ContactProfileLink # type: ignore - from ._models import ContactProfileLinkChannel # type: ignore - from ._models import ContactProfileListResult # type: ignore - from ._models import EndPoint # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceIdListResult # type: ignore - from ._models import ResourceIdListResultValueItem # type: ignore - from ._models import ResourceReference # type: ignore - from ._models import Spacecraft # type: ignore - from ._models import SpacecraftLink # type: ignore - from ._models import SpacecraftListResult # type: ignore - from ._models import SystemData # type: ignore - from ._models import TagsObject # type: ignore - from ._models import TrackedResource # type: ignore +from ._models_py3 import AvailableContacts +from ._models_py3 import AvailableContactsListResult +from ._models_py3 import AvailableGroundStation +from ._models_py3 import AvailableGroundStationListResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import Contact +from ._models_py3 import ContactListResult +from ._models_py3 import ContactParameters +from ._models_py3 import ContactProfile +from ._models_py3 import ContactProfileLink +from ._models_py3 import ContactProfileLinkChannel +from ._models_py3 import ContactProfileListResult +from ._models_py3 import EndPoint +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceIdListResult +from ._models_py3 import ResourceIdListResultValueItem +from ._models_py3 import ResourceReference +from ._models_py3 import Spacecraft +from ._models_py3 import SpacecraftLink +from ._models_py3 import SpacecraftListResult +from ._models_py3 import SystemData +from ._models_py3 import TagsObject +from ._models_py3 import TrackedResource + from ._azure_orbital_enums import ( ActionType, diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_azure_orbital_enums.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_azure_orbital_enums.py index 4d222f35a97e0..5546815e913aa 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_azure_orbital_enums.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_azure_orbital_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ INTERNAL = "Internal" -class AuthorizationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthorizationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Authorization status of spacecraft. """ @@ -40,7 +25,7 @@ class AuthorizationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PENDING = "Pending" DENIED = "Denied" -class AutoTrackingConfiguration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AutoTrackingConfiguration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Auto track configuration. """ @@ -48,14 +33,14 @@ class AutoTrackingConfiguration(with_metaclass(_CaseInsensitiveEnumMeta, str, En X_BAND = "xBand" S_BAND = "sBand" -class Capability(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Capability(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Capability of the Ground Station. """ EARTH_OBSERVATION = "EarthObservation" COMMUNICATION = "Communication" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -64,19 +49,19 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Direction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Direction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Direction (uplink or downlink) """ UPLINK = "uplink" DOWNLINK = "downlink" -class Enum6(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum6(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): EARTH_OBSERVATION = "EarthObservation" COMMUNICATION = "Communication" -class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" """ @@ -85,7 +70,7 @@ class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM = "system" USER_SYSTEM = "user,system" -class Polarization(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Polarization(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """polarization. eg (RHCP, LHCP) """ @@ -95,14 +80,14 @@ class Polarization(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LINEAR_VERTICAL = "linearVertical" LINEAR_HORIZONTAL = "linearHorizontal" -class Protocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Protocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Protocol either UDP or TCP. """ TCP = "TCP" UDP = "UDP" -class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Status(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of a contact. """ diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models.py deleted file mode 100644 index 925bc913ea439..0000000000000 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models.py +++ /dev/null @@ -1,1195 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AvailableContacts(msrest.serialization.Model): - """Customer retrieves list of Available Contacts for a spacecraft resource. Later, one of the available contact can be selected to create a contact. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param spacecraft: The reference to the spacecraft resource. - :type spacecraft: ~azure_orbital.models.ResourceReference - :ivar ground_station_name: Name of Azure Ground Station. - :vartype ground_station_name: str - :ivar maximum_elevation_degrees: Maximum elevation of the antenna during the contact in decimal - degrees. - :vartype maximum_elevation_degrees: float - :ivar tx_start_time: Time at which antenna transmit will be enabled. - :vartype tx_start_time: ~datetime.datetime - :ivar tx_end_time: Time at which antenna transmit will be disabled. - :vartype tx_end_time: ~datetime.datetime - :ivar rx_start_time: Earliest time to receive a signal. - :vartype rx_start_time: ~datetime.datetime - :ivar rx_end_time: Time to lost receiving a signal. - :vartype rx_end_time: ~datetime.datetime - :ivar start_azimuth_degrees: Azimuth of the antenna at the start of the contact in decimal - degrees. - :vartype start_azimuth_degrees: float - :ivar end_azimuth_degrees: Azimuth of the antenna at the end of the contact in decimal degrees. - :vartype end_azimuth_degrees: float - :ivar start_elevation_degrees: Spacecraft elevation above the horizon at contact start. - :vartype start_elevation_degrees: float - :ivar end_elevation_degrees: Spacecraft elevation above the horizon at contact end. - :vartype end_elevation_degrees: float - """ - - _validation = { - 'ground_station_name': {'readonly': True}, - 'maximum_elevation_degrees': {'readonly': True}, - 'tx_start_time': {'readonly': True}, - 'tx_end_time': {'readonly': True}, - 'rx_start_time': {'readonly': True}, - 'rx_end_time': {'readonly': True}, - 'start_azimuth_degrees': {'readonly': True}, - 'end_azimuth_degrees': {'readonly': True}, - 'start_elevation_degrees': {'readonly': True}, - 'end_elevation_degrees': {'readonly': True}, - } - - _attribute_map = { - 'spacecraft': {'key': 'spacecraft', 'type': 'ResourceReference'}, - 'ground_station_name': {'key': 'groundStationName', 'type': 'str'}, - 'maximum_elevation_degrees': {'key': 'properties.maximumElevationDegrees', 'type': 'float'}, - 'tx_start_time': {'key': 'properties.txStartTime', 'type': 'iso-8601'}, - 'tx_end_time': {'key': 'properties.txEndTime', 'type': 'iso-8601'}, - 'rx_start_time': {'key': 'properties.rxStartTime', 'type': 'iso-8601'}, - 'rx_end_time': {'key': 'properties.rxEndTime', 'type': 'iso-8601'}, - 'start_azimuth_degrees': {'key': 'properties.startAzimuthDegrees', 'type': 'float'}, - 'end_azimuth_degrees': {'key': 'properties.endAzimuthDegrees', 'type': 'float'}, - 'start_elevation_degrees': {'key': 'properties.startElevationDegrees', 'type': 'float'}, - 'end_elevation_degrees': {'key': 'properties.endElevationDegrees', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableContacts, self).__init__(**kwargs) - self.spacecraft = kwargs.get('spacecraft', None) - self.ground_station_name = None - self.maximum_elevation_degrees = None - self.tx_start_time = None - self.tx_end_time = None - self.rx_start_time = None - self.rx_end_time = None - self.start_azimuth_degrees = None - self.end_azimuth_degrees = None - self.start_elevation_degrees = None - self.end_elevation_degrees = None - - -class AvailableContactsListResult(msrest.serialization.Model): - """Response for the ListAvailableContacts API service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: A list of available contacts. - :type value: list[~azure_orbital.models.AvailableContacts] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailableContacts]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableContactsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class AvailableGroundStation(msrest.serialization.Model): - """GroundStations available to schedule Contacts. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Id of groundStation. - :vartype id: str - :ivar name: Name of the ground station. - :vartype name: str - :param location: Azure region. - :type location: str - :ivar type: Resource type. - :vartype type: str - :param city: City of ground station. - :type city: str - :param provider_name: Ground station provider name. - :type provider_name: str - :param longitude_degrees: Longitude of the ground station in decimal degrees. - :type longitude_degrees: float - :param latitude_degrees: Latitude of the ground station in decimal degrees. - :type latitude_degrees: float - :param altitude_meters: Altitude of the ground station. - :type altitude_meters: float - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'city': {'key': 'properties.city', 'type': 'str'}, - 'provider_name': {'key': 'properties.providerName', 'type': 'str'}, - 'longitude_degrees': {'key': 'properties.longitudeDegrees', 'type': 'float'}, - 'latitude_degrees': {'key': 'properties.latitudeDegrees', 'type': 'float'}, - 'altitude_meters': {'key': 'properties.altitudeMeters', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableGroundStation, self).__init__(**kwargs) - self.id = None - self.name = None - self.location = kwargs.get('location', None) - self.type = None - self.city = kwargs.get('city', None) - self.provider_name = kwargs.get('provider_name', None) - self.longitude_degrees = kwargs.get('longitude_degrees', None) - self.latitude_degrees = kwargs.get('latitude_degrees', None) - self.altitude_meters = kwargs.get('altitude_meters', None) - - -class AvailableGroundStationListResult(msrest.serialization.Model): - """Response for the AvailableGroundStations API service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: A list of ground station resources. - :type value: list[~azure_orbital.models.AvailableGroundStation] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AvailableGroundStation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableGroundStationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure_orbital.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure_orbital.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure_orbital.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class Contact(ProxyResource): - """Customer creates a contact resource for a spacecraft resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure_orbital.models.SystemData - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar status: Status of a contact. Possible values include: "scheduled", "cancelled", - "succeeded", "failed", "providerCancelled". - :vartype status: str or ~azure_orbital.models.Status - :param reservation_start_time: Reservation start time of a contact. - :type reservation_start_time: ~datetime.datetime - :param reservation_end_time: Reservation end time of a contact. - :type reservation_end_time: ~datetime.datetime - :ivar rx_start_time: Receive start time of a contact. - :vartype rx_start_time: ~datetime.datetime - :ivar rx_end_time: Receive end time of a contact. - :vartype rx_end_time: ~datetime.datetime - :ivar tx_start_time: Transmit start time of a contact. - :vartype tx_start_time: ~datetime.datetime - :ivar tx_end_time: Transmit end time of a contact. - :vartype tx_end_time: ~datetime.datetime - :ivar error_message: Any error message while scheduling a contact. - :vartype error_message: str - :ivar maximum_elevation_degrees: Maximum elevation of the antenna during the contact in decimal - degrees. - :vartype maximum_elevation_degrees: float - :ivar start_azimuth_degrees: Azimuth of the antenna at the start of the contact in decimal - degrees. - :vartype start_azimuth_degrees: float - :ivar end_azimuth_degrees: Azimuth of the antenna at the end of the contact in decimal degrees. - :vartype end_azimuth_degrees: float - :param ground_station_name: Azure Ground Station name. - :type ground_station_name: str - :ivar start_elevation_degrees: Spacecraft elevation above the horizon at contact start. - :vartype start_elevation_degrees: float - :ivar end_elevation_degrees: Spacecraft elevation above the horizon at contact end. - :vartype end_elevation_degrees: float - :param contact_profile: The reference to the contact profile resource. - :type contact_profile: ~azure_orbital.models.ResourceReference - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'etag': {'readonly': True}, - 'status': {'readonly': True}, - 'rx_start_time': {'readonly': True}, - 'rx_end_time': {'readonly': True}, - 'tx_start_time': {'readonly': True}, - 'tx_end_time': {'readonly': True}, - 'error_message': {'readonly': True}, - 'maximum_elevation_degrees': {'readonly': True}, - 'start_azimuth_degrees': {'readonly': True}, - 'end_azimuth_degrees': {'readonly': True}, - 'start_elevation_degrees': {'readonly': True}, - 'end_elevation_degrees': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'reservation_start_time': {'key': 'properties.reservationStartTime', 'type': 'iso-8601'}, - 'reservation_end_time': {'key': 'properties.reservationEndTime', 'type': 'iso-8601'}, - 'rx_start_time': {'key': 'properties.rxStartTime', 'type': 'iso-8601'}, - 'rx_end_time': {'key': 'properties.rxEndTime', 'type': 'iso-8601'}, - 'tx_start_time': {'key': 'properties.txStartTime', 'type': 'iso-8601'}, - 'tx_end_time': {'key': 'properties.txEndTime', 'type': 'iso-8601'}, - 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, - 'maximum_elevation_degrees': {'key': 'properties.maximumElevationDegrees', 'type': 'float'}, - 'start_azimuth_degrees': {'key': 'properties.startAzimuthDegrees', 'type': 'float'}, - 'end_azimuth_degrees': {'key': 'properties.endAzimuthDegrees', 'type': 'float'}, - 'ground_station_name': {'key': 'properties.groundStationName', 'type': 'str'}, - 'start_elevation_degrees': {'key': 'properties.startElevationDegrees', 'type': 'float'}, - 'end_elevation_degrees': {'key': 'properties.endElevationDegrees', 'type': 'float'}, - 'contact_profile': {'key': 'properties.contactProfile', 'type': 'ResourceReference'}, - } - - def __init__( - self, - **kwargs - ): - super(Contact, self).__init__(**kwargs) - self.etag = None - self.status = None - self.reservation_start_time = kwargs.get('reservation_start_time', None) - self.reservation_end_time = kwargs.get('reservation_end_time', None) - self.rx_start_time = None - self.rx_end_time = None - self.tx_start_time = None - self.tx_end_time = None - self.error_message = None - self.maximum_elevation_degrees = None - self.start_azimuth_degrees = None - self.end_azimuth_degrees = None - self.ground_station_name = kwargs.get('ground_station_name', None) - self.start_elevation_degrees = None - self.end_elevation_degrees = None - self.contact_profile = kwargs.get('contact_profile', None) - - -class ContactListResult(msrest.serialization.Model): - """Response for the ListContacts API service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: A list of contact resources in a resource group. - :type value: list[~azure_orbital.models.Contact] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Contact]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ContactParameters(msrest.serialization.Model): - """Parameters that define the contact resource. - - All required parameters must be populated in order to send to Azure. - - :param contact_profile: Required. The reference to the contact profile resource. - :type contact_profile: ~azure_orbital.models.ResourceReference - :param ground_station_name: Required. Name of Azure Ground Station. - :type ground_station_name: str - :param start_time: Required. Start time of a contact. - :type start_time: ~datetime.datetime - :param end_time: Required. End time of a contact. - :type end_time: ~datetime.datetime - """ - - _validation = { - 'contact_profile': {'required': True}, - 'ground_station_name': {'required': True}, - 'start_time': {'required': True}, - 'end_time': {'required': True}, - } - - _attribute_map = { - 'contact_profile': {'key': 'contactProfile', 'type': 'ResourceReference'}, - 'ground_station_name': {'key': 'groundStationName', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactParameters, self).__init__(**kwargs) - self.contact_profile = kwargs['contact_profile'] - self.ground_station_name = kwargs['ground_station_name'] - self.start_time = kwargs['start_time'] - self.end_time = kwargs['end_time'] - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure_orbital.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class ContactProfile(TrackedResource): - """Customer creates a Contact Profile Resource, which will contain all of the configurations required for scheduling a contact. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure_orbital.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :param minimum_viable_contact_duration: Minimum viable contact duration in ISO 8601 format. - :type minimum_viable_contact_duration: str - :param minimum_elevation_degrees: Minimum viable elevation for the contact in decimal degrees. - :type minimum_elevation_degrees: float - :param auto_tracking_configuration: Auto track configuration. Possible values include: - "disabled", "xBand", "sBand". - :type auto_tracking_configuration: str or ~azure_orbital.models.AutoTrackingConfiguration - :param links: Links of the Contact Profile. - :type links: list[~azure_orbital.models.ContactProfileLink] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'minimum_viable_contact_duration': {'key': 'properties.minimumViableContactDuration', 'type': 'str'}, - 'minimum_elevation_degrees': {'key': 'properties.minimumElevationDegrees', 'type': 'float'}, - 'auto_tracking_configuration': {'key': 'properties.autoTrackingConfiguration', 'type': 'str'}, - 'links': {'key': 'properties.links', 'type': '[ContactProfileLink]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactProfile, self).__init__(**kwargs) - self.etag = None - self.minimum_viable_contact_duration = kwargs.get('minimum_viable_contact_duration', None) - self.minimum_elevation_degrees = kwargs.get('minimum_elevation_degrees', None) - self.auto_tracking_configuration = kwargs.get('auto_tracking_configuration', None) - self.links = kwargs.get('links', None) - - -class ContactProfileLink(msrest.serialization.Model): - """Contact Profile link. - - All required parameters must be populated in order to send to Azure. - - :param polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: "RHCP", - "LHCP", "dualRhcpLhcp", "linearVertical", "linearHorizontal". - :type polarization: str or ~azure_orbital.models.Polarization - :param direction: Required. Direction (uplink or downlink). Possible values include: "uplink", - "downlink". - :type direction: str or ~azure_orbital.models.Direction - :param gain_over_temperature: Gain To Noise Temperature in db/K. - :type gain_over_temperature: float - :param eirpd_bw: Effective Isotropic Radiated Power (EIRP) in dBW. - :type eirpd_bw: float - :param channels: Required. Contact Profile Link Channel. - :type channels: list[~azure_orbital.models.ContactProfileLinkChannel] - """ - - _validation = { - 'polarization': {'required': True}, - 'direction': {'required': True}, - 'channels': {'required': True}, - } - - _attribute_map = { - 'polarization': {'key': 'polarization', 'type': 'str'}, - 'direction': {'key': 'direction', 'type': 'str'}, - 'gain_over_temperature': {'key': 'gainOverTemperature', 'type': 'float'}, - 'eirpd_bw': {'key': 'eirpdBW', 'type': 'float'}, - 'channels': {'key': 'channels', 'type': '[ContactProfileLinkChannel]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactProfileLink, self).__init__(**kwargs) - self.polarization = kwargs['polarization'] - self.direction = kwargs['direction'] - self.gain_over_temperature = kwargs.get('gain_over_temperature', None) - self.eirpd_bw = kwargs.get('eirpd_bw', None) - self.channels = kwargs['channels'] - - -class ContactProfileLinkChannel(msrest.serialization.Model): - """Contact Profile Link Channel. - - All required parameters must be populated in order to send to Azure. - - :param center_frequency_m_hz: Required. Center Frequency in MHz. - :type center_frequency_m_hz: float - :param bandwidth_m_hz: Required. Bandwidth in MHz. - :type bandwidth_m_hz: float - :param end_point: Required. Customer End point to store/retrieve data during a contact. - :type end_point: ~azure_orbital.models.EndPoint - :param modulation_configuration: Configuration for modulation. - :type modulation_configuration: str - :param demodulation_configuration: Configuration for demodulation. - :type demodulation_configuration: str - :param encoding_configuration: Configuration for encoding. - :type encoding_configuration: str - :param decoding_configuration: Configuration for decoding. - :type decoding_configuration: str - """ - - _validation = { - 'center_frequency_m_hz': {'required': True}, - 'bandwidth_m_hz': {'required': True}, - 'end_point': {'required': True}, - } - - _attribute_map = { - 'center_frequency_m_hz': {'key': 'centerFrequencyMHz', 'type': 'float'}, - 'bandwidth_m_hz': {'key': 'bandwidthMHz', 'type': 'float'}, - 'end_point': {'key': 'endPoint', 'type': 'EndPoint'}, - 'modulation_configuration': {'key': 'modulationConfiguration', 'type': 'str'}, - 'demodulation_configuration': {'key': 'demodulationConfiguration', 'type': 'str'}, - 'encoding_configuration': {'key': 'encodingConfiguration', 'type': 'str'}, - 'decoding_configuration': {'key': 'decodingConfiguration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactProfileLinkChannel, self).__init__(**kwargs) - self.center_frequency_m_hz = kwargs['center_frequency_m_hz'] - self.bandwidth_m_hz = kwargs['bandwidth_m_hz'] - self.end_point = kwargs['end_point'] - self.modulation_configuration = kwargs.get('modulation_configuration', None) - self.demodulation_configuration = kwargs.get('demodulation_configuration', None) - self.encoding_configuration = kwargs.get('encoding_configuration', None) - self.decoding_configuration = kwargs.get('decoding_configuration', None) - - -class ContactProfileListResult(msrest.serialization.Model): - """Response for the ListContactProfiles API service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: A list of contact profile resources in a resource group. - :type value: list[~azure_orbital.models.ContactProfile] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ContactProfile]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContactProfileListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class EndPoint(msrest.serialization.Model): - """Customer End point to store/retrieve data during a contact. - - All required parameters must be populated in order to send to Azure. - - :param ip_address: Required. IP Address. - :type ip_address: str - :param end_point_name: Required. Name of an end point. - :type end_point_name: str - :param port: Required. TCP port to listen on to receive data. - :type port: str - :param protocol: Required. Protocol either UDP or TCP. Possible values include: "TCP", "UDP". - :type protocol: str or ~azure_orbital.models.Protocol - """ - - _validation = { - 'ip_address': {'required': True}, - 'end_point_name': {'required': True}, - 'port': {'required': True}, - 'protocol': {'required': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'end_point_name': {'key': 'endPointName', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'str'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EndPoint, self).__init__(**kwargs) - self.ip_address = kwargs['ip_address'] - self.end_point_name = kwargs['end_point_name'] - self.port = kwargs['port'] - self.protocol = kwargs['protocol'] - - -class Operation(msrest.serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :param display: Localized display information for this particular operation. - :type display: ~azure_orbital.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", - "system", "user,system". - :vartype origin: str or ~azure_orbital.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure_orbital.models.ActionType - """ - - _validation = { - 'name': {'readonly': True}, - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - 'action_type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = kwargs.get('display', None) - self.origin = None - self.action_type = None - - -class OperationDisplay(msrest.serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(msrest.serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure_orbital.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ResourceIdListResult(msrest.serialization.Model): - """Response for an API service call that lists the resource IDs of resources associated with another resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: A list of Azure Resource IDs. - :type value: list[~azure_orbital.models.ResourceIdListResultValueItem] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceIdListResultValueItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceIdListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ResourceIdListResultValueItem(msrest.serialization.Model): - """ResourceIdListResultValueItem. - - :param id: The Azure Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceIdListResultValueItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class ResourceReference(msrest.serialization.Model): - """Resource Reference. - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceReference, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class Spacecraft(TrackedResource): - """Customer creates a spacecraft resource to schedule a contact. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure_orbital.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :param norad_id: NORAD ID of the spacecraft. - :type norad_id: str - :ivar authorization_status: Authorization status of spacecraft. Possible values include: - "Allowed", "Pending", "Denied". - :vartype authorization_status: str or ~azure_orbital.models.AuthorizationStatus - :ivar authorization_status_extended: Details of the authorization status. - :vartype authorization_status_extended: str - :param title_line: Title line of Two Line Element (TLE). - :type title_line: str - :param tle_line1: Line 1 of Two Line Element (TLE). - :type tle_line1: str - :param tle_line2: Line 2 of Two Line Element (TLE). - :type tle_line2: str - :param links: Links of the Spacecraft. - :type links: list[~azure_orbital.models.SpacecraftLink] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'etag': {'readonly': True}, - 'authorization_status': {'readonly': True}, - 'authorization_status_extended': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'norad_id': {'key': 'properties.noradId', 'type': 'str'}, - 'authorization_status': {'key': 'properties.authorizationStatus', 'type': 'str'}, - 'authorization_status_extended': {'key': 'properties.authorizationStatusExtended', 'type': 'str'}, - 'title_line': {'key': 'properties.titleLine', 'type': 'str'}, - 'tle_line1': {'key': 'properties.tleLine1', 'type': 'str'}, - 'tle_line2': {'key': 'properties.tleLine2', 'type': 'str'}, - 'links': {'key': 'properties.links', 'type': '[SpacecraftLink]'}, - } - - def __init__( - self, - **kwargs - ): - super(Spacecraft, self).__init__(**kwargs) - self.etag = None - self.norad_id = kwargs.get('norad_id', None) - self.authorization_status = None - self.authorization_status_extended = None - self.title_line = kwargs.get('title_line', None) - self.tle_line1 = kwargs.get('tle_line1', None) - self.tle_line2 = kwargs.get('tle_line2', None) - self.links = kwargs.get('links', None) - - -class SpacecraftLink(msrest.serialization.Model): - """Spacecraft Link. - - All required parameters must be populated in order to send to Azure. - - :param center_frequency_m_hz: Required. Center Frequency in MHz. - :type center_frequency_m_hz: float - :param bandwidth_m_hz: Required. Bandwidth in MHz. - :type bandwidth_m_hz: float - :param direction: Required. Direction (uplink or downlink). Possible values include: "uplink", - "downlink". - :type direction: str or ~azure_orbital.models.Direction - :param polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: "RHCP", - "LHCP", "dualRhcpLhcp", "linearVertical", "linearHorizontal". - :type polarization: str or ~azure_orbital.models.Polarization - """ - - _validation = { - 'center_frequency_m_hz': {'required': True}, - 'bandwidth_m_hz': {'required': True}, - 'direction': {'required': True}, - 'polarization': {'required': True}, - } - - _attribute_map = { - 'center_frequency_m_hz': {'key': 'centerFrequencyMHz', 'type': 'float'}, - 'bandwidth_m_hz': {'key': 'bandwidthMHz', 'type': 'float'}, - 'direction': {'key': 'direction', 'type': 'str'}, - 'polarization': {'key': 'polarization', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SpacecraftLink, self).__init__(**kwargs) - self.center_frequency_m_hz = kwargs['center_frequency_m_hz'] - self.bandwidth_m_hz = kwargs['bandwidth_m_hz'] - self.direction = kwargs['direction'] - self.polarization = kwargs['polarization'] - - -class SpacecraftListResult(msrest.serialization.Model): - """Response for the ListSpacecrafts API service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: A list of spacecraft resources in a resource group. - :type value: list[~azure_orbital.models.Spacecraft] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Spacecraft]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SpacecraftListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure_orbital.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure_orbital.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TagsObject(msrest.serialization.Model): - """Tags object for patch operations. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TagsObject, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models_py3.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models_py3.py index 52fff858cbb67..4f6b6986439a4 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models_py3.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models_py3.py @@ -19,8 +19,8 @@ class AvailableContacts(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param spacecraft: The reference to the spacecraft resource. - :type spacecraft: ~azure_orbital.models.ResourceReference + :ivar spacecraft: The reference to the spacecraft resource. + :vartype spacecraft: ~azure_orbital.models.ResourceReference :ivar ground_station_name: Name of Azure Ground Station. :vartype ground_station_name: str :ivar maximum_elevation_degrees: Maximum elevation of the antenna during the contact in decimal @@ -78,6 +78,10 @@ def __init__( spacecraft: Optional["ResourceReference"] = None, **kwargs ): + """ + :keyword spacecraft: The reference to the spacecraft resource. + :paramtype spacecraft: ~azure_orbital.models.ResourceReference + """ super(AvailableContacts, self).__init__(**kwargs) self.spacecraft = spacecraft self.ground_station_name = None @@ -97,8 +101,8 @@ class AvailableContactsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: A list of available contacts. - :type value: list[~azure_orbital.models.AvailableContacts] + :ivar value: A list of available contacts. + :vartype value: list[~azure_orbital.models.AvailableContacts] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -118,6 +122,10 @@ def __init__( value: Optional[List["AvailableContacts"]] = None, **kwargs ): + """ + :keyword value: A list of available contacts. + :paramtype value: list[~azure_orbital.models.AvailableContacts] + """ super(AvailableContactsListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -132,20 +140,20 @@ class AvailableGroundStation(msrest.serialization.Model): :vartype id: str :ivar name: Name of the ground station. :vartype name: str - :param location: Azure region. - :type location: str + :ivar location: Azure region. + :vartype location: str :ivar type: Resource type. :vartype type: str - :param city: City of ground station. - :type city: str - :param provider_name: Ground station provider name. - :type provider_name: str - :param longitude_degrees: Longitude of the ground station in decimal degrees. - :type longitude_degrees: float - :param latitude_degrees: Latitude of the ground station in decimal degrees. - :type latitude_degrees: float - :param altitude_meters: Altitude of the ground station. - :type altitude_meters: float + :ivar city: City of ground station. + :vartype city: str + :ivar provider_name: Ground station provider name. + :vartype provider_name: str + :ivar longitude_degrees: Longitude of the ground station in decimal degrees. + :vartype longitude_degrees: float + :ivar latitude_degrees: Latitude of the ground station in decimal degrees. + :vartype latitude_degrees: float + :ivar altitude_meters: Altitude of the ground station. + :vartype altitude_meters: float """ _validation = { @@ -177,6 +185,20 @@ def __init__( altitude_meters: Optional[float] = None, **kwargs ): + """ + :keyword location: Azure region. + :paramtype location: str + :keyword city: City of ground station. + :paramtype city: str + :keyword provider_name: Ground station provider name. + :paramtype provider_name: str + :keyword longitude_degrees: Longitude of the ground station in decimal degrees. + :paramtype longitude_degrees: float + :keyword latitude_degrees: Latitude of the ground station in decimal degrees. + :paramtype latitude_degrees: float + :keyword altitude_meters: Altitude of the ground station. + :paramtype altitude_meters: float + """ super(AvailableGroundStation, self).__init__(**kwargs) self.id = None self.name = None @@ -194,8 +216,8 @@ class AvailableGroundStationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: A list of ground station resources. - :type value: list[~azure_orbital.models.AvailableGroundStation] + :ivar value: A list of ground station resources. + :vartype value: list[~azure_orbital.models.AvailableGroundStation] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -215,6 +237,10 @@ def __init__( value: Optional[List["AvailableGroundStation"]] = None, **kwargs ): + """ + :keyword value: A list of ground station resources. + :paramtype value: list[~azure_orbital.models.AvailableGroundStation] + """ super(AvailableGroundStationListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -223,17 +249,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure_orbital.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure_orbital.models.CloudErrorBody] """ _attribute_map = { @@ -252,6 +278,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure_orbital.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -295,6 +334,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -338,6 +379,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -362,10 +405,10 @@ class Contact(ProxyResource): :ivar status: Status of a contact. Possible values include: "scheduled", "cancelled", "succeeded", "failed", "providerCancelled". :vartype status: str or ~azure_orbital.models.Status - :param reservation_start_time: Reservation start time of a contact. - :type reservation_start_time: ~datetime.datetime - :param reservation_end_time: Reservation end time of a contact. - :type reservation_end_time: ~datetime.datetime + :ivar reservation_start_time: Reservation start time of a contact. + :vartype reservation_start_time: ~datetime.datetime + :ivar reservation_end_time: Reservation end time of a contact. + :vartype reservation_end_time: ~datetime.datetime :ivar rx_start_time: Receive start time of a contact. :vartype rx_start_time: ~datetime.datetime :ivar rx_end_time: Receive end time of a contact. @@ -384,14 +427,14 @@ class Contact(ProxyResource): :vartype start_azimuth_degrees: float :ivar end_azimuth_degrees: Azimuth of the antenna at the end of the contact in decimal degrees. :vartype end_azimuth_degrees: float - :param ground_station_name: Azure Ground Station name. - :type ground_station_name: str + :ivar ground_station_name: Azure Ground Station name. + :vartype ground_station_name: str :ivar start_elevation_degrees: Spacecraft elevation above the horizon at contact start. :vartype start_elevation_degrees: float :ivar end_elevation_degrees: Spacecraft elevation above the horizon at contact end. :vartype end_elevation_degrees: float - :param contact_profile: The reference to the contact profile resource. - :type contact_profile: ~azure_orbital.models.ResourceReference + :ivar contact_profile: The reference to the contact profile resource. + :vartype contact_profile: ~azure_orbital.models.ResourceReference """ _validation = { @@ -445,6 +488,16 @@ def __init__( contact_profile: Optional["ResourceReference"] = None, **kwargs ): + """ + :keyword reservation_start_time: Reservation start time of a contact. + :paramtype reservation_start_time: ~datetime.datetime + :keyword reservation_end_time: Reservation end time of a contact. + :paramtype reservation_end_time: ~datetime.datetime + :keyword ground_station_name: Azure Ground Station name. + :paramtype ground_station_name: str + :keyword contact_profile: The reference to the contact profile resource. + :paramtype contact_profile: ~azure_orbital.models.ResourceReference + """ super(Contact, self).__init__(**kwargs) self.etag = None self.status = None @@ -469,8 +522,8 @@ class ContactListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: A list of contact resources in a resource group. - :type value: list[~azure_orbital.models.Contact] + :ivar value: A list of contact resources in a resource group. + :vartype value: list[~azure_orbital.models.Contact] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -490,6 +543,10 @@ def __init__( value: Optional[List["Contact"]] = None, **kwargs ): + """ + :keyword value: A list of contact resources in a resource group. + :paramtype value: list[~azure_orbital.models.Contact] + """ super(ContactListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -500,14 +557,14 @@ class ContactParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param contact_profile: Required. The reference to the contact profile resource. - :type contact_profile: ~azure_orbital.models.ResourceReference - :param ground_station_name: Required. Name of Azure Ground Station. - :type ground_station_name: str - :param start_time: Required. Start time of a contact. - :type start_time: ~datetime.datetime - :param end_time: Required. End time of a contact. - :type end_time: ~datetime.datetime + :ivar contact_profile: Required. The reference to the contact profile resource. + :vartype contact_profile: ~azure_orbital.models.ResourceReference + :ivar ground_station_name: Required. Name of Azure Ground Station. + :vartype ground_station_name: str + :ivar start_time: Required. Start time of a contact. + :vartype start_time: ~datetime.datetime + :ivar end_time: Required. End time of a contact. + :vartype end_time: ~datetime.datetime """ _validation = { @@ -533,6 +590,16 @@ def __init__( end_time: datetime.datetime, **kwargs ): + """ + :keyword contact_profile: Required. The reference to the contact profile resource. + :paramtype contact_profile: ~azure_orbital.models.ResourceReference + :keyword ground_station_name: Required. Name of Azure Ground Station. + :paramtype ground_station_name: str + :keyword start_time: Required. Start time of a contact. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Required. End time of a contact. + :paramtype end_time: ~datetime.datetime + """ super(ContactParameters, self).__init__(**kwargs) self.contact_profile = contact_profile self.ground_station_name = ground_station_name @@ -558,10 +625,10 @@ class TrackedResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure_orbital.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -588,6 +655,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -611,21 +684,23 @@ class ContactProfile(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure_orbital.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :param minimum_viable_contact_duration: Minimum viable contact duration in ISO 8601 format. - :type minimum_viable_contact_duration: str - :param minimum_elevation_degrees: Minimum viable elevation for the contact in decimal degrees. - :type minimum_elevation_degrees: float - :param auto_tracking_configuration: Auto track configuration. Possible values include: + :ivar minimum_viable_contact_duration: Minimum viable contact duration in ISO 8601 format. + :vartype minimum_viable_contact_duration: str + :ivar minimum_elevation_degrees: Minimum viable elevation for the contact in decimal degrees. + :vartype minimum_elevation_degrees: float + :ivar auto_tracking_configuration: Auto track configuration. Possible values include: "disabled", "xBand", "sBand". - :type auto_tracking_configuration: str or ~azure_orbital.models.AutoTrackingConfiguration - :param links: Links of the Contact Profile. - :type links: list[~azure_orbital.models.ContactProfileLink] + :vartype auto_tracking_configuration: str or ~azure_orbital.models.AutoTrackingConfiguration + :ivar event_hub_uri: The URI of the Event Hub used for telemetry. + :vartype event_hub_uri: str + :ivar links: Links of the Contact Profile. + :vartype links: list[~azure_orbital.models.ContactProfileLink] """ _validation = { @@ -648,6 +723,7 @@ class ContactProfile(TrackedResource): 'minimum_viable_contact_duration': {'key': 'properties.minimumViableContactDuration', 'type': 'str'}, 'minimum_elevation_degrees': {'key': 'properties.minimumElevationDegrees', 'type': 'float'}, 'auto_tracking_configuration': {'key': 'properties.autoTrackingConfiguration', 'type': 'str'}, + 'event_hub_uri': {'key': 'properties.eventHubUri', 'type': 'str'}, 'links': {'key': 'properties.links', 'type': '[ContactProfileLink]'}, } @@ -659,14 +735,34 @@ def __init__( minimum_viable_contact_duration: Optional[str] = None, minimum_elevation_degrees: Optional[float] = None, auto_tracking_configuration: Optional[Union[str, "AutoTrackingConfiguration"]] = None, + event_hub_uri: Optional[str] = None, links: Optional[List["ContactProfileLink"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword minimum_viable_contact_duration: Minimum viable contact duration in ISO 8601 format. + :paramtype minimum_viable_contact_duration: str + :keyword minimum_elevation_degrees: Minimum viable elevation for the contact in decimal + degrees. + :paramtype minimum_elevation_degrees: float + :keyword auto_tracking_configuration: Auto track configuration. Possible values include: + "disabled", "xBand", "sBand". + :paramtype auto_tracking_configuration: str or ~azure_orbital.models.AutoTrackingConfiguration + :keyword event_hub_uri: The URI of the Event Hub used for telemetry. + :paramtype event_hub_uri: str + :keyword links: Links of the Contact Profile. + :paramtype links: list[~azure_orbital.models.ContactProfileLink] + """ super(ContactProfile, self).__init__(tags=tags, location=location, **kwargs) self.etag = None self.minimum_viable_contact_duration = minimum_viable_contact_duration self.minimum_elevation_degrees = minimum_elevation_degrees self.auto_tracking_configuration = auto_tracking_configuration + self.event_hub_uri = event_hub_uri self.links = links @@ -675,18 +771,18 @@ class ContactProfileLink(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: "RHCP", + :ivar polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: "RHCP", "LHCP", "dualRhcpLhcp", "linearVertical", "linearHorizontal". - :type polarization: str or ~azure_orbital.models.Polarization - :param direction: Required. Direction (uplink or downlink). Possible values include: "uplink", + :vartype polarization: str or ~azure_orbital.models.Polarization + :ivar direction: Required. Direction (uplink or downlink). Possible values include: "uplink", "downlink". - :type direction: str or ~azure_orbital.models.Direction - :param gain_over_temperature: Gain To Noise Temperature in db/K. - :type gain_over_temperature: float - :param eirpd_bw: Effective Isotropic Radiated Power (EIRP) in dBW. - :type eirpd_bw: float - :param channels: Required. Contact Profile Link Channel. - :type channels: list[~azure_orbital.models.ContactProfileLinkChannel] + :vartype direction: str or ~azure_orbital.models.Direction + :ivar gain_over_temperature: Gain To Noise Temperature in db/K. + :vartype gain_over_temperature: float + :ivar eirpd_bw: Effective Isotropic Radiated Power (EIRP) in dBW. + :vartype eirpd_bw: float + :ivar channels: Required. Contact Profile Link Channel. + :vartype channels: list[~azure_orbital.models.ContactProfileLinkChannel] """ _validation = { @@ -713,6 +809,20 @@ def __init__( eirpd_bw: Optional[float] = None, **kwargs ): + """ + :keyword polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: + "RHCP", "LHCP", "dualRhcpLhcp", "linearVertical", "linearHorizontal". + :paramtype polarization: str or ~azure_orbital.models.Polarization + :keyword direction: Required. Direction (uplink or downlink). Possible values include: + "uplink", "downlink". + :paramtype direction: str or ~azure_orbital.models.Direction + :keyword gain_over_temperature: Gain To Noise Temperature in db/K. + :paramtype gain_over_temperature: float + :keyword eirpd_bw: Effective Isotropic Radiated Power (EIRP) in dBW. + :paramtype eirpd_bw: float + :keyword channels: Required. Contact Profile Link Channel. + :paramtype channels: list[~azure_orbital.models.ContactProfileLinkChannel] + """ super(ContactProfileLink, self).__init__(**kwargs) self.polarization = polarization self.direction = direction @@ -726,20 +836,20 @@ class ContactProfileLinkChannel(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param center_frequency_m_hz: Required. Center Frequency in MHz. - :type center_frequency_m_hz: float - :param bandwidth_m_hz: Required. Bandwidth in MHz. - :type bandwidth_m_hz: float - :param end_point: Required. Customer End point to store/retrieve data during a contact. - :type end_point: ~azure_orbital.models.EndPoint - :param modulation_configuration: Configuration for modulation. - :type modulation_configuration: str - :param demodulation_configuration: Configuration for demodulation. - :type demodulation_configuration: str - :param encoding_configuration: Configuration for encoding. - :type encoding_configuration: str - :param decoding_configuration: Configuration for decoding. - :type decoding_configuration: str + :ivar center_frequency_m_hz: Required. Center Frequency in MHz. + :vartype center_frequency_m_hz: float + :ivar bandwidth_m_hz: Required. Bandwidth in MHz. + :vartype bandwidth_m_hz: float + :ivar end_point: Required. Customer End point to store/retrieve data during a contact. + :vartype end_point: ~azure_orbital.models.EndPoint + :ivar modulation_configuration: Configuration for modulation. + :vartype modulation_configuration: str + :ivar demodulation_configuration: Configuration for demodulation. + :vartype demodulation_configuration: str + :ivar encoding_configuration: Configuration for encoding. + :vartype encoding_configuration: str + :ivar decoding_configuration: Configuration for decoding. + :vartype decoding_configuration: str """ _validation = { @@ -770,6 +880,22 @@ def __init__( decoding_configuration: Optional[str] = None, **kwargs ): + """ + :keyword center_frequency_m_hz: Required. Center Frequency in MHz. + :paramtype center_frequency_m_hz: float + :keyword bandwidth_m_hz: Required. Bandwidth in MHz. + :paramtype bandwidth_m_hz: float + :keyword end_point: Required. Customer End point to store/retrieve data during a contact. + :paramtype end_point: ~azure_orbital.models.EndPoint + :keyword modulation_configuration: Configuration for modulation. + :paramtype modulation_configuration: str + :keyword demodulation_configuration: Configuration for demodulation. + :paramtype demodulation_configuration: str + :keyword encoding_configuration: Configuration for encoding. + :paramtype encoding_configuration: str + :keyword decoding_configuration: Configuration for decoding. + :paramtype decoding_configuration: str + """ super(ContactProfileLinkChannel, self).__init__(**kwargs) self.center_frequency_m_hz = center_frequency_m_hz self.bandwidth_m_hz = bandwidth_m_hz @@ -785,8 +911,8 @@ class ContactProfileListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: A list of contact profile resources in a resource group. - :type value: list[~azure_orbital.models.ContactProfile] + :ivar value: A list of contact profile resources in a resource group. + :vartype value: list[~azure_orbital.models.ContactProfile] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -806,6 +932,10 @@ def __init__( value: Optional[List["ContactProfile"]] = None, **kwargs ): + """ + :keyword value: A list of contact profile resources in a resource group. + :paramtype value: list[~azure_orbital.models.ContactProfile] + """ super(ContactProfileListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -816,14 +946,14 @@ class EndPoint(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param ip_address: Required. IP Address. - :type ip_address: str - :param end_point_name: Required. Name of an end point. - :type end_point_name: str - :param port: Required. TCP port to listen on to receive data. - :type port: str - :param protocol: Required. Protocol either UDP or TCP. Possible values include: "TCP", "UDP". - :type protocol: str or ~azure_orbital.models.Protocol + :ivar ip_address: Required. IP Address. + :vartype ip_address: str + :ivar end_point_name: Required. Name of an end point. + :vartype end_point_name: str + :ivar port: Required. TCP port to listen on to receive data. + :vartype port: str + :ivar protocol: Required. Protocol either UDP or TCP. Possible values include: "TCP", "UDP". + :vartype protocol: str or ~azure_orbital.models.Protocol """ _validation = { @@ -849,6 +979,16 @@ def __init__( protocol: Union[str, "Protocol"], **kwargs ): + """ + :keyword ip_address: Required. IP Address. + :paramtype ip_address: str + :keyword end_point_name: Required. Name of an end point. + :paramtype end_point_name: str + :keyword port: Required. TCP port to listen on to receive data. + :paramtype port: str + :keyword protocol: Required. Protocol either UDP or TCP. Possible values include: "TCP", "UDP". + :paramtype protocol: str or ~azure_orbital.models.Protocol + """ super(EndPoint, self).__init__(**kwargs) self.ip_address = ip_address self.end_point_name = end_point_name @@ -867,8 +1007,8 @@ class Operation(msrest.serialization.Model): :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. :vartype is_data_action: bool - :param display: Localized display information for this particular operation. - :type display: ~azure_orbital.models.OperationDisplay + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure_orbital.models.OperationDisplay :ivar origin: The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", "system", "user,system". @@ -899,6 +1039,10 @@ def __init__( display: Optional["OperationDisplay"] = None, **kwargs ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure_orbital.models.OperationDisplay + """ super(Operation, self).__init__(**kwargs) self.name = None self.is_data_action = None @@ -944,6 +1088,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -976,6 +1122,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -986,8 +1134,8 @@ class ResourceIdListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: A list of Azure Resource IDs. - :type value: list[~azure_orbital.models.ResourceIdListResultValueItem] + :ivar value: A list of Azure Resource IDs. + :vartype value: list[~azure_orbital.models.ResourceIdListResultValueItem] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -1007,6 +1155,10 @@ def __init__( value: Optional[List["ResourceIdListResultValueItem"]] = None, **kwargs ): + """ + :keyword value: A list of Azure Resource IDs. + :paramtype value: list[~azure_orbital.models.ResourceIdListResultValueItem] + """ super(ResourceIdListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1015,8 +1167,8 @@ def __init__( class ResourceIdListResultValueItem(msrest.serialization.Model): """ResourceIdListResultValueItem. - :param id: The Azure Resource ID. - :type id: str + :ivar id: The Azure Resource ID. + :vartype id: str """ _attribute_map = { @@ -1029,6 +1181,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The Azure Resource ID. + :paramtype id: str + """ super(ResourceIdListResultValueItem, self).__init__(**kwargs) self.id = id @@ -1036,8 +1192,8 @@ def __init__( class ResourceReference(msrest.serialization.Model): """Resource Reference. - :param id: Resource ID. - :type id: str + :ivar id: Resource ID. + :vartype id: str """ _attribute_map = { @@ -1050,6 +1206,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ super(ResourceReference, self).__init__(**kwargs) self.id = id @@ -1072,27 +1232,27 @@ class Spacecraft(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure_orbital.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :param norad_id: NORAD ID of the spacecraft. - :type norad_id: str + :ivar norad_id: NORAD ID of the spacecraft. + :vartype norad_id: str :ivar authorization_status: Authorization status of spacecraft. Possible values include: "Allowed", "Pending", "Denied". :vartype authorization_status: str or ~azure_orbital.models.AuthorizationStatus :ivar authorization_status_extended: Details of the authorization status. :vartype authorization_status_extended: str - :param title_line: Title line of Two Line Element (TLE). - :type title_line: str - :param tle_line1: Line 1 of Two Line Element (TLE). - :type tle_line1: str - :param tle_line2: Line 2 of Two Line Element (TLE). - :type tle_line2: str - :param links: Links of the Spacecraft. - :type links: list[~azure_orbital.models.SpacecraftLink] + :ivar title_line: Title line of Two Line Element (TLE). + :vartype title_line: str + :ivar tle_line1: Line 1 of Two Line Element (TLE). + :vartype tle_line1: str + :ivar tle_line2: Line 2 of Two Line Element (TLE). + :vartype tle_line2: str + :ivar links: Links of the Spacecraft. + :vartype links: list[~azure_orbital.models.SpacecraftLink] """ _validation = { @@ -1135,6 +1295,22 @@ def __init__( links: Optional[List["SpacecraftLink"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword norad_id: NORAD ID of the spacecraft. + :paramtype norad_id: str + :keyword title_line: Title line of Two Line Element (TLE). + :paramtype title_line: str + :keyword tle_line1: Line 1 of Two Line Element (TLE). + :paramtype tle_line1: str + :keyword tle_line2: Line 2 of Two Line Element (TLE). + :paramtype tle_line2: str + :keyword links: Links of the Spacecraft. + :paramtype links: list[~azure_orbital.models.SpacecraftLink] + """ super(Spacecraft, self).__init__(tags=tags, location=location, **kwargs) self.etag = None self.norad_id = norad_id @@ -1151,16 +1327,16 @@ class SpacecraftLink(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param center_frequency_m_hz: Required. Center Frequency in MHz. - :type center_frequency_m_hz: float - :param bandwidth_m_hz: Required. Bandwidth in MHz. - :type bandwidth_m_hz: float - :param direction: Required. Direction (uplink or downlink). Possible values include: "uplink", + :ivar center_frequency_m_hz: Required. Center Frequency in MHz. + :vartype center_frequency_m_hz: float + :ivar bandwidth_m_hz: Required. Bandwidth in MHz. + :vartype bandwidth_m_hz: float + :ivar direction: Required. Direction (uplink or downlink). Possible values include: "uplink", "downlink". - :type direction: str or ~azure_orbital.models.Direction - :param polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: "RHCP", + :vartype direction: str or ~azure_orbital.models.Direction + :ivar polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: "RHCP", "LHCP", "dualRhcpLhcp", "linearVertical", "linearHorizontal". - :type polarization: str or ~azure_orbital.models.Polarization + :vartype polarization: str or ~azure_orbital.models.Polarization """ _validation = { @@ -1186,6 +1362,18 @@ def __init__( polarization: Union[str, "Polarization"], **kwargs ): + """ + :keyword center_frequency_m_hz: Required. Center Frequency in MHz. + :paramtype center_frequency_m_hz: float + :keyword bandwidth_m_hz: Required. Bandwidth in MHz. + :paramtype bandwidth_m_hz: float + :keyword direction: Required. Direction (uplink or downlink). Possible values include: + "uplink", "downlink". + :paramtype direction: str or ~azure_orbital.models.Direction + :keyword polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: + "RHCP", "LHCP", "dualRhcpLhcp", "linearVertical", "linearHorizontal". + :paramtype polarization: str or ~azure_orbital.models.Polarization + """ super(SpacecraftLink, self).__init__(**kwargs) self.center_frequency_m_hz = center_frequency_m_hz self.bandwidth_m_hz = bandwidth_m_hz @@ -1198,8 +1386,8 @@ class SpacecraftListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: A list of spacecraft resources in a resource group. - :type value: list[~azure_orbital.models.Spacecraft] + :ivar value: A list of spacecraft resources in a resource group. + :vartype value: list[~azure_orbital.models.Spacecraft] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -1219,6 +1407,10 @@ def __init__( value: Optional[List["Spacecraft"]] = None, **kwargs ): + """ + :keyword value: A list of spacecraft resources in a resource group. + :paramtype value: list[~azure_orbital.models.Spacecraft] + """ super(SpacecraftListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1227,20 +1419,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure_orbital.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure_orbital.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure_orbital.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure_orbital.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1263,6 +1455,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure_orbital.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure_orbital.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -1275,8 +1483,8 @@ def __init__( class TagsObject(msrest.serialization.Model): """Tags object for patch operations. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1289,5 +1497,9 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(TagsObject, self).__init__(**kwargs) self.tags = tags diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_available_ground_stations_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_available_ground_stations_operations.py index dc2e9627b0984..2567473ecc4b1 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_available_ground_stations_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_available_ground_stations_operations.py @@ -5,23 +5,92 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_capability_request( + subscription_id: str, + *, + capability: Union[str, "_models.Enum6"] = "EarthObservation", + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['capability'] = _SERIALIZER.query("capability", capability, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + ground_station_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "groundStationName": _SERIALIZER.url("ground_station_name", ground_station_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AvailableGroundStationsOperations(object): """AvailableGroundStationsOperations operations. @@ -45,18 +114,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_capability( self, - capability="EarthObservation", # type: Union[str, "_models.Enum6"] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailableGroundStationListResult"] + capability: Union[str, "_models.Enum6"] = "EarthObservation", + **kwargs: Any + ) -> Iterable["_models.AvailableGroundStationListResult"]: """Returns list of available ground stations. :param capability: Ground Station Capability. :type capability: str or ~azure_orbital.models.Enum6 :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailableGroundStationListResult or the result of cls(response) + :return: An iterator like instance of either AvailableGroundStationListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.AvailableGroundStationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -65,35 +135,31 @@ def list_by_capability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_capability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['capability'] = self._serialize.query("capability", capability, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_capability_request( + subscription_id=self._config.subscription_id, + capability=capability, + template_url=self.list_by_capability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_capability_request( + subscription_id=self._config.subscription_id, + capability=capability, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableGroundStationListResult', pipeline_response) + deserialized = self._deserialize("AvailableGroundStationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,17 +177,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_capability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations'} # type: ignore + @distributed_trace def get( self, - ground_station_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableGroundStation" + ground_station_name: str, + **kwargs: Any + ) -> "_models.AvailableGroundStation": """Gets the specified available ground station. :param ground_station_name: Ground Station name. @@ -136,26 +203,16 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'groundStationName': self._serialize.url("ground_station_name", ground_station_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + ground_station_name=ground_station_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,4 +226,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName}'} # type: ignore + diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py index 13e331bcb0118..0a6bac40c1fd4 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py @@ -5,25 +5,250 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + contact_profile_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "contactProfileName": _SERIALIZER.url("contact_profile_name", contact_profile_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + contact_profile_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "contactProfileName": _SERIALIZER.url("contact_profile_name", contact_profile_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + contact_profile_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "contactProfileName": _SERIALIZER.url("contact_profile_name", contact_profile_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_tags_request( + subscription_id: str, + resource_group_name: str, + contact_profile_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "contactProfileName": _SERIALIZER.url("contact_profile_name", contact_profile_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContactProfilesOperations(object): """ContactProfilesOperations operations. @@ -47,13 +272,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - contact_profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ContactProfile" + resource_group_name: str, + contact_profile_name: str, + **kwargs: Any + ) -> "_models.ContactProfile": """Gets the specified contact Profile in a specified resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -70,27 +295,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,54 +319,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - contact_profile_name, # type: str - location, # type: str - tags=None, # type: Optional[Dict[str, str]] - minimum_viable_contact_duration=None, # type: Optional[str] - minimum_elevation_degrees=None, # type: Optional[float] - auto_tracking_configuration=None, # type: Optional[Union[str, "_models.AutoTrackingConfiguration"]] - links=None, # type: Optional[List["_models.ContactProfileLink"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.ContactProfile" + resource_group_name: str, + contact_profile_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + minimum_viable_contact_duration: Optional[str] = None, + minimum_elevation_degrees: Optional[float] = None, + auto_tracking_configuration: Optional[Union[str, "_models.AutoTrackingConfiguration"]] = None, + event_hub_uri: Optional[str] = None, + links: Optional[List["_models.ContactProfileLink"]] = None, + **kwargs: Any + ) -> "_models.ContactProfile": cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.ContactProfile(tags=tags, location=location, minimum_viable_contact_duration=minimum_viable_contact_duration, minimum_elevation_degrees=minimum_elevation_degrees, auto_tracking_configuration=auto_tracking_configuration, links=links) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _parameters = _models.ContactProfile(tags=tags, location=location, minimum_viable_contact_duration=minimum_viable_contact_duration, minimum_elevation_degrees=minimum_elevation_degrees, auto_tracking_configuration=auto_tracking_configuration, event_hub_uri=event_hub_uri, links=links) + _json = self._serialize.body(_parameters, 'ContactProfile') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'ContactProfile') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,21 +375,24 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - contact_profile_name, # type: str - location, # type: str - tags=None, # type: Optional[Dict[str, str]] - minimum_viable_contact_duration=None, # type: Optional[str] - minimum_elevation_degrees=None, # type: Optional[float] - auto_tracking_configuration=None, # type: Optional[Union[str, "_models.AutoTrackingConfiguration"]] - links=None, # type: Optional[List["_models.ContactProfileLink"]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ContactProfile"] + resource_group_name: str, + contact_profile_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + minimum_viable_contact_duration: Optional[str] = None, + minimum_elevation_degrees: Optional[float] = None, + auto_tracking_configuration: Optional[Union[str, "_models.AutoTrackingConfiguration"]] = None, + event_hub_uri: Optional[str] = None, + links: Optional[List["_models.ContactProfileLink"]] = None, + **kwargs: Any + ) -> LROPoller["_models.ContactProfile"]: """Creates or updates a contact profile. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -200,19 +409,25 @@ def begin_create_or_update( :type minimum_elevation_degrees: float :param auto_tracking_configuration: Auto track configuration. :type auto_tracking_configuration: str or ~azure_orbital.models.AutoTrackingConfiguration + :param event_hub_uri: The URI of the Event Hub used for telemetry. + :type event_hub_uri: str :param links: Links of the Contact Profile. :type links: list[~azure_orbital.models.ContactProfileLink] :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ContactProfile or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ContactProfile or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure_orbital.models.ContactProfile] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] lro_delay = kwargs.pop( 'polling_interval', @@ -228,28 +443,23 @@ def begin_create_or_update( minimum_viable_contact_duration=minimum_viable_contact_duration, minimum_elevation_degrees=minimum_elevation_degrees, auto_tracking_configuration=auto_tracking_configuration, + event_hub_uri=event_hub_uri, links=links, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ContactProfile', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,41 +471,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - contact_profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + contact_profile_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,13 +508,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - contact_profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + contact_profile_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a specified contact profile resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -323,15 +524,17 @@ def begin_delete( :type contact_profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -345,21 +548,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -371,16 +567,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + @distributed_trace def update_tags( self, - resource_group_name, # type: str - contact_profile_name, # type: str - parameters, # type: "_models.TagsObject" - **kwargs # type: Any - ): - # type: (...) -> "_models.ContactProfile" + resource_group_name: str, + contact_profile_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.ContactProfile": """Updates the specified contact profile tags. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -399,32 +596,22 @@ def update_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagsObject') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -438,17 +625,20 @@ def update_tags( return cls(pipeline_response, deserialized, {}) return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContactProfileListResult"] + **kwargs: Any + ) -> Iterable["_models.ContactProfileListResult"]: """Returns list of contact profiles. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContactProfileListResult or the result of cls(response) + :return: An iterator like instance of either ContactProfileListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.ContactProfileListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -457,34 +647,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContactProfileListResult', pipeline_response) + deserialized = self._deserialize("ContactProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -502,23 +687,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContactProfileListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ContactProfileListResult"]: """Returns list of contact profiles. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContactProfileListResult or the result of cls(response) + :return: An iterator like instance of either ContactProfileListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.ContactProfileListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -527,35 +714,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContactProfileListResult', pipeline_response) + deserialized = self._deserialize("ContactProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -573,6 +756,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contacts_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contacts_operations.py index 46b06fd0e05b6..21c8e7b9aabfc 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contacts_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contacts_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + spacecraft_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_name, 'str'), + "contactName": _SERIALIZER.url("contact_name", contact_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_name, 'str'), + "contactName": _SERIALIZER.url("contact_name", contact_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_name, 'str'), + "contactName": _SERIALIZER.url("contact_name", contact_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContactsOperations(object): """ContactsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - spacecraft_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContactListResult"] + resource_group_name: str, + spacecraft_name: str, + **kwargs: Any + ) -> Iterable["_models.ContactListResult"]: """Returns list of contacts by spacecraftName. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -70,36 +228,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContactListResult', pipeline_response) + deserialized = self._deserialize("ContactListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +272,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - spacecraft_name, # type: str - contact_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Contact" + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + **kwargs: Any + ) -> "_models.Contact": """Gets the specified contact in a specified resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -148,28 +304,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - 'contactName': self._serialize.url("contact_name", contact_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,49 +329,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - spacecraft_name, # type: str - contact_name, # type: str - parameters, # type: "_models.Contact" - **kwargs # type: Any - ): - # type: (...) -> "_models.Contact" + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + parameters: "_models.Contact", + **kwargs: Any + ) -> "_models.Contact": cls = kwargs.pop('cls', None) # type: ClsType["_models.Contact"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - 'contactName': self._serialize.url("contact_name", contact_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Contact') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Contact') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,17 +380,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - spacecraft_name, # type: str - contact_name, # type: str - parameters, # type: "_models.Contact" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Contact"] + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + parameters: "_models.Contact", + **kwargs: Any + ) -> LROPoller["_models.Contact"]: """Creates a contact. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -266,15 +405,18 @@ def begin_create( :type parameters: ~azure_orbital.models.Contact :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Contact or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure_orbital.models.Contact] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Contact"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +429,21 @@ def begin_create( spacecraft_name=spacecraft_name, contact_name=contact_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Contact', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - 'contactName': self._serialize.url("contact_name", contact_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -320,43 +455,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - spacecraft_name, # type: str - contact_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - 'contactName': self._serialize.url("contact_name", contact_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -369,14 +494,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - spacecraft_name, # type: str - contact_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a specified contact. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -387,15 +513,17 @@ def begin_delete( :type contact_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,22 +538,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - 'contactName': self._serialize.url("contact_name", contact_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -437,4 +557,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py index e2b44b516e23f..9af551f215e3f 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Orbital/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Orbital Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,30 +89,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +127,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_spacecrafts_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_spacecrafts_operations.py index 148664d9ff61a..aba7a2b077334 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_spacecrafts_operations.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_spacecrafts_operations.py @@ -6,25 +6,294 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/spacecrafts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + spacecraft_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + spacecraft_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + spacecraft_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_tags_request( + subscription_id: str, + resource_group_name: str, + spacecraft_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_available_contacts_request_initial( + subscription_id: str, + resource_group_name: str, + spacecraft_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-04-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "spacecraftName": _SERIALIZER.url("spacecraft_name", spacecraft_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class SpacecraftsOperations(object): """SpacecraftsOperations operations. @@ -48,15 +317,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SpacecraftListResult"] + **kwargs: Any + ) -> Iterable["_models.SpacecraftListResult"]: """Return list of spacecrafts. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SpacecraftListResult or the result of cls(response) + :return: An iterator like instance of either SpacecraftListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.SpacecraftListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -65,34 +335,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SpacecraftListResult', pipeline_response) + deserialized = self._deserialize("SpacecraftListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,23 +375,25 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/spacecrafts'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SpacecraftListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SpacecraftListResult"]: """Return list of spacecrafts. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SpacecraftListResult or the result of cls(response) + :return: An iterator like instance of either SpacecraftListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.SpacecraftListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -135,35 +402,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SpacecraftListResult', pipeline_response) + deserialized = self._deserialize("SpacecraftListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -181,18 +444,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - spacecraft_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Spacecraft" + resource_group_name: str, + spacecraft_name: str, + **kwargs: Any + ) -> "_models.Spacecraft": """Gets the specified spacecraft in a specified resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -209,27 +473,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,55 +497,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - spacecraft_name, # type: str - location, # type: str - tags=None, # type: Optional[Dict[str, str]] - norad_id=None, # type: Optional[str] - title_line=None, # type: Optional[str] - tle_line1=None, # type: Optional[str] - tle_line2=None, # type: Optional[str] - links=None, # type: Optional[List["_models.SpacecraftLink"]] - **kwargs # type: Any - ): - # type: (...) -> "_models.Spacecraft" + resource_group_name: str, + spacecraft_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + norad_id: Optional[str] = None, + title_line: Optional[str] = None, + tle_line1: Optional[str] = None, + tle_line2: Optional[str] = None, + links: Optional[List["_models.SpacecraftLink"]] = None, + **kwargs: Any + ) -> "_models.Spacecraft": cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.Spacecraft(tags=tags, location=location, norad_id=norad_id, title_line=title_line, tle_line1=tle_line1, tle_line2=tle_line2, links=links) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _parameters = _models.Spacecraft(tags=tags, location=location, norad_id=norad_id, title_line=title_line, tle_line1=tle_line1, tle_line2=tle_line2, links=links) + _json = self._serialize.body(_parameters, 'Spacecraft') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'Spacecraft') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -309,22 +553,24 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - spacecraft_name, # type: str - location, # type: str - tags=None, # type: Optional[Dict[str, str]] - norad_id=None, # type: Optional[str] - title_line=None, # type: Optional[str] - tle_line1=None, # type: Optional[str] - tle_line2=None, # type: Optional[str] - links=None, # type: Optional[List["_models.SpacecraftLink"]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Spacecraft"] + resource_group_name: str, + spacecraft_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + norad_id: Optional[str] = None, + title_line: Optional[str] = None, + tle_line1: Optional[str] = None, + tle_line2: Optional[str] = None, + links: Optional[List["_models.SpacecraftLink"]] = None, + **kwargs: Any + ) -> LROPoller["_models.Spacecraft"]: """Creates or updates a spacecraft resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -347,15 +593,18 @@ def begin_create_or_update( :type links: list[~azure_orbital.models.SpacecraftLink] :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Spacecraft or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure_orbital.models.Spacecraft] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] lro_delay = kwargs.pop( 'polling_interval', @@ -373,27 +622,21 @@ def begin_create_or_update( tle_line1=tle_line1, tle_line2=tle_line2, links=links, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Spacecraft', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -405,41 +648,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - spacecraft_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + spacecraft_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -452,13 +685,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - spacecraft_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + spacecraft_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a specified spacecraft resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -467,15 +701,17 @@ def begin_delete( :type spacecraft_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -489,21 +725,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -515,16 +744,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + @distributed_trace def update_tags( self, - resource_group_name, # type: str - spacecraft_name, # type: str - parameters, # type: "_models.TagsObject" - **kwargs # type: Any - ): - # type: (...) -> "_models.Spacecraft" + resource_group_name: str, + spacecraft_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.Spacecraft": """Updates the specified spacecraft tags. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -543,32 +773,22 @@ def update_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagsObject') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -582,52 +802,42 @@ def update_tags( return cls(pipeline_response, deserialized, {}) return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + def _list_available_contacts_initial( self, - resource_group_name, # type: str - spacecraft_name, # type: str - contact_profile, # type: "_models.ResourceReference" - ground_station_name, # type: str - start_time, # type: datetime.datetime - end_time, # type: datetime.datetime - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableContactsListResult" + resource_group_name: str, + spacecraft_name: str, + contact_profile: "_models.ResourceReference", + ground_station_name: str, + start_time: datetime.datetime, + end_time: datetime.datetime, + **kwargs: Any + ) -> "_models.AvailableContactsListResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.ContactParameters(contact_profile=contact_profile, ground_station_name=ground_station_name, start_time=start_time, end_time=end_time) - api_version = "2021-04-04-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._list_available_contacts_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _parameters = _models.ContactParameters(contact_profile=contact_profile, ground_station_name=ground_station_name, start_time=start_time, end_time=end_time) + _json = self._serialize.body(_parameters, 'ContactParameters') + + request = build_list_available_contacts_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + content_type=content_type, + json=_json, + template_url=self._list_available_contacts_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'ContactParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -641,19 +851,21 @@ def _list_available_contacts_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _list_available_contacts_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts'} # type: ignore + + @distributed_trace def begin_list_available_contacts( self, - resource_group_name, # type: str - spacecraft_name, # type: str - contact_profile, # type: "_models.ResourceReference" - ground_station_name, # type: str - start_time, # type: datetime.datetime - end_time, # type: datetime.datetime - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AvailableContactsListResult"] + resource_group_name: str, + spacecraft_name: str, + contact_profile: "_models.ResourceReference", + ground_station_name: str, + start_time: datetime.datetime, + end_time: datetime.datetime, + **kwargs: Any + ) -> LROPoller["_models.AvailableContactsListResult"]: """Return list of available contacts. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -670,15 +882,19 @@ def begin_list_available_contacts( :type end_time: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AvailableContactsListResult or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AvailableContactsListResult or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure_orbital.models.AvailableContactsListResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -693,27 +909,21 @@ def begin_list_available_contacts( ground_station_name=ground_station_name, start_time=start_time, end_time=end_time, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AvailableContactsListResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -725,4 +935,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_available_contacts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts'} # type: ignore