From 5aae1233129455455029bbceee107bbd8a4d0e15 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 27 Apr 2022 00:15:16 +0000 Subject: [PATCH] CodeGen from PR 18551 in Azure/azure-rest-api-specs [Hub Generated] Publish private branch 'dev-orbital-Microsoft.Orbital-2021-04-04-preview' (#18551) * 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 * stable API version 2022-03-01 * valid json * lint diff fix * lint diff fix 2 * avocado fix * lint diff warninga 1 * lint diff warnings 2 * prettier fix * readme.me updated 2022-03-01 * Update readme.python.md 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 Co-authored-by: Yuchao Yan --- sdk/orbital/azure-mgmt-orbital/_meta.json | 10 +- .../azure/mgmt/orbital/__init__.py | 9 +- .../azure/mgmt/orbital/_azure_orbital.py | 116 +- .../azure/mgmt/orbital/_configuration.py | 28 +- .../azure/mgmt/orbital/_metadata.json | 28 +- .../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 | 104 +- .../azure/mgmt/orbital/aio/_configuration.py | 15 +- .../azure/mgmt/orbital/aio/_patch.py | 31 + .../mgmt/orbital/aio/operations/__init__.py | 2 + .../_available_ground_stations_operations.py | 122 +- .../_contact_profiles_operations.py | 564 ++++--- .../aio/operations/_contacts_operations.py | 311 ++-- .../orbital/aio/operations/_operations.py | 60 +- .../_operations_results_operations.py | 165 ++ .../aio/operations/_spacecrafts_operations.py | 741 +++++---- .../azure/mgmt/orbital/models/__init__.py | 130 +- .../orbital/models/_azure_orbital_enums.py | 111 +- .../azure/mgmt/orbital/models/_models.py | 1195 -------------- .../azure/mgmt/orbital/models/_models_py3.py | 1369 ++++++++++++++--- .../azure/mgmt/orbital/operations/__init__.py | 2 + .../_available_ground_stations_operations.py | 213 ++- .../_contact_profiles_operations.py | 897 +++++++---- .../operations/_contacts_operations.py | 549 ++++--- .../mgmt/orbital/operations/_operations.py | 102 +- .../_operations_results_operations.py | 204 +++ .../operations/_spacecrafts_operations.py | 1144 +++++++++----- 29 files changed, 5018 insertions(+), 3267 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 create mode 100644 sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations_results_operations.py delete mode 100644 sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models.py create mode 100644 sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations_results_operations.py diff --git a/sdk/orbital/azure-mgmt-orbital/_meta.json b/sdk/orbital/azure-mgmt-orbital/_meta.json index d0317cc69b92..c8cdd470b917 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.13.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "8c7612b823f693c6d7bc607594ed30b5ecb72730", + "commit": "a5cd8e4c6a799a60d90a2f4a190ea930ea509d9d", "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-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.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 342c98524bd4..0164338153a3 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 8e2f7cde33ce..d3a958fd1c00 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,94 +6,98 @@ # 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, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -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 azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -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 +from ._configuration import AzureOrbitalConfiguration +from .operations import AvailableGroundStationsOperations, ContactProfilesOperations, ContactsOperations, Operations, OperationsResultsOperations, SpacecraftsOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class AzureOrbital(object): +class AzureOrbital: """Azure Orbital service. :ivar operations: Operations operations - :vartype operations: azure_orbital.operations.Operations + :vartype operations: azure.mgmt.orbital.operations.Operations :ivar spacecrafts: SpacecraftsOperations operations - :vartype spacecrafts: azure_orbital.operations.SpacecraftsOperations + :vartype spacecrafts: azure.mgmt.orbital.operations.SpacecraftsOperations :ivar contacts: ContactsOperations operations - :vartype contacts: azure_orbital.operations.ContactsOperations + :vartype contacts: azure.mgmt.orbital.operations.ContactsOperations :ivar contact_profiles: ContactProfilesOperations operations - :vartype contact_profiles: azure_orbital.operations.ContactProfilesOperations + :vartype contact_profiles: azure.mgmt.orbital.operations.ContactProfilesOperations :ivar available_ground_stations: AvailableGroundStationsOperations operations - :vartype available_ground_stations: azure_orbital.operations.AvailableGroundStationsOperations + :vartype available_ground_stations: + azure.mgmt.orbital.operations.AvailableGroundStationsOperations + :ivar operations_results: OperationsResultsOperations operations + :vartype operations_results: azure.mgmt.orbital.operations.OperationsResultsOperations :param credential: Credential needed for the client to connect to Azure. :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 api_version: Api Version. Default value is "2022-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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_results = OperationsResultsOperations(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: 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 fc8920d8f223..ab03ad8b4a38 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py @@ -6,22 +6,20 @@ # 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 -class AzureOrbitalConfiguration(Configuration): +class AzureOrbitalConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureOrbital. Note that all parameters used to create this instance are saved as instance @@ -31,24 +29,28 @@ class AzureOrbitalConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ 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) + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + 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 - self.api_version = "2021-04-04-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-orbital/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +70,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 972824a4331f..e4a7c3677e9b 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_metadata.json +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-04-04-preview", - "total_api_version_list": ["2021-04-04-preview"], + "chosen_version": "2022-03-01", + "total_api_version_list": ["2022-03-01"], "client": { "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\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureOrbitalConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"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\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureOrbitalConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"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,17 +91,17 @@ "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", "spacecrafts": "SpacecraftsOperations", "contacts": "ContactsOperations", "contact_profiles": "ContactProfilesOperations", - "available_ground_stations": "AvailableGroundStationsOperations" + "available_ground_stations": "AvailableGroundStationsOperations", + "operations_results": "OperationsResultsOperations" } } \ No newline at end of file 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 000000000000..74e48ecd07cf --- /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 000000000000..138f663c53a4 --- /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 ecd68d66b7c7..8c5aa2124511 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 0ccdab333b46..445445ec3217 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,90 +6,98 @@ # 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, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -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 +from ._configuration import AzureOrbitalConfiguration +from .operations import AvailableGroundStationsOperations, ContactProfilesOperations, ContactsOperations, Operations, OperationsResultsOperations, SpacecraftsOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class AzureOrbital(object): +class AzureOrbital: """Azure Orbital service. :ivar operations: Operations operations - :vartype operations: azure_orbital.aio.operations.Operations + :vartype operations: azure.mgmt.orbital.aio.operations.Operations :ivar spacecrafts: SpacecraftsOperations operations - :vartype spacecrafts: azure_orbital.aio.operations.SpacecraftsOperations + :vartype spacecrafts: azure.mgmt.orbital.aio.operations.SpacecraftsOperations :ivar contacts: ContactsOperations operations - :vartype contacts: azure_orbital.aio.operations.ContactsOperations + :vartype contacts: azure.mgmt.orbital.aio.operations.ContactsOperations :ivar contact_profiles: ContactProfilesOperations operations - :vartype contact_profiles: azure_orbital.aio.operations.ContactProfilesOperations + :vartype contact_profiles: azure.mgmt.orbital.aio.operations.ContactProfilesOperations :ivar available_ground_stations: AvailableGroundStationsOperations operations - :vartype available_ground_stations: azure_orbital.aio.operations.AvailableGroundStationsOperations + :vartype available_ground_stations: + azure.mgmt.orbital.aio.operations.AvailableGroundStationsOperations + :ivar operations_results: OperationsResultsOperations operations + :vartype operations_results: azure.mgmt.orbital.aio.operations.OperationsResultsOperations :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 api_version: Api Version. Default value is "2022-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: 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_results = OperationsResultsOperations(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 3e14ada0e4e8..9d05b5e4a1c6 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 @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AzureOrbitalConfiguration(Configuration): +class AzureOrbitalConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureOrbital. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class AzureOrbitalConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +40,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AzureOrbitalConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + 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 - self.api_version = "2021-04-04-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-orbital/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +69,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 000000000000..74e48ecd07cf --- /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/__init__.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/__init__.py index 332d78334cb4..97de231640d7 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/__init__.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/__init__.py @@ -11,6 +11,7 @@ from ._contacts_operations import ContactsOperations from ._contact_profiles_operations import ContactProfilesOperations from ._available_ground_stations_operations import AvailableGroundStationsOperations +from ._operations_results_operations import OperationsResultsOperations __all__ = [ 'Operations', @@ -18,4 +19,5 @@ 'ContactsOperations', 'ContactProfilesOperations', 'AvailableGroundStationsOperations', + 'OperationsResultsOperations', ] 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 370a35ef5dcd..d770f914a8e9 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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 Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union 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]] @@ -26,7 +30,7 @@ class AvailableGroundStationsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_orbital.models + :type models: ~azure.mgmt.orbital.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,54 +45,57 @@ 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", + capability: Union[str, "_models.CapabilityParameter"] = "EarthObservation", **kwargs: Any ) -> AsyncIterable["_models.AvailableGroundStationListResult"]: """Returns list of available ground stations. - :param capability: Ground Station Capability. - :type capability: str or ~azure_orbital.models.Enum6 + :param capability: Ground Station Capability. Default value is "EarthObservation". + :type capability: str or ~azure.mgmt.orbital.models.CapabilityParameter :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.mgmt.orbital.models.AvailableGroundStationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableGroundStationListResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -97,7 +104,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,11 +117,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 + list_by_capability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations"} # type: ignore + @distributed_trace_async async def get( self, ground_station_name: str, @@ -122,7 +135,7 @@ async def get( :type ground_station_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AvailableGroundStation, or the result of cls(response) - :rtype: ~azure_orbital.models.AvailableGroundStation + :rtype: ~azure.mgmt.orbital.models.AvailableGroundStation :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableGroundStation"] @@ -130,27 +143,24 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -163,4 +173,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName}'} # type: ignore + + 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 0ff96e62d390..1d838985eca1 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # 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 Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union 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_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -28,7 +32,7 @@ class ContactProfilesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_orbital.models + :type models: ~azure.mgmt.orbital.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -43,6 +47,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, @@ -57,7 +62,7 @@ async def get( :type contact_profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ContactProfile, or the result of cls(response) - :rtype: ~azure_orbital.models.ContactProfile + :rtype: ~azure.mgmt.orbital.models.ContactProfile :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] @@ -65,28 +70,25 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + contact_profile_name=contact_profile_name, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +101,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}"} # type: ignore + async def _create_or_update_initial( self, @@ -107,9 +111,12 @@ async def _create_or_update_initial( contact_profile_name: str, location: str, tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "_models.ContactProfilesPropertiesProvisioningState"]] = 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, + network_configuration: Optional["_models.ContactProfilesPropertiesNetworkConfiguration"] = None, links: Optional[List["_models.ContactProfileLink"]] = None, **kwargs: Any ) -> "_models.ContactProfile": @@ -119,61 +126,65 @@ 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) - - # 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') - - 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) + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _parameters = _models.ContactProfile(tags=tags, location=location, provisioning_state=provisioning_state, 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, network_configuration=network_configuration, links=links) + _json = self._serialize.body(_parameters, 'ContactProfile') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + contact_profile_name=contact_profile_name, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('ContactProfile', pipeline_response) if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('ContactProfile', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + _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, contact_profile_name: str, location: str, tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "_models.ContactProfilesPropertiesProvisioningState"]] = 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, + network_configuration: Optional["_models.ContactProfilesPropertiesNetworkConfiguration"] = None, links: Optional[List["_models.ContactProfileLink"]] = None, **kwargs: Any ) -> AsyncLROPoller["_models.ContactProfile"]: @@ -185,26 +196,43 @@ async def begin_create_or_update( :type contact_profile_name: str :param location: The geo-location where the resource lives. :type location: str - :param tags: Resource tags. + :param tags: Resource tags. Default value is None. :type tags: dict[str, str] + :param provisioning_state: The current state of the resource's creation, deletion, or + modification. Default value is None. + :type provisioning_state: str or + ~azure.mgmt.orbital.models.ContactProfilesPropertiesProvisioningState :param minimum_viable_contact_duration: Minimum viable contact duration in ISO 8601 format. + Default value is None. :type minimum_viable_contact_duration: str :param minimum_elevation_degrees: Minimum viable elevation for the contact in decimal degrees. + Default value is None. :type minimum_elevation_degrees: float - :param auto_tracking_configuration: Auto track configuration. - :type auto_tracking_configuration: str or ~azure_orbital.models.AutoTrackingConfiguration - :param links: Links of the Contact Profile. - :type links: list[~azure_orbital.models.ContactProfileLink] + :param auto_tracking_configuration: Auto track configuration. Default value is None. + :type auto_tracking_configuration: str or ~azure.mgmt.orbital.models.AutoTrackingConfiguration + :param event_hub_uri: The URI of the Event Hub used for telemetry. Default value is None. + :type event_hub_uri: str + :param network_configuration: Network configuration of customer virtual network. Default value + is None. + :type network_configuration: + ~azure.mgmt.orbital.models.ContactProfilesPropertiesNetworkConfiguration + :param links: Links of the Contact Profile. Default value is None. + :type links: list[~azure.mgmt.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) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_orbital.models.ContactProfile] - :raises ~azure.core.exceptions.HttpResponseError: + :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.mgmt.orbital.models.ContactProfile] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] lro_delay = kwargs.pop( @@ -218,31 +246,29 @@ async def begin_create_or_update( contact_profile_name=contact_profile_name, location=location, tags=tags, + provisioning_state=provisioning_state, 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, + network_configuration=network_configuration, links=links, + api_version=api_version, + 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: @@ -252,11 +278,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, contact_profile_name: str, @@ -267,40 +293,44 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + contact_profile_name=contact_profile_name, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}"} # type: ignore - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, contact_profile_name: str, @@ -314,14 +344,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 """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -333,24 +366,18 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, contact_profile_name=contact_profile_name, + api_version=api_version, 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: @@ -360,17 +387,76 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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 - async def update_tags( + async def _update_tags_initial( self, resource_group_name: str, contact_profile_name: str, parameters: "_models.TagsObject", **kwargs: Any - ) -> "_models.ContactProfile": + ) -> Optional["_models.ContactProfile"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ContactProfile"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + contact_profile_name=contact_profile_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_tags_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('ContactProfile', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}"} # type: ignore + + + @distributed_trace_async + async def begin_update_tags( + self, + resource_group_name: str, + contact_profile_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> AsyncLROPoller["_models.ContactProfile"]: """Updates the specified contact profile tags. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -378,111 +464,131 @@ async def update_tags( :param contact_profile_name: Contact Profile Name. :type contact_profile_name: str :param parameters: Parameters supplied to update contact profile tags. - :type parameters: ~azure_orbital.models.TagsObject + :type parameters: ~azure.mgmt.orbital.models.TagsObject :keyword callable cls: A custom type or function that will be passed the direct response - :return: ContactProfile, or the result of cls(response) - :rtype: ~azure_orbital.models.ContactProfile + :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. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.orbital.models.ContactProfile] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] - 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.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') - - # 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') - - 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 + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_tags_initial( + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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 - deserialized = self._deserialize('ContactProfile', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - return deserialized - update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}"} # type: ignore + @distributed_trace def list_by_subscription( self, + skiptoken: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ContactProfileListResult"]: - """Returns list of contact profiles. - + """Returns list of contact profiles by Subscription. + + :param skiptoken: An opaque string that the resource provider uses to skip over + previously-returned results. This is used when a previous list operation call returned a + partial result. If a previous response contains a nextLink element, the value of the nextLink + element will include a skiptoken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :type skiptoken: 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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.ContactProfileListResult] + :return: An iterator like instance of either ContactProfileListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.orbital.models.ContactProfileListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfileListResult"] error_map = { 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, + api_version=api_version, + skiptoken=skiptoken, + 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, + api_version=api_version, + skiptoken=skiptoken, + 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) - return None, AsyncList(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -491,68 +597,85 @@ 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 + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, + skiptoken: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ContactProfileListResult"]: - """Returns list of contact profiles. + """Returns list of contact profiles by Resource Group. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str + :param skiptoken: An opaque string that the resource provider uses to skip over + previously-returned results. This is used when a previous list operation call returned a + partial result. If a previous response contains a nextLink element, the value of the nextLink + element will include a skiptoken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :type skiptoken: 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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.ContactProfileListResult] + :return: An iterator like instance of either ContactProfileListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.orbital.models.ContactProfileListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfileListResult"] error_map = { 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + skiptoken=skiptoken, + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + skiptoken=skiptoken, + 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) - return None, AsyncList(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -561,7 +684,8 @@ 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/contactProfiles'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles"} # type: ignore 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 a1afa1a058d3..9173348b99d1 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # 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 Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union 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]] @@ -28,7 +32,7 @@ class ContactsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_orbital.models + :type models: ~azure.mgmt.orbital.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -43,10 +47,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, spacecraft_name: str, + skiptoken: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ContactListResult"]: """Returns list of contacts by spacecraftName. @@ -55,55 +61,68 @@ def list( :type resource_group_name: str :param spacecraft_name: Spacecraft ID. :type spacecraft_name: str + :param skiptoken: An opaque string that the resource provider uses to skip over + previously-returned results. This is used when a previous list operation call returned a + partial result. If a previous response contains a nextLink element, the value of the nextLink + element will include a skiptoken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :type skiptoken: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContactListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.ContactListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.orbital.models.ContactListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactListResult"] error_map = { 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + skiptoken=skiptoken, + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + skiptoken=skiptoken, + 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) - return None, AsyncList(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,11 +131,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 + 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, @@ -134,7 +155,7 @@ async def get( :type contact_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Contact, or the result of cls(response) - :rtype: ~azure_orbital.models.Contact + :rtype: ~azure.mgmt.orbital.models.Contact :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Contact"] @@ -142,29 +163,26 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,7 +195,9 @@ 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 + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}"} # type: ignore + async def _create_initial( self, @@ -192,52 +212,54 @@ 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') - - # 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') - - 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) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Contact') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('Contact', pipeline_response) if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('Contact', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + _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, @@ -255,17 +277,22 @@ async def begin_create( :param contact_name: Contact Name. :type contact_name: str :param parameters: The parameters to provide for the created contact. - :type parameters: ~azure_orbital.models.Contact + :type parameters: ~azure.mgmt.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) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_orbital.models.Contact] - :raises ~azure.core.exceptions.HttpResponseError: + :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.mgmt.orbital.models.Contact] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Contact"] lro_delay = kwargs.pop( @@ -279,28 +306,22 @@ async def begin_create( spacecraft_name=spacecraft_name, contact_name=contact_name, parameters=parameters, + api_version=api_version, + 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: @@ -310,11 +331,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, spacecraft_name: str, @@ -326,41 +347,45 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}"} # type: ignore - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, spacecraft_name: str, @@ -377,14 +402,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 """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -397,25 +425,18 @@ async def begin_delete( resource_group_name=resource_group_name, spacecraft_name=spacecraft_name, contact_name=contact_name, + api_version=api_version, 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: @@ -425,6 +446,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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 127575a01ac8..b0feb2f882d4 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # 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 Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar 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.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]] @@ -26,7 +29,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_orbital.models + :type models: ~azure.mgmt.orbital.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,38 +53,39 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.OperationListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.orbital.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 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( + api_version=api_version, + 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( + api_version=api_version, + 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) @@ -89,7 +94,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,7 +107,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Orbital/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Orbital/operations"} # type: ignore diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations_results_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations_results_operations.py new file mode 100644 index 000000000000..de4138cad4d0 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations_results_operations.py @@ -0,0 +1,165 @@ +# pylint: disable=too-many-lines +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +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_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._operations_results_operations import build_get_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationsResultsOperations: + """OperationsResultsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.orbital.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _get_initial( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.OperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request_initial( + subscription_id=self._config.subscription_id, + location=location, + operation_id=operation_id, + api_version=api_version, + template_url=self._get_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('OperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/locations/{location}/operationResults/{operationId}"} # type: ignore + + + @distributed_trace_async + async def begin_get( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationResult"]: + """Returns operation results. + + :param location: The name of Azure region. + :type location: str + :param operation_id: The ID of an ongoing async operation. + :type operation_id: 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. + :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 OperationResult or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.orbital.models.OperationResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._get_initial( + location=location, + operation_id=operation_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/locations/{location}/operationResults/{operationId}"} # type: ignore 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 948fbef16746..9134f486ea2d 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +7,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union 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_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -29,7 +33,7 @@ class SpacecraftsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_orbital.models + :type models: ~azure.mgmt.orbital.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,59 +48,74 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, + skiptoken: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.SpacecraftListResult"]: """Return list of spacecrafts. + :param skiptoken: An opaque string that the resource provider uses to skip over + previously-returned results. This is used when a previous list operation call returned a + partial result. If a previous response contains a nextLink element, the value of the nextLink + element will include a skiptoken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :type skiptoken: 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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.SpacecraftListResult] + :return: An iterator like instance of either SpacecraftListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.orbital.models.SpacecraftListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SpacecraftListResult"] error_map = { 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, + api_version=api_version, + skiptoken=skiptoken, + 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, + api_version=api_version, + skiptoken=skiptoken, + 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) - return None, AsyncList(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,68 +124,85 @@ 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 + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/spacecrafts"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, + skiptoken: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_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 + :param skiptoken: An opaque string that the resource provider uses to skip over + previously-returned results. This is used when a previous list operation call returned a + partial result. If a previous response contains a nextLink element, the value of the nextLink + element will include a skiptoken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :type skiptoken: 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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.SpacecraftListResult] + :return: An iterator like instance of either SpacecraftListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.orbital.models.SpacecraftListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SpacecraftListResult"] error_map = { 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + skiptoken=skiptoken, + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + skiptoken=skiptoken, + 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) - return None, AsyncList(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -175,11 +211,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 + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts"} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -194,7 +232,7 @@ async def get( :type spacecraft_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Spacecraft, or the result of cls(response) - :rtype: ~azure_orbital.models.Spacecraft + :rtype: ~azure.mgmt.orbital.models.Spacecraft :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] @@ -202,28 +240,25 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -236,7 +271,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}"} # type: ignore + async def _create_or_update_initial( self, @@ -244,6 +281,7 @@ async def _create_or_update_initial( spacecraft_name: str, location: str, tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "_models.SpacecraftsPropertiesProvisioningState"]] = None, norad_id: Optional[str] = None, title_line: Optional[str] = None, tle_line1: Optional[str] = None, @@ -257,58 +295,60 @@ 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) - - # 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') - - 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) + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _parameters = _models.Spacecraft(tags=tags, location=location, provisioning_state=provisioning_state, 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('Spacecraft', pipeline_response) if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('Spacecraft', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + _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, spacecraft_name: str, location: str, tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "_models.SpacecraftsPropertiesProvisioningState"]] = None, norad_id: Optional[str] = None, title_line: Optional[str] = None, tle_line1: Optional[str] = None, @@ -324,28 +364,37 @@ async def begin_create_or_update( :type spacecraft_name: str :param location: The geo-location where the resource lives. :type location: str - :param tags: Resource tags. + :param tags: Resource tags. Default value is None. :type tags: dict[str, str] - :param norad_id: NORAD ID of the spacecraft. + :param provisioning_state: The current state of the resource's creation, deletion, or + modification. Default value is None. + :type provisioning_state: str or + ~azure.mgmt.orbital.models.SpacecraftsPropertiesProvisioningState + :param norad_id: NORAD ID of the spacecraft. Default value is None. :type norad_id: str - :param title_line: Title line of Two Line Element (TLE). + :param title_line: Title line of Two Line Element (TLE). Default value is None. :type title_line: str - :param tle_line1: Line 1 of Two Line Element (TLE). + :param tle_line1: Line 1 of Two Line Element (TLE). Default value is None. :type tle_line1: str - :param tle_line2: Line 2 of Two Line Element (TLE). + :param tle_line2: Line 2 of Two Line Element (TLE). Default value is None. :type tle_line2: str - :param links: Links of the Spacecraft. - :type links: list[~azure_orbital.models.SpacecraftLink] + :param links: Links of the Spacecraft. Default value is None. + :type links: list[~azure.mgmt.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) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_orbital.models.Spacecraft] - :raises ~azure.core.exceptions.HttpResponseError: + :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.mgmt.orbital.models.Spacecraft] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] lro_delay = kwargs.pop( @@ -359,32 +408,28 @@ async def begin_create_or_update( spacecraft_name=spacecraft_name, location=location, tags=tags, + provisioning_state=provisioning_state, norad_id=norad_id, title_line=title_line, tle_line1=tle_line1, tle_line2=tle_line2, links=links, + api_version=api_version, + 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: @@ -394,11 +439,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, spacecraft_name: str, @@ -409,40 +454,44 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, spacecraft_name: str, @@ -456,14 +505,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 """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -475,24 +527,18 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, spacecraft_name=spacecraft_name, + api_version=api_version, 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: @@ -502,17 +548,76 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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 - async def update_tags( + async def _update_tags_initial( self, resource_group_name: str, spacecraft_name: str, parameters: "_models.TagsObject", **kwargs: Any - ) -> "_models.Spacecraft": + ) -> Optional["_models.Spacecraft"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Spacecraft"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_tags_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('Spacecraft', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}"} # type: ignore + + + @distributed_trace_async + async def begin_update_tags( + self, + resource_group_name: str, + spacecraft_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> AsyncLROPoller["_models.Spacecraft"]: """Updates the specified spacecraft tags. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -520,126 +625,136 @@ async def update_tags( :param spacecraft_name: Spacecraft ID. :type spacecraft_name: str :param parameters: Parameters supplied to update spacecraft tags. - :type parameters: ~azure_orbital.models.TagsObject + :type parameters: ~azure.mgmt.orbital.models.TagsObject :keyword callable cls: A custom type or function that will be passed the direct response - :return: Spacecraft, or the result of cls(response) - :rtype: ~azure_orbital.models.Spacecraft + :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. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.orbital.models.Spacecraft] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] - 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.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') - - # 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') - - 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 + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_tags_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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 - deserialized = self._deserialize('Spacecraft', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - return deserialized - update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + begin_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, spacecraft_name: str, - contact_profile: "_models.ResourceReference", + contact_profile: "_models.ContactParametersContactProfile", 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"] + ) -> Optional["_models.AvailableContactsListResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AvailableContactsListResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _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) - - # 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') - - 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) + _json = self._serialize.body(_parameters, 'ContactParameters') + + request = build_list_available_contacts_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AvailableContactsListResult', pipeline_response) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('AvailableContactsListResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _list_available_contacts_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts'} # type: ignore + _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, spacecraft_name: str, - contact_profile: "_models.ResourceReference", + contact_profile: "_models.ContactParametersContactProfile", ground_station_name: str, start_time: datetime.datetime, end_time: datetime.datetime, **kwargs: Any - ) -> AsyncLROPoller["_models.AvailableContactsListResult"]: + ) -> AsyncLROPoller[AsyncItemPaged["_models.AvailableContactsListResult"]]: """Return list of available contacts. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -647,7 +762,7 @@ async def begin_list_available_contacts( :param spacecraft_name: Spacecraft ID. :type spacecraft_name: str :param contact_profile: The reference to the contact profile resource. - :type contact_profile: ~azure_orbital.models.ResourceReference + :type contact_profile: ~azure.mgmt.orbital.models.ContactParametersContactProfile :param ground_station_name: Name of Azure Ground Station. :type ground_station_name: str :param start_time: Start time of a contact. @@ -656,14 +771,86 @@ 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) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_orbital.models.AvailableContactsListResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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 an iterator like instance of either + AvailableContactsListResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.orbital.models.AvailableContactsListResult]] + :raises: ~azure.core.exceptions.HttpResponseError """ + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + _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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.begin_list_available_contacts.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + _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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + content_type=content_type, + json=_json, + 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("AvailableContactsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] lro_delay = kwargs.pop( @@ -679,27 +866,24 @@ async def begin_list_available_contacts( ground_station_name=ground_station_name, start_time=start_time, end_time=end_time, + api_version=api_version, + 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): - deserialized = self._deserialize('AvailableContactsListResult', pipeline_response) + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + return await get_next(next_link) - 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'), - } + return AsyncItemPaged( + internal_get_next, extract_data + ) - 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': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -709,6 +893,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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 76a686fe04dd..08f4154d151a 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,94 +6,99 @@ # 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 AuthorizedGroundstation +from ._models_py3 import AvailableContacts +from ._models_py3 import AvailableContactsListResult +from ._models_py3 import AvailableContactsProperties +from ._models_py3 import AvailableContactsSpacecraft +from ._models_py3 import AvailableGroundStation +from ._models_py3 import AvailableGroundStationListResult +from ._models_py3 import AvailableGroundStationProperties +from ._models_py3 import AvailableGroundStationPropertiesAutoGenerated +from ._models_py3 import CloudErrorBody +from ._models_py3 import Contact +from ._models_py3 import ContactInstanceProperties +from ._models_py3 import ContactListResult +from ._models_py3 import ContactParameters +from ._models_py3 import ContactParametersContactProfile +from ._models_py3 import ContactProfile +from ._models_py3 import ContactProfileLink +from ._models_py3 import ContactProfileLinkChannel +from ._models_py3 import ContactProfileListResult +from ._models_py3 import ContactProfileProperties +from ._models_py3 import ContactProfilesProperties +from ._models_py3 import ContactProfilesPropertiesNetworkConfiguration +from ._models_py3 import ContactsPropertiesAntennaConfiguration +from ._models_py3 import ContactsPropertiesContactProfile +from ._models_py3 import EndPoint +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationResult +from ._models_py3 import OperationResultErrorProperties +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, - AuthorizationStatus, + ApiVersionParameter, AutoTrackingConfiguration, Capability, + CapabilityParameter, + ContactProfilesPropertiesProvisioningState, + ContactsPropertiesProvisioningState, CreatedByType, Direction, - Enum6, Origin, Polarization, Protocol, + ProvisioningState, + ReleaseMode, + SpacecraftsPropertiesProvisioningState, Status, ) __all__ = [ + 'AuthorizedGroundstation', 'AvailableContacts', 'AvailableContactsListResult', + 'AvailableContactsProperties', + 'AvailableContactsSpacecraft', 'AvailableGroundStation', 'AvailableGroundStationListResult', + 'AvailableGroundStationProperties', + 'AvailableGroundStationPropertiesAutoGenerated', 'CloudErrorBody', 'Contact', + 'ContactInstanceProperties', 'ContactListResult', 'ContactParameters', + 'ContactParametersContactProfile', 'ContactProfile', 'ContactProfileLink', 'ContactProfileLinkChannel', 'ContactProfileListResult', + 'ContactProfileProperties', + 'ContactProfilesProperties', + 'ContactProfilesPropertiesNetworkConfiguration', + 'ContactsPropertiesAntennaConfiguration', + 'ContactsPropertiesContactProfile', 'EndPoint', 'Operation', 'OperationDisplay', 'OperationListResult', + 'OperationResult', + 'OperationResultErrorProperties', 'ProxyResource', 'Resource', 'ResourceIdListResult', @@ -106,14 +111,19 @@ 'TagsObject', 'TrackedResource', 'ActionType', - 'AuthorizationStatus', + 'ApiVersionParameter', 'AutoTrackingConfiguration', 'Capability', + 'CapabilityParameter', + 'ContactProfilesPropertiesProvisioningState', + 'ContactsPropertiesProvisioningState', 'CreatedByType', 'Direction', - 'Enum6', 'Origin', 'Polarization', 'Protocol', + 'ProvisioningState', + 'ReleaseMode', + 'SpacecraftsPropertiesProvisioningState', 'Status', ] 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 4d222f35a97e..5a815ba9326e 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,41 +6,24 @@ # 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)): - """Authorization status of spacecraft. - """ +class ApiVersionParameter(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - ALLOWED = "Allowed" - PENDING = "Pending" - DENIED = "Denied" + TWO_THOUSAND_TWENTY09_01_PREVIEW = "2020-09-01-preview" + TWO_THOUSAND_TWENTY_ONE04_04_PREVIEW = "2021-04-04-preview" + TWO_THOUSAND_TWENTY_TWO03_01 = "2022-03-01" -class AutoTrackingConfiguration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AutoTrackingConfiguration(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Auto track configuration. """ @@ -48,14 +31,41 @@ 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 CapabilityParameter(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + EARTH_OBSERVATION = "EarthObservation" + COMMUNICATION = "Communication" + +class ContactProfilesPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current state of the resource's creation, deletion, or modification + """ + + CREATING = "Creating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + UPDATING = "Updating" + DELETING = "Deleting" + +class ContactsPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current state of the resource's creation, deletion, or modification + """ + + CREATING = "Creating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + UPDATING = "Updating" + DELETING = "Deleting" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -64,19 +74,14 @@ 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)): - - 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,24 +90,52 @@ 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) """ RHCP = "RHCP" LHCP = "LHCP" - DUAL_RHCP_LHCP = "dualRhcpLhcp" 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 ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current state of the resource's creation, deletion, or modification + """ + + CREATING = "Creating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + UPDATING = "Updating" + DELETING = "Deleting" + +class ReleaseMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Release Status of a ground station + """ + + PREVIEW = "Preview" + GA = "GA" + +class SpacecraftsPropertiesProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current state of the resource's creation, deletion, or modification + """ + + CREATING = "Creating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + UPDATING = "Updating" + DELETING = "Deleting" + +class Status(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of a contact. """ @@ -111,3 +144,5 @@ class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "succeeded" FAILED = "failed" PROVIDER_CANCELLED = "providerCancelled" + CANCELED = "Canceled" + RUNNING = "Running" 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 925bc913ea43..000000000000 --- 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 52fff858cbb6..68b84e356ea5 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 @@ -7,20 +7,52 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union import msrest.serialization from ._azure_orbital_enums import * +class AuthorizedGroundstation(msrest.serialization.Model): + """Authorized groundstation. + + :ivar ground_station: Groundstation name. + :vartype ground_station: str + :ivar expiration_date: Date of authorization expiration. + :vartype expiration_date: ~datetime.date + """ + + _attribute_map = { + 'ground_station': {'key': 'groundStation', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'date'}, + } + + def __init__( + self, + *, + ground_station: Optional[str] = None, + expiration_date: Optional[datetime.date] = None, + **kwargs + ): + """ + :keyword ground_station: Groundstation name. + :paramtype ground_station: str + :keyword expiration_date: Date of authorization expiration. + :paramtype expiration_date: ~datetime.date + """ + super(AuthorizedGroundstation, self).__init__(**kwargs) + self.ground_station = ground_station + self.expiration_date = expiration_date + + 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 spacecraft: The reference to the spacecraft resource. + :vartype spacecraft: ~azure.mgmt.orbital.models.AvailableContactsSpacecraft :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 @@ -59,7 +91,7 @@ class AvailableContacts(msrest.serialization.Model): } _attribute_map = { - 'spacecraft': {'key': 'spacecraft', 'type': 'ResourceReference'}, + 'spacecraft': {'key': 'spacecraft', 'type': 'AvailableContactsSpacecraft'}, 'ground_station_name': {'key': 'groundStationName', 'type': 'str'}, 'maximum_elevation_degrees': {'key': 'properties.maximumElevationDegrees', 'type': 'float'}, 'tx_start_time': {'key': 'properties.txStartTime', 'type': 'iso-8601'}, @@ -75,9 +107,13 @@ class AvailableContacts(msrest.serialization.Model): def __init__( self, *, - spacecraft: Optional["ResourceReference"] = None, + spacecraft: Optional["AvailableContactsSpacecraft"] = None, **kwargs ): + """ + :keyword spacecraft: The reference to the spacecraft resource. + :paramtype spacecraft: ~azure.mgmt.orbital.models.AvailableContactsSpacecraft + """ super(AvailableContacts, self).__init__(**kwargs) self.spacecraft = spacecraft self.ground_station_name = None @@ -97,8 +133,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.mgmt.orbital.models.AvailableContacts] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -118,11 +154,193 @@ def __init__( value: Optional[List["AvailableContacts"]] = None, **kwargs ): + """ + :keyword value: A list of available contacts. + :paramtype value: list[~azure.mgmt.orbital.models.AvailableContacts] + """ super(AvailableContactsListResult, self).__init__(**kwargs) self.value = value self.next_link = None +class ContactInstanceProperties(msrest.serialization.Model): + """Contact Instance Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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 = { + '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 = { + 'maximum_elevation_degrees': {'key': 'maximumElevationDegrees', 'type': 'float'}, + 'tx_start_time': {'key': 'txStartTime', 'type': 'iso-8601'}, + 'tx_end_time': {'key': 'txEndTime', 'type': 'iso-8601'}, + 'rx_start_time': {'key': 'rxStartTime', 'type': 'iso-8601'}, + 'rx_end_time': {'key': 'rxEndTime', 'type': 'iso-8601'}, + 'start_azimuth_degrees': {'key': 'startAzimuthDegrees', 'type': 'float'}, + 'end_azimuth_degrees': {'key': 'endAzimuthDegrees', 'type': 'float'}, + 'start_elevation_degrees': {'key': 'startElevationDegrees', 'type': 'float'}, + 'end_elevation_degrees': {'key': 'endElevationDegrees', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ContactInstanceProperties, self).__init__(**kwargs) + 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 AvailableContactsProperties(ContactInstanceProperties): + """Properties of Contact resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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 = { + '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 = { + 'maximum_elevation_degrees': {'key': 'maximumElevationDegrees', 'type': 'float'}, + 'tx_start_time': {'key': 'txStartTime', 'type': 'iso-8601'}, + 'tx_end_time': {'key': 'txEndTime', 'type': 'iso-8601'}, + 'rx_start_time': {'key': 'rxStartTime', 'type': 'iso-8601'}, + 'rx_end_time': {'key': 'rxEndTime', 'type': 'iso-8601'}, + 'start_azimuth_degrees': {'key': 'startAzimuthDegrees', 'type': 'float'}, + 'end_azimuth_degrees': {'key': 'endAzimuthDegrees', 'type': 'float'}, + 'start_elevation_degrees': {'key': 'startElevationDegrees', 'type': 'float'}, + 'end_elevation_degrees': {'key': 'endElevationDegrees', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AvailableContactsProperties, self).__init__(**kwargs) + + +class ResourceReference(msrest.serialization.Model): + """Resource Reference. + + :ivar id: Resource ID. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super(ResourceReference, self).__init__(**kwargs) + self.id = id + + +class AvailableContactsSpacecraft(ResourceReference): + """The reference to the spacecraft resource. + + :ivar id: Resource ID. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super(AvailableContactsSpacecraft, self).__init__(id=id, **kwargs) + + class AvailableGroundStation(msrest.serialization.Model): """GroundStations available to schedule Contacts. @@ -132,20 +350,23 @@ 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 + :ivar release_mode: Release Status of a ground station. Possible values include: "Preview", + "GA". + :vartype release_mode: str or ~azure.mgmt.orbital.models.ReleaseMode """ _validation = { @@ -164,6 +385,7 @@ class AvailableGroundStation(msrest.serialization.Model): 'longitude_degrees': {'key': 'properties.longitudeDegrees', 'type': 'float'}, 'latitude_degrees': {'key': 'properties.latitudeDegrees', 'type': 'float'}, 'altitude_meters': {'key': 'properties.altitudeMeters', 'type': 'float'}, + 'release_mode': {'key': 'properties.releaseMode', 'type': 'str'}, } def __init__( @@ -175,8 +397,26 @@ def __init__( longitude_degrees: Optional[float] = None, latitude_degrees: Optional[float] = None, altitude_meters: Optional[float] = None, + release_mode: Optional[Union[str, "ReleaseMode"]] = 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 + :keyword release_mode: Release Status of a ground station. Possible values include: "Preview", + "GA". + :paramtype release_mode: str or ~azure.mgmt.orbital.models.ReleaseMode + """ super(AvailableGroundStation, self).__init__(**kwargs) self.id = None self.name = None @@ -187,6 +427,7 @@ def __init__( self.longitude_degrees = longitude_degrees self.latitude_degrees = latitude_degrees self.altitude_meters = altitude_meters + self.release_mode = release_mode class AvailableGroundStationListResult(msrest.serialization.Model): @@ -194,8 +435,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.mgmt.orbital.models.AvailableGroundStation] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -215,25 +456,147 @@ def __init__( value: Optional[List["AvailableGroundStation"]] = None, **kwargs ): + """ + :keyword value: A list of ground station resources. + :paramtype value: list[~azure.mgmt.orbital.models.AvailableGroundStation] + """ super(AvailableGroundStationListResult, self).__init__(**kwargs) self.value = value self.next_link = None +class AvailableGroundStationProperties(msrest.serialization.Model): + """Properties object for Available groundstation. + + :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 + :ivar release_mode: Release Status of a ground station. Possible values include: "Preview", + "GA". + :vartype release_mode: str or ~azure.mgmt.orbital.models.ReleaseMode + """ + + _attribute_map = { + 'city': {'key': 'city', 'type': 'str'}, + 'provider_name': {'key': 'providerName', 'type': 'str'}, + 'longitude_degrees': {'key': 'longitudeDegrees', 'type': 'float'}, + 'latitude_degrees': {'key': 'latitudeDegrees', 'type': 'float'}, + 'altitude_meters': {'key': 'altitudeMeters', 'type': 'float'}, + 'release_mode': {'key': 'releaseMode', 'type': 'str'}, + } + + def __init__( + self, + *, + city: Optional[str] = None, + provider_name: Optional[str] = None, + longitude_degrees: Optional[float] = None, + latitude_degrees: Optional[float] = None, + altitude_meters: Optional[float] = None, + release_mode: Optional[Union[str, "ReleaseMode"]] = None, + **kwargs + ): + """ + :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 + :keyword release_mode: Release Status of a ground station. Possible values include: "Preview", + "GA". + :paramtype release_mode: str or ~azure.mgmt.orbital.models.ReleaseMode + """ + super(AvailableGroundStationProperties, self).__init__(**kwargs) + self.city = city + self.provider_name = provider_name + self.longitude_degrees = longitude_degrees + self.latitude_degrees = latitude_degrees + self.altitude_meters = altitude_meters + self.release_mode = release_mode + + +class AvailableGroundStationPropertiesAutoGenerated(AvailableGroundStationProperties): + """The properties bag for this resource. + + :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 + :ivar release_mode: Release Status of a ground station. Possible values include: "Preview", + "GA". + :vartype release_mode: str or ~azure.mgmt.orbital.models.ReleaseMode + """ + + _attribute_map = { + 'city': {'key': 'city', 'type': 'str'}, + 'provider_name': {'key': 'providerName', 'type': 'str'}, + 'longitude_degrees': {'key': 'longitudeDegrees', 'type': 'float'}, + 'latitude_degrees': {'key': 'latitudeDegrees', 'type': 'float'}, + 'altitude_meters': {'key': 'altitudeMeters', 'type': 'float'}, + 'release_mode': {'key': 'releaseMode', 'type': 'str'}, + } + + def __init__( + self, + *, + city: Optional[str] = None, + provider_name: Optional[str] = None, + longitude_degrees: Optional[float] = None, + latitude_degrees: Optional[float] = None, + altitude_meters: Optional[float] = None, + release_mode: Optional[Union[str, "ReleaseMode"]] = None, + **kwargs + ): + """ + :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 + :keyword release_mode: Release Status of a ground station. Possible values include: "Preview", + "GA". + :paramtype release_mode: str or ~azure.mgmt.orbital.models.ReleaseMode + """ + super(AvailableGroundStationPropertiesAutoGenerated, self).__init__(city=city, provider_name=provider_name, longitude_degrees=longitude_degrees, latitude_degrees=latitude_degrees, altitude_meters=altitude_meters, release_mode=release_mode, **kwargs) + + 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.mgmt.orbital.models.CloudErrorBody] """ _attribute_map = { @@ -252,6 +615,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.mgmt.orbital.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -274,7 +650,7 @@ class Resource(msrest.serialization.Model): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure_orbital.models.SystemData + :vartype system_data: ~azure.mgmt.orbital.models.SystemData """ _validation = { @@ -295,6 +671,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -317,7 +695,7 @@ class ProxyResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure_orbital.models.SystemData + :vartype system_data: ~azure.mgmt.orbital.models.SystemData """ _validation = { @@ -338,6 +716,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -356,16 +736,21 @@ class Contact(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure_orbital.models.SystemData + :vartype system_data: ~azure.mgmt.orbital.models.SystemData :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str + :ivar provisioning_state: The current state of the resource's creation, deletion, or + modification. Possible values include: "Creating", "Succeeded", "Failed", "Canceled", + "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.orbital.models.ContactsPropertiesProvisioningState :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 + "succeeded", "failed", "providerCancelled", "Canceled", "Running". + :vartype status: str or ~azure.mgmt.orbital.models.Status + :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 +769,17 @@ 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 antenna_configuration: The configuration associated with the allocated antenna. + :vartype antenna_configuration: + ~azure.mgmt.orbital.models.ContactsPropertiesAntennaConfiguration + :ivar contact_profile: The reference to the contact profile resource. + :vartype contact_profile: ~azure.mgmt.orbital.models.ContactsPropertiesContactProfile """ _validation = { @@ -411,6 +799,7 @@ class Contact(ProxyResource): 'end_azimuth_degrees': {'readonly': True}, 'start_elevation_degrees': {'readonly': True}, 'end_elevation_degrees': {'readonly': True}, + 'antenna_configuration': {'readonly': True}, } _attribute_map = { @@ -419,6 +808,7 @@ class Contact(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', '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'}, @@ -433,20 +823,38 @@ class Contact(ProxyResource): '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'}, + 'antenna_configuration': {'key': 'properties.antennaConfiguration', 'type': 'ContactsPropertiesAntennaConfiguration'}, + 'contact_profile': {'key': 'properties.contactProfile', 'type': 'ContactsPropertiesContactProfile'}, } def __init__( self, *, + provisioning_state: Optional[Union[str, "ContactsPropertiesProvisioningState"]] = None, reservation_start_time: Optional[datetime.datetime] = None, reservation_end_time: Optional[datetime.datetime] = None, ground_station_name: Optional[str] = None, - contact_profile: Optional["ResourceReference"] = None, + contact_profile: Optional["ContactsPropertiesContactProfile"] = None, **kwargs ): + """ + :keyword provisioning_state: The current state of the resource's creation, deletion, or + modification. Possible values include: "Creating", "Succeeded", "Failed", "Canceled", + "Updating", "Deleting". + :paramtype provisioning_state: str or + ~azure.mgmt.orbital.models.ContactsPropertiesProvisioningState + :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.mgmt.orbital.models.ContactsPropertiesContactProfile + """ super(Contact, self).__init__(**kwargs) self.etag = None + self.provisioning_state = provisioning_state self.status = None self.reservation_start_time = reservation_start_time self.reservation_end_time = reservation_end_time @@ -461,6 +869,7 @@ def __init__( self.ground_station_name = ground_station_name self.start_elevation_degrees = None self.end_elevation_degrees = None + self.antenna_configuration = None self.contact_profile = contact_profile @@ -469,8 +878,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.mgmt.orbital.models.Contact] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -490,6 +899,10 @@ def __init__( value: Optional[List["Contact"]] = None, **kwargs ): + """ + :keyword value: A list of contact resources in a resource group. + :paramtype value: list[~azure.mgmt.orbital.models.Contact] + """ super(ContactListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -500,14 +913,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.mgmt.orbital.models.ContactParametersContactProfile + :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 = { @@ -518,7 +931,7 @@ class ContactParameters(msrest.serialization.Model): } _attribute_map = { - 'contact_profile': {'key': 'contactProfile', 'type': 'ResourceReference'}, + 'contact_profile': {'key': 'contactProfile', 'type': 'ContactParametersContactProfile'}, 'ground_station_name': {'key': 'groundStationName', 'type': 'str'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, @@ -527,12 +940,22 @@ class ContactParameters(msrest.serialization.Model): def __init__( self, *, - contact_profile: "ResourceReference", + contact_profile: "ContactParametersContactProfile", ground_station_name: str, start_time: datetime.datetime, end_time: datetime.datetime, **kwargs ): + """ + :keyword contact_profile: Required. The reference to the contact profile resource. + :paramtype contact_profile: ~azure.mgmt.orbital.models.ContactParametersContactProfile + :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 @@ -540,6 +963,30 @@ def __init__( self.end_time = end_time +class ContactParametersContactProfile(ResourceReference): + """The reference to the contact profile resource. + + :ivar id: Resource ID. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super(ContactParametersContactProfile, self).__init__(id=id, **kwargs) + + class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -557,11 +1004,11 @@ class TrackedResource(Resource): :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 + :vartype system_data: ~azure.mgmt.orbital.models.SystemData + :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 +1035,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 @@ -610,22 +1063,33 @@ class ContactProfile(TrackedResource): :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 + :vartype system_data: ~azure.mgmt.orbital.models.SystemData + :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 provisioning_state: The current state of the resource's creation, deletion, or + modification. Possible values include: "Creating", "Succeeded", "Failed", "Canceled", + "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.orbital.models.ContactProfilesPropertiesProvisioningState + :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.mgmt.orbital.models.AutoTrackingConfiguration + :ivar event_hub_uri: The URI of the Event Hub used for telemetry. + :vartype event_hub_uri: str + :ivar network_configuration: Network configuration of customer virtual network. + :vartype network_configuration: + ~azure.mgmt.orbital.models.ContactProfilesPropertiesNetworkConfiguration + :ivar links: Links of the Contact Profile. + :vartype links: list[~azure.mgmt.orbital.models.ContactProfileLink] """ _validation = { @@ -645,9 +1109,12 @@ class ContactProfile(TrackedResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', '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'}, + 'event_hub_uri': {'key': 'properties.eventHubUri', 'type': 'str'}, + 'network_configuration': {'key': 'properties.networkConfiguration', 'type': 'ContactProfilesPropertiesNetworkConfiguration'}, 'links': {'key': 'properties.links', 'type': '[ContactProfileLink]'}, } @@ -656,46 +1123,83 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "ContactProfilesPropertiesProvisioningState"]] = None, 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, + network_configuration: Optional["ContactProfilesPropertiesNetworkConfiguration"] = 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 provisioning_state: The current state of the resource's creation, deletion, or + modification. Possible values include: "Creating", "Succeeded", "Failed", "Canceled", + "Updating", "Deleting". + :paramtype provisioning_state: str or + ~azure.mgmt.orbital.models.ContactProfilesPropertiesProvisioningState + :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.mgmt.orbital.models.AutoTrackingConfiguration + :keyword event_hub_uri: The URI of the Event Hub used for telemetry. + :paramtype event_hub_uri: str + :keyword network_configuration: Network configuration of customer virtual network. + :paramtype network_configuration: + ~azure.mgmt.orbital.models.ContactProfilesPropertiesNetworkConfiguration + :keyword links: Links of the Contact Profile. + :paramtype links: list[~azure.mgmt.orbital.models.ContactProfileLink] + """ super(ContactProfile, self).__init__(tags=tags, location=location, **kwargs) self.etag = None + self.provisioning_state = provisioning_state 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.network_configuration = network_configuration self.links = links class ContactProfileLink(msrest.serialization.Model): - """Contact Profile link. + """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", + :ivar name: Required. Link name. + :vartype name: str + :ivar polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: "RHCP", + "LHCP", "linearVertical", "linearHorizontal". + :vartype polarization: str or ~azure.mgmt.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.mgmt.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.mgmt.orbital.models.ContactProfileLinkChannel] """ _validation = { + 'name': {'required': True}, 'polarization': {'required': True}, 'direction': {'required': True}, 'channels': {'required': True}, } _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, 'polarization': {'key': 'polarization', 'type': 'str'}, 'direction': {'key': 'direction', 'type': 'str'}, 'gain_over_temperature': {'key': 'gainOverTemperature', 'type': 'float'}, @@ -706,6 +1210,7 @@ class ContactProfileLink(msrest.serialization.Model): def __init__( self, *, + name: str, polarization: Union[str, "Polarization"], direction: Union[str, "Direction"], channels: List["ContactProfileLinkChannel"], @@ -713,7 +1218,24 @@ def __init__( eirpd_bw: Optional[float] = None, **kwargs ): + """ + :keyword name: Required. Link name. + :paramtype name: str + :keyword polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: + "RHCP", "LHCP", "linearVertical", "linearHorizontal". + :paramtype polarization: str or ~azure.mgmt.orbital.models.Polarization + :keyword direction: Required. Direction (uplink or downlink). Possible values include: + "uplink", "downlink". + :paramtype direction: str or ~azure.mgmt.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.mgmt.orbital.models.ContactProfileLinkChannel] + """ super(ContactProfileLink, self).__init__(**kwargs) + self.name = name self.polarization = polarization self.direction = direction self.gain_over_temperature = gain_over_temperature @@ -726,29 +1248,33 @@ 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 name: Required. Channel name. + :vartype name: 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.mgmt.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 = { + 'name': {'required': True}, 'center_frequency_m_hz': {'required': True}, 'bandwidth_m_hz': {'required': True}, 'end_point': {'required': True}, } _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, 'center_frequency_m_hz': {'key': 'centerFrequencyMHz', 'type': 'float'}, 'bandwidth_m_hz': {'key': 'bandwidthMHz', 'type': 'float'}, 'end_point': {'key': 'endPoint', 'type': 'EndPoint'}, @@ -761,6 +1287,7 @@ class ContactProfileLinkChannel(msrest.serialization.Model): def __init__( self, *, + name: str, center_frequency_m_hz: float, bandwidth_m_hz: float, end_point: "EndPoint", @@ -770,7 +1297,26 @@ def __init__( decoding_configuration: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. Channel name. + :paramtype name: str + :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.mgmt.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.name = name self.center_frequency_m_hz = center_frequency_m_hz self.bandwidth_m_hz = bandwidth_m_hz self.end_point = end_point @@ -785,8 +1331,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.mgmt.orbital.models.ContactProfile] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -806,24 +1352,284 @@ def __init__( value: Optional[List["ContactProfile"]] = None, **kwargs ): + """ + :keyword value: A list of contact profile resources in a resource group. + :paramtype value: list[~azure.mgmt.orbital.models.ContactProfile] + """ super(ContactProfileListResult, self).__init__(**kwargs) self.value = value self.next_link = None +class ContactProfilesProperties(msrest.serialization.Model): + """List of Contact Profile Resource Properties. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The current state of the resource's creation, deletion, or + modification. Possible values include: "Creating", "Succeeded", "Failed", "Canceled", + "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.orbital.models.ContactProfilesPropertiesProvisioningState + :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". + :vartype auto_tracking_configuration: str or + ~azure.mgmt.orbital.models.AutoTrackingConfiguration + :ivar event_hub_uri: The URI of the Event Hub used for telemetry. + :vartype event_hub_uri: str + :ivar network_configuration: Required. Network configuration of customer virtual network. + :vartype network_configuration: + ~azure.mgmt.orbital.models.ContactProfilesPropertiesNetworkConfiguration + :ivar links: Required. Links of the Contact Profile. + :vartype links: list[~azure.mgmt.orbital.models.ContactProfileLink] + """ + + _validation = { + 'network_configuration': {'required': True}, + 'links': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'minimum_viable_contact_duration': {'key': 'minimumViableContactDuration', 'type': 'str'}, + 'minimum_elevation_degrees': {'key': 'minimumElevationDegrees', 'type': 'float'}, + 'auto_tracking_configuration': {'key': 'autoTrackingConfiguration', 'type': 'str'}, + 'event_hub_uri': {'key': 'eventHubUri', 'type': 'str'}, + 'network_configuration': {'key': 'networkConfiguration', 'type': 'ContactProfilesPropertiesNetworkConfiguration'}, + 'links': {'key': 'links', 'type': '[ContactProfileLink]'}, + } + + def __init__( + self, + *, + network_configuration: "ContactProfilesPropertiesNetworkConfiguration", + links: List["ContactProfileLink"], + provisioning_state: Optional[Union[str, "ContactProfilesPropertiesProvisioningState"]] = None, + 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, + **kwargs + ): + """ + :keyword provisioning_state: The current state of the resource's creation, deletion, or + modification. Possible values include: "Creating", "Succeeded", "Failed", "Canceled", + "Updating", "Deleting". + :paramtype provisioning_state: str or + ~azure.mgmt.orbital.models.ContactProfilesPropertiesProvisioningState + :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.mgmt.orbital.models.AutoTrackingConfiguration + :keyword event_hub_uri: The URI of the Event Hub used for telemetry. + :paramtype event_hub_uri: str + :keyword network_configuration: Required. Network configuration of customer virtual network. + :paramtype network_configuration: + ~azure.mgmt.orbital.models.ContactProfilesPropertiesNetworkConfiguration + :keyword links: Required. Links of the Contact Profile. + :paramtype links: list[~azure.mgmt.orbital.models.ContactProfileLink] + """ + super(ContactProfilesProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + 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.network_configuration = network_configuration + self.links = links + + +class ContactProfileProperties(ContactProfilesProperties): + """Properties of the contact profile resource. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The current state of the resource's creation, deletion, or + modification. Possible values include: "Creating", "Succeeded", "Failed", "Canceled", + "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.orbital.models.ContactProfilesPropertiesProvisioningState + :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". + :vartype auto_tracking_configuration: str or + ~azure.mgmt.orbital.models.AutoTrackingConfiguration + :ivar event_hub_uri: The URI of the Event Hub used for telemetry. + :vartype event_hub_uri: str + :ivar network_configuration: Required. Network configuration of customer virtual network. + :vartype network_configuration: + ~azure.mgmt.orbital.models.ContactProfilesPropertiesNetworkConfiguration + :ivar links: Required. Links of the Contact Profile. + :vartype links: list[~azure.mgmt.orbital.models.ContactProfileLink] + """ + + _validation = { + 'network_configuration': {'required': True}, + 'links': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'minimum_viable_contact_duration': {'key': 'minimumViableContactDuration', 'type': 'str'}, + 'minimum_elevation_degrees': {'key': 'minimumElevationDegrees', 'type': 'float'}, + 'auto_tracking_configuration': {'key': 'autoTrackingConfiguration', 'type': 'str'}, + 'event_hub_uri': {'key': 'eventHubUri', 'type': 'str'}, + 'network_configuration': {'key': 'networkConfiguration', 'type': 'ContactProfilesPropertiesNetworkConfiguration'}, + 'links': {'key': 'links', 'type': '[ContactProfileLink]'}, + } + + def __init__( + self, + *, + network_configuration: "ContactProfilesPropertiesNetworkConfiguration", + links: List["ContactProfileLink"], + provisioning_state: Optional[Union[str, "ContactProfilesPropertiesProvisioningState"]] = None, + 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, + **kwargs + ): + """ + :keyword provisioning_state: The current state of the resource's creation, deletion, or + modification. Possible values include: "Creating", "Succeeded", "Failed", "Canceled", + "Updating", "Deleting". + :paramtype provisioning_state: str or + ~azure.mgmt.orbital.models.ContactProfilesPropertiesProvisioningState + :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.mgmt.orbital.models.AutoTrackingConfiguration + :keyword event_hub_uri: The URI of the Event Hub used for telemetry. + :paramtype event_hub_uri: str + :keyword network_configuration: Required. Network configuration of customer virtual network. + :paramtype network_configuration: + ~azure.mgmt.orbital.models.ContactProfilesPropertiesNetworkConfiguration + :keyword links: Required. Links of the Contact Profile. + :paramtype links: list[~azure.mgmt.orbital.models.ContactProfileLink] + """ + super(ContactProfileProperties, self).__init__(provisioning_state=provisioning_state, 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, network_configuration=network_configuration, links=links, **kwargs) + + +class ContactProfilesPropertiesNetworkConfiguration(msrest.serialization.Model): + """Network configuration of customer virtual network. + + All required parameters must be populated in order to send to Azure. + + :ivar subnet_id: Required. Customer subnet ARM resource identifier. + :vartype subnet_id: str + """ + + _validation = { + 'subnet_id': {'required': True}, + } + + _attribute_map = { + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + } + + def __init__( + self, + *, + subnet_id: str, + **kwargs + ): + """ + :keyword subnet_id: Required. Customer subnet ARM resource identifier. + :paramtype subnet_id: str + """ + super(ContactProfilesPropertiesNetworkConfiguration, self).__init__(**kwargs) + self.subnet_id = subnet_id + + +class ContactsPropertiesAntennaConfiguration(msrest.serialization.Model): + """The configuration associated with the allocated antenna. + + :ivar destination_ip: The destination IP a packet can be sent to. This would for example be the + TCP endpoint you would send data to. + :vartype destination_ip: str + :ivar source_ips: List of Source IP. + :vartype source_ips: list[str] + """ + + _attribute_map = { + 'destination_ip': {'key': 'destinationIp', 'type': 'str'}, + 'source_ips': {'key': 'sourceIps', 'type': '[str]'}, + } + + def __init__( + self, + *, + destination_ip: Optional[str] = None, + source_ips: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword destination_ip: The destination IP a packet can be sent to. This would for example be + the TCP endpoint you would send data to. + :paramtype destination_ip: str + :keyword source_ips: List of Source IP. + :paramtype source_ips: list[str] + """ + super(ContactsPropertiesAntennaConfiguration, self).__init__(**kwargs) + self.destination_ip = destination_ip + self.source_ips = source_ips + + +class ContactsPropertiesContactProfile(ResourceReference): + """The reference to the contact profile resource. + + :ivar id: Resource ID. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super(ContactsPropertiesContactProfile, self).__init__(id=id, **kwargs) + + 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 + :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.mgmt.orbital.models.Protocol """ _validation = { @@ -849,6 +1655,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.mgmt.orbital.models.Protocol + """ super(EndPoint, self).__init__(**kwargs) self.ip_address = ip_address self.end_point_name = end_point_name @@ -867,15 +1683,15 @@ 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.mgmt.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 + :vartype origin: str or ~azure.mgmt.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 + :vartype action_type: str or ~azure.mgmt.orbital.models.ActionType """ _validation = { @@ -899,6 +1715,10 @@ def __init__( display: Optional["OperationDisplay"] = None, **kwargs ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.orbital.models.OperationDisplay + """ super(Operation, self).__init__(**kwargs) self.name = None self.is_data_action = None @@ -944,6 +1764,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -957,7 +1779,7 @@ class OperationListResult(msrest.serialization.Model): 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] + :vartype value: list[~azure.mgmt.orbital.models.Operation] :ivar next_link: URL to get the next set of operation list results (if there are any). :vartype next_link: str """ @@ -976,18 +1798,123 @@ def __init__( self, **kwargs ): + """ + """ super(OperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None +class OperationResult(msrest.serialization.Model): + """Operation Result Entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ID of the resource. + :vartype id: str + :ivar name: Name of the resource. + :vartype name: str + :ivar status: Status of a contact. Possible values include: "scheduled", "cancelled", + "succeeded", "failed", "providerCancelled", "Canceled", "Running". + :vartype status: str or ~azure.mgmt.orbital.models.Status + :ivar start_time: The operation start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: The operation end time. + :vartype end_time: ~datetime.datetime + :ivar percent_complete: Percentage completed. + :vartype percent_complete: float + :ivar properties: Any object. + :vartype properties: any + :ivar error: Operation result error properties. + :vartype error: ~azure.mgmt.orbital.models.OperationResultErrorProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + 'percent_complete': {'readonly': True, 'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'OperationResultErrorProperties'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "Status"]] = None, + properties: Optional[Any] = None, + error: Optional["OperationResultErrorProperties"] = None, + **kwargs + ): + """ + :keyword status: Status of a contact. Possible values include: "scheduled", "cancelled", + "succeeded", "failed", "providerCancelled", "Canceled", "Running". + :paramtype status: str or ~azure.mgmt.orbital.models.Status + :keyword properties: Any object. + :paramtype properties: any + :keyword error: Operation result error properties. + :paramtype error: ~azure.mgmt.orbital.models.OperationResultErrorProperties + """ + super(OperationResult, self).__init__(**kwargs) + self.id = None + self.name = None + self.status = status + self.start_time = None + self.end_time = None + self.percent_complete = None + self.properties = properties + self.error = error + + +class OperationResultErrorProperties(msrest.serialization.Model): + """Operation result error properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The code of the error. + :vartype code: str + :ivar message: The error message. + :vartype message: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationResultErrorProperties, self).__init__(**kwargs) + self.code = None + self.message = 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 value: A list of Azure Resource IDs. + :vartype value: list[~azure.mgmt.orbital.models.ResourceIdListResultValueItem] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -1007,6 +1934,10 @@ def __init__( value: Optional[List["ResourceIdListResultValueItem"]] = None, **kwargs ): + """ + :keyword value: A list of Azure Resource IDs. + :paramtype value: list[~azure.mgmt.orbital.models.ResourceIdListResultValueItem] + """ super(ResourceIdListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1015,8 +1946,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,31 +1960,14 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The Azure Resource ID. + :paramtype id: str + """ super(ResourceIdListResultValueItem, self).__init__(**kwargs) self.id = id -class ResourceReference(msrest.serialization.Model): - """Resource Reference. - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - super(ResourceReference, self).__init__(**kwargs) - self.id = id - - class Spacecraft(TrackedResource): """Customer creates a spacecraft resource to schedule a contact. @@ -1071,28 +1985,28 @@ class Spacecraft(TrackedResource): :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 + :vartype system_data: ~azure.mgmt.orbital.models.SystemData + :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 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 provisioning_state: The current state of the resource's creation, deletion, or + modification. Possible values include: "Creating", "Succeeded", "Failed", "Canceled", + "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.orbital.models.SpacecraftsPropertiesProvisioningState + :ivar norad_id: NORAD ID of the spacecraft. + :vartype norad_id: str + :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.mgmt.orbital.models.SpacecraftLink] """ _validation = { @@ -1102,8 +2016,6 @@ class Spacecraft(TrackedResource): 'system_data': {'readonly': True}, 'location': {'required': True}, 'etag': {'readonly': True}, - 'authorization_status': {'readonly': True}, - 'authorization_status_extended': {'readonly': True}, } _attribute_map = { @@ -1114,9 +2026,8 @@ class Spacecraft(TrackedResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', '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'}, @@ -1128,6 +2039,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "SpacecraftsPropertiesProvisioningState"]] = None, norad_id: Optional[str] = None, title_line: Optional[str] = None, tle_line1: Optional[str] = None, @@ -1135,11 +2047,31 @@ 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 provisioning_state: The current state of the resource's creation, deletion, or + modification. Possible values include: "Creating", "Succeeded", "Failed", "Canceled", + "Updating", "Deleting". + :paramtype provisioning_state: str or + ~azure.mgmt.orbital.models.SpacecraftsPropertiesProvisioningState + :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.mgmt.orbital.models.SpacecraftLink] + """ super(Spacecraft, self).__init__(tags=tags, location=location, **kwargs) self.etag = None + self.provisioning_state = provisioning_state self.norad_id = norad_id - self.authorization_status = None - self.authorization_status_extended = None self.title_line = title_line self.tle_line1 = tle_line1 self.tle_line2 = tle_line2 @@ -1147,50 +2079,77 @@ def __init__( class SpacecraftLink(msrest.serialization.Model): - """Spacecraft Link. + """Authorized Ground Stations for the link. + + 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. - :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 name: Required. Link name. + :vartype name: 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 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 + :vartype direction: str or ~azure.mgmt.orbital.models.Direction + :ivar polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: "RHCP", + "LHCP", "linearVertical", "linearHorizontal". + :vartype polarization: str or ~azure.mgmt.orbital.models.Polarization + :ivar authorizations: Authorized Ground Stations. + :vartype authorizations: list[~azure.mgmt.orbital.models.AuthorizedGroundstation] """ _validation = { + 'name': {'required': True}, 'center_frequency_m_hz': {'required': True}, 'bandwidth_m_hz': {'required': True}, 'direction': {'required': True}, 'polarization': {'required': True}, + 'authorizations': {'readonly': True}, } _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, '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'}, + 'authorizations': {'key': 'authorizations', 'type': '[AuthorizedGroundstation]'}, } def __init__( self, *, + name: str, center_frequency_m_hz: float, bandwidth_m_hz: float, direction: Union[str, "Direction"], polarization: Union[str, "Polarization"], **kwargs ): + """ + :keyword name: Required. Link name. + :paramtype name: str + :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.mgmt.orbital.models.Direction + :keyword polarization: Required. polarization. eg (RHCP, LHCP). Possible values include: + "RHCP", "LHCP", "linearVertical", "linearHorizontal". + :paramtype polarization: str or ~azure.mgmt.orbital.models.Polarization + """ super(SpacecraftLink, self).__init__(**kwargs) + self.name = name self.center_frequency_m_hz = center_frequency_m_hz self.bandwidth_m_hz = bandwidth_m_hz self.direction = direction self.polarization = polarization + self.authorizations = None class SpacecraftListResult(msrest.serialization.Model): @@ -1198,8 +2157,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.mgmt.orbital.models.Spacecraft] :ivar next_link: The URL to get the next set of results. :vartype next_link: str """ @@ -1219,6 +2178,10 @@ def __init__( value: Optional[List["Spacecraft"]] = None, **kwargs ): + """ + :keyword value: A list of spacecraft resources in a resource group. + :paramtype value: list[~azure.mgmt.orbital.models.Spacecraft] + """ super(SpacecraftListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1227,20 +2190,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.mgmt.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.mgmt.orbital.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1263,6 +2226,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.mgmt.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.mgmt.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 +2254,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 +2268,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/__init__.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/__init__.py index 332d78334cb4..97de231640d7 100644 --- a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/__init__.py +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/__init__.py @@ -11,6 +11,7 @@ from ._contacts_operations import ContactsOperations from ._contact_profiles_operations import ContactProfilesOperations from ._available_ground_stations_operations import AvailableGroundStationsOperations +from ._operations_results_operations import OperationsResultsOperations __all__ = [ 'Operations', @@ -18,4 +19,5 @@ 'ContactsOperations', 'ContactProfilesOperations', 'AvailableGroundStationsOperations', + 'OperationsResultsOperations', ] 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 dc2e9627b098..8123e2d9f5f6 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,93 @@ # 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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer 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 .. 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.CapabilityParameter"] = "EarthObservation", + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName}") # pylint: disable=line-too-long + 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. @@ -30,7 +101,7 @@ class AvailableGroundStationsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_orbital.models + :type models: ~azure.mgmt.orbital.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,55 +116,57 @@ 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.CapabilityParameter"] = "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 + :param capability: Ground Station Capability. Default value is "EarthObservation". + :type capability: str or ~azure.mgmt.orbital.models.CapabilityParameter :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.paging.ItemPaged[~azure_orbital.models.AvailableGroundStationListResult] + :return: An iterator like instance of either AvailableGroundStationListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.orbital.models.AvailableGroundStationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableGroundStationListResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -102,7 +175,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,24 +188,25 @@ 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 + 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. :type ground_station_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AvailableGroundStation, or the result of cls(response) - :rtype: ~azure_orbital.models.AvailableGroundStation + :rtype: ~azure.mgmt.orbital.models.AvailableGroundStation :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableGroundStation"] @@ -136,27 +214,24 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -169,4 +244,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName}'} # type: ignore + + 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 13e331bcb011..3a3d01675654 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,261 @@ # 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 warnings +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer 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 .. 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( + resource_group_name: str, + subscription_id: str, + contact_profile_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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( + resource_group_name: str, + subscription_id: str, + contact_profile_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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( + resource_group_name: str, + subscription_id: str, + contact_profile_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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_initial( + resource_group_name: str, + subscription_id: str, + contact_profile_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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, + *, + skiptoken: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + 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') + if skiptoken is not None: + _query_parameters['$skiptoken'] = _SERIALIZER.query("skiptoken", skiptoken, '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( + resource_group_name: str, + subscription_id: str, + *, + skiptoken: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "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') + if skiptoken is not None: + _query_parameters['$skiptoken'] = _SERIALIZER.query("skiptoken", skiptoken, '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. @@ -32,7 +269,7 @@ class ContactProfilesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_orbital.models + :type models: ~azure.mgmt.orbital.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -47,13 +284,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. @@ -62,7 +299,7 @@ def get( :type contact_profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ContactProfile, or the result of cls(response) - :rtype: ~azure_orbital.models.ContactProfile + :rtype: ~azure.mgmt.orbital.models.ContactProfile :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] @@ -70,28 +307,25 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + contact_profile_name=contact_profile_name, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,86 +338,93 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + 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, + provisioning_state: Optional[Union[str, "_models.ContactProfilesPropertiesProvisioningState"]] = 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, + network_configuration: Optional["_models.ContactProfilesPropertiesNetworkConfiguration"] = 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) - - # 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') - - 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) + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _parameters = _models.ContactProfile(tags=tags, location=location, provisioning_state=provisioning_state, 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, network_configuration=network_configuration, links=links) + _json = self._serialize.body(_parameters, 'ContactProfile') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + contact_profile_name=contact_profile_name, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('ContactProfile', pipeline_response) if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('ContactProfile', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + _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, + provisioning_state: Optional[Union[str, "_models.ContactProfilesPropertiesProvisioningState"]] = 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, + network_configuration: Optional["_models.ContactProfilesPropertiesNetworkConfiguration"] = 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. @@ -192,26 +433,43 @@ def begin_create_or_update( :type contact_profile_name: str :param location: The geo-location where the resource lives. :type location: str - :param tags: Resource tags. + :param tags: Resource tags. Default value is None. :type tags: dict[str, str] + :param provisioning_state: The current state of the resource's creation, deletion, or + modification. Default value is None. + :type provisioning_state: str or + ~azure.mgmt.orbital.models.ContactProfilesPropertiesProvisioningState :param minimum_viable_contact_duration: Minimum viable contact duration in ISO 8601 format. + Default value is None. :type minimum_viable_contact_duration: str :param minimum_elevation_degrees: Minimum viable elevation for the contact in decimal degrees. + Default value is None. :type minimum_elevation_degrees: float - :param auto_tracking_configuration: Auto track configuration. - :type auto_tracking_configuration: str or ~azure_orbital.models.AutoTrackingConfiguration - :param links: Links of the Contact Profile. - :type links: list[~azure_orbital.models.ContactProfileLink] + :param auto_tracking_configuration: Auto track configuration. Default value is None. + :type auto_tracking_configuration: str or ~azure.mgmt.orbital.models.AutoTrackingConfiguration + :param event_hub_uri: The URI of the Event Hub used for telemetry. Default value is None. + :type event_hub_uri: str + :param network_configuration: Network configuration of customer virtual network. Default value + is None. + :type network_configuration: + ~azure.mgmt.orbital.models.ContactProfilesPropertiesNetworkConfiguration + :param links: Links of the Contact Profile. Default value is None. + :type links: list[~azure.mgmt.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) - :rtype: ~azure.core.polling.LROPoller[~azure_orbital.models.ContactProfile] - :raises ~azure.core.exceptions.HttpResponseError: + :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.mgmt.orbital.models.ContactProfile] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] lro_delay = kwargs.pop( @@ -225,31 +483,29 @@ def begin_create_or_update( contact_profile_name=contact_profile_name, location=location, tags=tags, + provisioning_state=provisioning_state, 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, + network_configuration=network_configuration, links=links, + api_version=api_version, + 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: @@ -259,62 +515,64 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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( + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + contact_profile_name=contact_profile_name, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +581,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 """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -342,24 +603,18 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, contact_profile_name=contact_profile_name, + api_version=api_version, 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: @@ -369,18 +624,76 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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 - def update_tags( + def _update_tags_initial( 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 + ) -> Optional["_models.ContactProfile"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ContactProfile"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + contact_profile_name=contact_profile_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_tags_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('ContactProfile', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}"} # type: ignore + + + @distributed_trace + def begin_update_tags( + self, + resource_group_name: str, + contact_profile_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> LROPoller["_models.ContactProfile"]: """Updates the specified contact profile tags. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -388,112 +701,130 @@ def update_tags( :param contact_profile_name: Contact Profile Name. :type contact_profile_name: str :param parameters: Parameters supplied to update contact profile tags. - :type parameters: ~azure_orbital.models.TagsObject + :type parameters: ~azure.mgmt.orbital.models.TagsObject :keyword callable cls: A custom type or function that will be passed the direct response - :return: ContactProfile, or the result of cls(response) - :rtype: ~azure_orbital.models.ContactProfile + :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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.orbital.models.ContactProfile] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] - 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.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') - - # 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') - - 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 + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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 - deserialized = self._deserialize('ContactProfile', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + 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: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - return deserialized - update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + begin_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"] - """Returns list of contact profiles. - + skiptoken: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ContactProfileListResult"]: + """Returns list of contact profiles by Subscription. + + :param skiptoken: An opaque string that the resource provider uses to skip over + previously-returned results. This is used when a previous list operation call returned a + partial result. If a previous response contains a nextLink element, the value of the nextLink + element will include a skiptoken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :type skiptoken: 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) - :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.ContactProfileListResult] + :return: An iterator like instance of either ContactProfileListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.orbital.models.ContactProfileListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfileListResult"] error_map = { 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, + api_version=api_version, + skiptoken=skiptoken, + 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, + api_version=api_version, + skiptoken=skiptoken, + 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) - return None, iter(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -502,69 +833,84 @@ 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 + 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"] - """Returns list of contact profiles. + resource_group_name: str, + skiptoken: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ContactProfileListResult"]: + """Returns list of contact profiles by Resource Group. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str + :param skiptoken: An opaque string that the resource provider uses to skip over + previously-returned results. This is used when a previous list operation call returned a + partial result. If a previous response contains a nextLink element, the value of the nextLink + element will include a skiptoken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :type skiptoken: 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) - :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.ContactProfileListResult] + :return: An iterator like instance of either ContactProfileListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.orbital.models.ContactProfileListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfileListResult"] error_map = { 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + skiptoken=skiptoken, + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + skiptoken=skiptoken, + 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) - return None, iter(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -573,7 +919,8 @@ 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/contactProfiles'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles"} # type: ignore 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 46b06fd0e05b..446fb44a5999 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,189 @@ # 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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer 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 .. 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( + resource_group_name: str, + subscription_id: str, + spacecraft_name: str, + *, + skiptoken: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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') + if skiptoken is not None: + _query_parameters['$skiptoken'] = _SERIALIZER.query("skiptoken", skiptoken, '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( + resource_group_name: str, + subscription_id: str, + spacecraft_name: str, + contact_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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( + resource_group_name: str, + subscription_id: str, + spacecraft_name: str, + contact_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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( + resource_group_name: str, + subscription_id: str, + spacecraft_name: str, + contact_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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. @@ -32,7 +197,7 @@ class ContactsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_orbital.models + :type models: ~azure.mgmt.orbital.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -47,68 +212,82 @@ 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, + skiptoken: Optional[str] = None, + **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. :type resource_group_name: str :param spacecraft_name: Spacecraft ID. :type spacecraft_name: str + :param skiptoken: An opaque string that the resource provider uses to skip over + previously-returned results. This is used when a previous list operation call returned a + partial result. If a previous response contains a nextLink element, the value of the nextLink + element will include a skiptoken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :type skiptoken: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContactListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.ContactListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.orbital.models.ContactListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactListResult"] error_map = { 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + skiptoken=skiptoken, + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + skiptoken=skiptoken, + 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) - return None, iter(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,19 +296,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 + 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. @@ -140,7 +320,7 @@ def get( :type contact_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Contact, or the result of cls(response) - :rtype: ~azure_orbital.models.Contact + :rtype: ~azure.mgmt.orbital.models.Contact :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Contact"] @@ -148,29 +328,26 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -183,77 +360,79 @@ 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 + + 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') - - # 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') - - 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) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Contact') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('Contact', pipeline_response) if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('Contact', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + _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. @@ -263,17 +442,21 @@ def begin_create( :param contact_name: Contact Name. :type contact_name: str :param parameters: The parameters to provide for the created contact. - :type parameters: ~azure_orbital.models.Contact + :type parameters: ~azure.mgmt.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: + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.orbital.models.Contact] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Contact"] lro_delay = kwargs.pop( @@ -287,28 +470,22 @@ def begin_create( spacecraft_name=spacecraft_name, contact_name=contact_name, parameters=parameters, + api_version=api_version, + 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: @@ -318,65 +495,67 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +566,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 """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -407,25 +589,18 @@ def begin_delete( resource_group_name=resource_group_name, spacecraft_name=spacecraft_name, contact_name=contact_name, + api_version=api_version, 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: @@ -435,6 +610,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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 e2b44b516e23..8cf88249e12c 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer 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 .. 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + 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. @@ -30,7 +58,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_orbital.models + :type models: ~azure.mgmt.orbital.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,47 +73,48 @@ 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 :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.orbital.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 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( + api_version=api_version, + 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( + api_version=api_version, + 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) @@ -94,7 +123,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +136,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Orbital/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Orbital/operations"} # type: ignore diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations_results_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations_results_operations.py new file mode 100644 index 000000000000..52954159ec32 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations_results_operations.py @@ -0,0 +1,204 @@ +# pylint: disable=too-many-lines +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +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 .. import models as _models +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_get_request_initial( + subscription_id: str, + location: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/locations/{location}/operationResults/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "operationId": _SERIALIZER.url("operation_id", operation_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 + ) + +class OperationsResultsOperations(object): + """OperationsResultsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.orbital.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _get_initial( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.OperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request_initial( + subscription_id=self._config.subscription_id, + location=location, + operation_id=operation_id, + api_version=api_version, + template_url=self._get_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('OperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/locations/{location}/operationResults/{operationId}"} # type: ignore + + + @distributed_trace + def begin_get( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationResult"]: + """Returns operation results. + + :param location: The name of Azure region. + :type location: str + :param operation_id: The ID of an ongoing async operation. + :type operation_id: 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. + :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 OperationResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.orbital.models.OperationResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._get_initial( + location=location, + operation_id=operation_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OperationResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/locations/{location}/operationResults/{operationId}"} # type: ignore 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 148664d9ff61..012dda6a0948 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,25 +7,305 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer 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 .. 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, + *, + skiptoken: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + 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') + if skiptoken is not None: + _query_parameters['$skiptoken'] = _SERIALIZER.query("skiptoken", skiptoken, '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( + resource_group_name: str, + subscription_id: str, + *, + skiptoken: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "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') + if skiptoken is not None: + _query_parameters['$skiptoken'] = _SERIALIZER.query("skiptoken", skiptoken, '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( + resource_group_name: str, + subscription_id: str, + spacecraft_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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( + resource_group_name: str, + subscription_id: str, + spacecraft_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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( + resource_group_name: str, + subscription_id: str, + spacecraft_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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_initial( + resource_group_name: str, + subscription_id: str, + spacecraft_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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( + resource_group_name: str, + subscription_id: str, + spacecraft_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', 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. @@ -33,7 +314,7 @@ class SpacecraftsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_orbital.models + :type models: ~azure.mgmt.orbital.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -48,60 +329,73 @@ 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"] + skiptoken: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SpacecraftListResult"]: """Return list of spacecrafts. + :param skiptoken: An opaque string that the resource provider uses to skip over + previously-returned results. This is used when a previous list operation call returned a + partial result. If a previous response contains a nextLink element, the value of the nextLink + element will include a skiptoken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :type skiptoken: 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) - :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.SpacecraftListResult] + :return: An iterator like instance of either SpacecraftListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.orbital.models.SpacecraftListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SpacecraftListResult"] error_map = { 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, + api_version=api_version, + skiptoken=skiptoken, + 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, + api_version=api_version, + skiptoken=skiptoken, + 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) - return None, iter(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,69 +404,84 @@ 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 + 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, + skiptoken: Optional[str] = None, + **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 + :param skiptoken: An opaque string that the resource provider uses to skip over + previously-returned results. This is used when a previous list operation call returned a + partial result. If a previous response contains a nextLink element, the value of the nextLink + element will include a skiptoken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :type skiptoken: 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) - :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.SpacecraftListResult] + :return: An iterator like instance of either SpacecraftListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.orbital.models.SpacecraftListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SpacecraftListResult"] error_map = { 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + skiptoken=skiptoken, + 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + skiptoken=skiptoken, + 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) - return None, iter(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -181,18 +490,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 + 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. @@ -201,7 +511,7 @@ def get( :type spacecraft_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Spacecraft, or the result of cls(response) - :rtype: ~azure_orbital.models.Spacecraft + :rtype: ~azure.mgmt.orbital.models.Spacecraft :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] @@ -209,28 +519,25 @@ 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -243,88 +550,91 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + 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, + provisioning_state: Optional[Union[str, "_models.SpacecraftsPropertiesProvisioningState"]] = 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') - - # 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') - - 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) + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _parameters = _models.Spacecraft(tags=tags, location=location, provisioning_state=provisioning_state, 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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('Spacecraft', pipeline_response) if response.status_code == 201: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('Spacecraft', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + _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, + provisioning_state: Optional[Union[str, "_models.SpacecraftsPropertiesProvisioningState"]] = 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. @@ -333,28 +643,36 @@ def begin_create_or_update( :type spacecraft_name: str :param location: The geo-location where the resource lives. :type location: str - :param tags: Resource tags. + :param tags: Resource tags. Default value is None. :type tags: dict[str, str] - :param norad_id: NORAD ID of the spacecraft. + :param provisioning_state: The current state of the resource's creation, deletion, or + modification. Default value is None. + :type provisioning_state: str or + ~azure.mgmt.orbital.models.SpacecraftsPropertiesProvisioningState + :param norad_id: NORAD ID of the spacecraft. Default value is None. :type norad_id: str - :param title_line: Title line of Two Line Element (TLE). + :param title_line: Title line of Two Line Element (TLE). Default value is None. :type title_line: str - :param tle_line1: Line 1 of Two Line Element (TLE). + :param tle_line1: Line 1 of Two Line Element (TLE). Default value is None. :type tle_line1: str - :param tle_line2: Line 2 of Two Line Element (TLE). + :param tle_line2: Line 2 of Two Line Element (TLE). Default value is None. :type tle_line2: str - :param links: Links of the Spacecraft. - :type links: list[~azure_orbital.models.SpacecraftLink] + :param links: Links of the Spacecraft. Default value is None. + :type links: list[~azure.mgmt.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: + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.orbital.models.Spacecraft] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] lro_delay = kwargs.pop( @@ -368,32 +686,28 @@ def begin_create_or_update( spacecraft_name=spacecraft_name, location=location, tags=tags, + provisioning_state=provisioning_state, norad_id=norad_id, title_line=title_line, tle_line1=tle_line1, tle_line2=tle_line2, links=links, + api_version=api_version, + 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: @@ -403,62 +717,64 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2022-03-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}"} # type: ignore - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +783,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 """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -486,24 +805,18 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, spacecraft_name=spacecraft_name, + api_version=api_version, 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: @@ -513,18 +826,76 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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 - def update_tags( + def _update_tags_initial( 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 + ) -> Optional["_models.Spacecraft"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Spacecraft"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_tags_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('Spacecraft', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}"} # type: ignore + + + @distributed_trace + def begin_update_tags( + self, + resource_group_name: str, + spacecraft_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> LROPoller["_models.Spacecraft"]: """Updates the specified spacecraft tags. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -532,128 +903,135 @@ def update_tags( :param spacecraft_name: Spacecraft ID. :type spacecraft_name: str :param parameters: Parameters supplied to update spacecraft tags. - :type parameters: ~azure_orbital.models.TagsObject + :type parameters: ~azure.mgmt.orbital.models.TagsObject :keyword callable cls: A custom type or function that will be passed the direct response - :return: Spacecraft, or the result of cls(response) - :rtype: ~azure_orbital.models.Spacecraft + :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. + :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 Spacecraft or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.orbital.models.Spacecraft] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] - 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.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') - - # 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') - - 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 + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_tags_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + 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 - deserialized = self._deserialize('Spacecraft', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + 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: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - return deserialized - update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + begin_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" - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] + resource_group_name: str, + spacecraft_name: str, + contact_profile: "_models.ContactParametersContactProfile", + ground_station_name: str, + start_time: datetime.datetime, + end_time: datetime.datetime, + **kwargs: Any + ) -> Optional["_models.AvailableContactsListResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AvailableContactsListResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _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) - - # 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') - - 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) + _json = self._serialize.body(_parameters, 'ContactParameters') + + request = build_list_available_contacts_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AvailableContactsListResult', pipeline_response) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('AvailableContactsListResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _list_available_contacts_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts'} # type: ignore + _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.ContactParametersContactProfile", + ground_station_name: str, + start_time: datetime.datetime, + end_time: datetime.datetime, + **kwargs: Any + ) -> LROPoller[ItemPaged["_models.AvailableContactsListResult"]]: """Return list of available contacts. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -661,7 +1039,7 @@ def begin_list_available_contacts( :param spacecraft_name: Spacecraft ID. :type spacecraft_name: str :param contact_profile: The reference to the contact profile resource. - :type contact_profile: ~azure_orbital.models.ResourceReference + :type contact_profile: ~azure.mgmt.orbital.models.ContactParametersContactProfile :param ground_station_name: Name of Azure Ground Station. :type ground_station_name: str :param start_time: Start time of a contact. @@ -670,14 +1048,86 @@ 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) - :rtype: ~azure.core.polling.LROPoller[~azure_orbital.models.AvailableContactsListResult] - :raises ~azure.core.exceptions.HttpResponseError: + :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 an iterator like instance of either + AvailableContactsListResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.orbital.models.AvailableContactsListResult]] + :raises: ~azure.core.exceptions.HttpResponseError """ + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + _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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.begin_list_available_contacts.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + _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( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + spacecraft_name=spacecraft_name, + api_version=api_version, + content_type=content_type, + json=_json, + 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("AvailableContactsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] lro_delay = kwargs.pop( @@ -693,27 +1143,24 @@ def begin_list_available_contacts( ground_station_name=ground_station_name, start_time=start_time, end_time=end_time, + api_version=api_version, + 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): - deserialized = self._deserialize('AvailableContactsListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + return get_next(next_link) - 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'), - } + return ItemPaged( + internal_get_next, extract_data + ) - 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': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -723,6 +1170,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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 +