diff --git a/sdk/orbital/azure-mgmt-orbital/CHANGELOG.md b/sdk/orbital/azure-mgmt-orbital/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/orbital/azure-mgmt-orbital/LICENSE.txt b/sdk/orbital/azure-mgmt-orbital/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +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. diff --git a/sdk/orbital/azure-mgmt-orbital/MANIFEST.in b/sdk/orbital/azure-mgmt-orbital/MANIFEST.in new file mode 100644 index 000000000000..ef61eb0e3527 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE.txt diff --git a/sdk/orbital/azure-mgmt-orbital/README.md b/sdk/orbital/azure-mgmt-orbital/README.md new file mode 100644 index 000000000000..ed9237406675 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-orbital%2FREADME.png) diff --git a/sdk/orbital/azure-mgmt-orbital/_meta.json b/sdk/orbital/azure-mgmt-orbital/_meta.json new file mode 100644 index 000000000000..d0317cc69b92 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "8c7612b823f693c6d7bc607594ed30b5ecb72730", + "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", + "readme": "specification/orbital/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/orbital/azure-mgmt-orbital/azure/__init__.py b/sdk/orbital/azure-mgmt-orbital/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/__init__.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/__init__.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/__init__.py new file mode 100644 index 000000000000..342c98524bd4 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/__init__.py @@ -0,0 +1,19 @@ +# 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 ._azure_orbital import AzureOrbital +from ._version import VERSION + +__version__ = VERSION +__all__ = ['AzureOrbital'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass 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 new file mode 100644 index 000000000000..8e2f7cde33ce --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_azure_orbital.py @@ -0,0 +1,109 @@ +# 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 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 ._configuration import AzureOrbitalConfiguration +from .operations import Operations +from .operations import SpacecraftsOperations +from .operations import ContactsOperations +from .operations import ContactProfilesOperations +from .operations import AvailableGroundStationsOperations +from . import models + + +class AzureOrbital(object): + """Azure Orbital service. + + :ivar operations: Operations operations + :vartype operations: azure_orbital.operations.Operations + :ivar spacecrafts: SpacecraftsOperations operations + :vartype spacecrafts: azure_orbital.operations.SpacecraftsOperations + :ivar contacts: ContactsOperations operations + :vartype contacts: azure_orbital.operations.ContactsOperations + :ivar contact_profiles: ContactProfilesOperations operations + :vartype contact_profiles: azure_orbital.operations.ContactProfilesOperations + :ivar available_ground_stations: AvailableGroundStationsOperations operations + :vartype available_ground_stations: azure_orbital.operations.AvailableGroundStationsOperations + :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. + """ + + 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) + 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.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 + """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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AzureOrbital + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py new file mode 100644 index 000000000000..fc8920d8f223 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_configuration.py @@ -0,0 +1,71 @@ +# 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 TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import 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): + """Configuration for AzureOrbital. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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 + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-orbital/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + 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) diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_metadata.json b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_metadata.json new file mode 100644 index 000000000000..972824a4331f --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_metadata.json @@ -0,0 +1,107 @@ +{ + "chosen_version": "2021-04-04-preview", + "total_api_version_list": ["2021-04-04-preview"], + "client": { + "name": "AzureOrbital", + "filename": "_azure_orbital", + "description": "Azure Orbital service.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": 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\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "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\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "spacecrafts": "SpacecraftsOperations", + "contacts": "ContactsOperations", + "contact_profiles": "ContactProfilesOperations", + "available_ground_stations": "AvailableGroundStationsOperations" + } +} \ No newline at end of file diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_version.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" 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 new file mode 100644 index 000000000000..ecd68d66b7c7 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._azure_orbital import AzureOrbital +__all__ = ['AzureOrbital'] 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 new file mode 100644 index 000000000000..0ccdab333b46 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_azure_orbital.py @@ -0,0 +1,102 @@ +# 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, Optional, 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 ._configuration import AzureOrbitalConfiguration +from .operations import Operations +from .operations import SpacecraftsOperations +from .operations import ContactsOperations +from .operations import ContactProfilesOperations +from .operations import AvailableGroundStationsOperations +from .. import models + + +class AzureOrbital(object): + """Azure Orbital service. + + :ivar operations: Operations operations + :vartype operations: azure_orbital.aio.operations.Operations + :ivar spacecrafts: SpacecraftsOperations operations + :vartype spacecrafts: azure_orbital.aio.operations.SpacecraftsOperations + :ivar contacts: ContactsOperations operations + :vartype contacts: azure_orbital.aio.operations.ContactsOperations + :ivar contact_profiles: ContactProfilesOperations operations + :vartype contact_profiles: azure_orbital.aio.operations.ContactProfilesOperations + :ivar available_ground_stations: AvailableGroundStationsOperations operations + :vartype available_ground_stations: azure_orbital.aio.operations.AvailableGroundStationsOperations + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AzureOrbitalConfiguration(credential, 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.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: + """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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AzureOrbital": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) 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 new file mode 100644 index 000000000000..3e14ada0e4e8 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AzureOrbitalConfiguration(Configuration): + """Configuration for AzureOrbital. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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 + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + 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.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-orbital/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + 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) 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 new file mode 100644 index 000000000000..332d78334cb4 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._operations import Operations +from ._spacecrafts_operations import SpacecraftsOperations +from ._contacts_operations import ContactsOperations +from ._contact_profiles_operations import ContactProfilesOperations +from ._available_ground_stations_operations import AvailableGroundStationsOperations + +__all__ = [ + 'Operations', + 'SpacecraftsOperations', + 'ContactsOperations', + 'ContactProfilesOperations', + 'AvailableGroundStationsOperations', +] 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 new file mode 100644 index 000000000000..370a35ef5dcd --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_available_ground_stations_operations.py @@ -0,0 +1,166 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AvailableGroundStationsOperations: + """AvailableGroundStationsOperations 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_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 + + def list_by_capability( + self, + capability: Union[str, "_models.Enum6"] = "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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AvailableGroundStationListResult', 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(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 + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_capability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations'} # type: ignore + + async def get( + self, + 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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableGroundStation"] + 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.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'groundStationName': self._serialize.url("ground_station_name", ground_station_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + + deserialized = self._deserialize('AvailableGroundStation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName}'} # type: ignore diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py new file mode 100644 index 000000000000..0ff96e62d390 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contact_profiles_operations.py @@ -0,0 +1,567 @@ +# 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, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContactProfilesOperations: + """ContactProfilesOperations 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_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( + self, + 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. + :type resource_group_name: str + :param contact_profile_name: Contact Profile Name. + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + + deserialized = self._deserialize('ContactProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + contact_profile_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + minimum_viable_contact_duration: Optional[str] = None, + minimum_elevation_degrees: Optional[float] = None, + auto_tracking_configuration: Optional[Union[str, "_models.AutoTrackingConfiguration"]] = None, + 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 = await self._client._pipeline.run(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) + + if response.status_code == 200: + deserialized = self._deserialize('ContactProfile', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ContactProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + contact_profile_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + minimum_viable_contact_duration: Optional[str] = None, + minimum_elevation_degrees: Optional[float] = None, + auto_tracking_configuration: Optional[Union[str, "_models.AutoTrackingConfiguration"]] = None, + links: Optional[List["_models.ContactProfileLink"]] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.ContactProfile"]: + """Creates or updates a contact profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param contact_profile_name: Contact Profile Name. + :type contact_profile_name: str + :param location: The geo-location where the resource lives. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, 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. + :type auto_tracking_configuration: str or ~azure_orbital.models.AutoTrackingConfiguration + :param links: Links of the Contact Profile. + :type links: list[~azure_orbital.models.ContactProfileLink] + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] + 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._create_or_update_initial( + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + location=location, + tags=tags, + minimum_viable_contact_duration=minimum_viable_contact_duration, + minimum_elevation_degrees=minimum_elevation_degrees, + auto_tracking_configuration=auto_tracking_configuration, + links=links, + 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('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) + 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + contact_profile_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-04-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + contact_profile_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a specified contact profile resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param contact_profile_name: Contact Profile Name. + :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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._delete_initial( + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + 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) + 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 + ) + 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 + + async def update_tags( + self, + resource_group_name: str, + contact_profile_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.ContactProfile": + """Updates the specified contact profile tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 + + 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) + + deserialized = self._deserialize('ContactProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ContactProfileListResult"]: + """Returns list of contact profiles. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContactProfileListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.ContactProfileListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(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) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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 + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles'} # type: ignore + + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ContactProfileListResult"]: + """Returns list of contact profiles. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContactProfileListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.ContactProfileListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(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) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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 + + return AsyncItemPaged( + get_next, extract_data + ) + 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 new file mode 100644 index 000000000000..a1afa1a058d3 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_contacts_operations.py @@ -0,0 +1,430 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContactsOperations: + """ContactsOperations 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_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 + + def list( + self, + resource_group_name: str, + spacecraft_name: str, + **kwargs: Any + ) -> AsyncIterable["_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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(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) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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 + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts'} # type: ignore + + async def get( + self, + 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. + :type resource_group_name: str + :param spacecraft_name: Spacecraft ID. + :type spacecraft_name: str + :param contact_name: Contact Name. + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + 'contactName': self._serialize.url("contact_name", contact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + + deserialized = self._deserialize('Contact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + 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 = await self._client._pipeline.run(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) + + if response.status_code == 200: + deserialized = self._deserialize('Contact', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Contact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + parameters: "_models.Contact", + **kwargs: Any + ) -> AsyncLROPoller["_models.Contact"]: + """Creates a contact. + + :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 contact_name: Contact Name. + :type contact_name: str + :param parameters: The parameters to provide for the created contact. + :type parameters: ~azure_orbital.models.Contact + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Contact"] + 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._create_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + parameters=parameters, + 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('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) + 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-04-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + 'contactName': self._serialize.url("contact_name", contact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + spacecraft_name: str, + contact_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a specified contact. + + :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 contact_name: Contact Name. + :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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._delete_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + 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) + 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py new file mode 100644 index 000000000000..127575a01ac8 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations 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_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 + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_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.async_paging.AsyncItemPaged[~azure_orbital.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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) + 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 + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Orbital/operations'} # 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 new file mode 100644 index 000000000000..948fbef16746 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/aio/operations/_spacecrafts_operations.py @@ -0,0 +1,714 @@ +# 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 datetime +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SpacecraftsOperations: + """SpacecraftsOperations 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_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 + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SpacecraftListResult"]: + """Return list of spacecrafts. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SpacecraftListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_orbital.models.SpacecraftListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(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) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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 + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/spacecrafts'} # type: ignore + + def list( + self, + resource_group_name: str, + **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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(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) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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 + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts'} # type: ignore + + async def get( + self, + 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. + :type resource_group_name: str + :param spacecraft_name: Spacecraft ID. + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + + deserialized = self._deserialize('Spacecraft', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + spacecraft_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + norad_id: Optional[str] = None, + title_line: Optional[str] = None, + tle_line1: Optional[str] = None, + tle_line2: Optional[str] = None, + links: Optional[List["_models.SpacecraftLink"]] = None, + **kwargs: Any + ) -> "_models.Spacecraft": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _parameters = _models.Spacecraft(tags=tags, location=location, norad_id=norad_id, title_line=title_line, tle_line1=tle_line1, tle_line2=tle_line2, links=links) + api_version = "2021-04-04-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Spacecraft', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Spacecraft', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + spacecraft_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + norad_id: Optional[str] = None, + title_line: Optional[str] = None, + tle_line1: Optional[str] = None, + tle_line2: Optional[str] = None, + links: Optional[List["_models.SpacecraftLink"]] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.Spacecraft"]: + """Creates or updates a spacecraft resource. + + :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 location: The geo-location where the resource lives. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param norad_id: NORAD ID of the spacecraft. + :type norad_id: 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] + :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 Spacecraft or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure_orbital.models.Spacecraft] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] + 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._create_or_update_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + location=location, + tags=tags, + norad_id=norad_id, + title_line=title_line, + tle_line1=tle_line1, + tle_line2=tle_line2, + links=links, + 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('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) + 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + spacecraft_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-04-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + spacecraft_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a specified spacecraft resource. + + :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 + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._delete_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + 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) + 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 + ) + 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 + + async def update_tags( + self, + resource_group_name: str, + spacecraft_name: str, + parameters: "_models.TagsObject", + **kwargs: Any + ) -> "_models.Spacecraft": + """Updates the specified spacecraft tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param spacecraft_name: Spacecraft ID. + :type spacecraft_name: str + :param parameters: Parameters supplied to update spacecraft tags. + :type parameters: ~azure_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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 + + 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) + + deserialized = self._deserialize('Spacecraft', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + async def _list_available_contacts_initial( + self, + resource_group_name: str, + spacecraft_name: str, + contact_profile: "_models.ResourceReference", + ground_station_name: str, + start_time: datetime.datetime, + end_time: datetime.datetime, + **kwargs: Any + ) -> "_models.AvailableContactsListResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _parameters = _models.ContactParameters(contact_profile=contact_profile, ground_station_name=ground_station_name, start_time=start_time, end_time=end_time) + api_version = "2021-04-04-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._list_available_contacts_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # 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) + 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) + + deserialized = self._deserialize('AvailableContactsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _list_available_contacts_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts'} # type: ignore + + async def begin_list_available_contacts( + self, + resource_group_name: str, + spacecraft_name: str, + contact_profile: "_models.ResourceReference", + ground_station_name: str, + start_time: datetime.datetime, + end_time: datetime.datetime, + **kwargs: Any + ) -> AsyncLROPoller["_models.AvailableContactsListResult"]: + """Return list of available contacts. + + :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 contact_profile: The reference to the contact profile resource. + :type contact_profile: ~azure_orbital.models.ResourceReference + :param ground_station_name: Name of Azure Ground Station. + :type ground_station_name: str + :param start_time: Start time of a contact. + :type start_time: ~datetime.datetime + :param end_time: End time of a contact. + :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. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] + 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._list_available_contacts_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_profile=contact_profile, + ground_station_name=ground_station_name, + start_time=start_time, + end_time=end_time, + 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 + + 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) + 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_list_available_contacts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts'} # type: ignore diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/__init__.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/__init__.py new file mode 100644 index 000000000000..76a686fe04dd --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/__init__.py @@ -0,0 +1,119 @@ +# 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. +# -------------------------------------------------------------------------- + +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 ._azure_orbital_enums import ( + ActionType, + AuthorizationStatus, + AutoTrackingConfiguration, + Capability, + CreatedByType, + Direction, + Enum6, + Origin, + Polarization, + Protocol, + Status, +) + +__all__ = [ + 'AvailableContacts', + 'AvailableContactsListResult', + 'AvailableGroundStation', + 'AvailableGroundStationListResult', + 'CloudErrorBody', + 'Contact', + 'ContactListResult', + 'ContactParameters', + 'ContactProfile', + 'ContactProfileLink', + 'ContactProfileLinkChannel', + 'ContactProfileListResult', + 'EndPoint', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'ProxyResource', + 'Resource', + 'ResourceIdListResult', + 'ResourceIdListResultValueItem', + 'ResourceReference', + 'Spacecraft', + 'SpacecraftLink', + 'SpacecraftListResult', + 'SystemData', + 'TagsObject', + 'TrackedResource', + 'ActionType', + 'AuthorizationStatus', + 'AutoTrackingConfiguration', + 'Capability', + 'CreatedByType', + 'Direction', + 'Enum6', + 'Origin', + 'Polarization', + 'Protocol', + '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 new file mode 100644 index 000000000000..4d222f35a97e --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_azure_orbital_enums.py @@ -0,0 +1,113 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +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)): + """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. + """ + + ALLOWED = "Allowed" + PENDING = "Pending" + DENIED = "Denied" + +class AutoTrackingConfiguration(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Auto track configuration. + """ + + DISABLED = "disabled" + X_BAND = "xBand" + S_BAND = "sBand" + +class Capability(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Capability of the Ground Station. + """ + + EARTH_OBSERVATION = "EarthObservation" + COMMUNICATION = "Communication" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +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)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +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)): + """Protocol either UDP or TCP. + """ + + TCP = "TCP" + UDP = "UDP" + +class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of a contact. + """ + + SCHEDULED = "scheduled" + CANCELLED = "cancelled" + SUCCEEDED = "succeeded" + FAILED = "failed" + PROVIDER_CANCELLED = "providerCancelled" 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 new file mode 100644 index 000000000000..925bc913ea43 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models.py @@ -0,0 +1,1195 @@ +# 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 new file mode 100644 index 000000000000..52fff858cbb6 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/models/_models_py3.py @@ -0,0 +1,1293 @@ +# 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 datetime +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._azure_orbital_enums import * + + +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, + *, + spacecraft: Optional["ResourceReference"] = None, + **kwargs + ): + super(AvailableContacts, self).__init__(**kwargs) + self.spacecraft = spacecraft + 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, + *, + value: Optional[List["AvailableContacts"]] = None, + **kwargs + ): + super(AvailableContactsListResult, self).__init__(**kwargs) + self.value = value + 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, + *, + location: Optional[str] = None, + city: Optional[str] = None, + provider_name: Optional[str] = None, + longitude_degrees: Optional[float] = None, + latitude_degrees: Optional[float] = None, + altitude_meters: Optional[float] = None, + **kwargs + ): + super(AvailableGroundStation, self).__init__(**kwargs) + self.id = None + self.name = None + self.location = location + self.type = None + self.city = city + self.provider_name = provider_name + self.longitude_degrees = longitude_degrees + self.latitude_degrees = latitude_degrees + self.altitude_meters = altitude_meters + + +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, + *, + value: Optional[List["AvailableGroundStation"]] = None, + **kwargs + ): + super(AvailableGroundStationListResult, self).__init__(**kwargs) + self.value = value + 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, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +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, + *, + 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, + **kwargs + ): + super(Contact, self).__init__(**kwargs) + self.etag = None + self.status = None + self.reservation_start_time = reservation_start_time + self.reservation_end_time = reservation_end_time + 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 = ground_station_name + self.start_elevation_degrees = None + self.end_elevation_degrees = None + self.contact_profile = contact_profile + + +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, + *, + value: Optional[List["Contact"]] = None, + **kwargs + ): + super(ContactListResult, self).__init__(**kwargs) + self.value = value + 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, + *, + contact_profile: "ResourceReference", + ground_station_name: str, + start_time: datetime.datetime, + end_time: datetime.datetime, + **kwargs + ): + super(ContactParameters, self).__init__(**kwargs) + self.contact_profile = contact_profile + self.ground_station_name = ground_station_name + self.start_time = start_time + self.end_time = 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, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = 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, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + minimum_viable_contact_duration: Optional[str] = None, + minimum_elevation_degrees: Optional[float] = None, + auto_tracking_configuration: Optional[Union[str, "AutoTrackingConfiguration"]] = None, + links: Optional[List["ContactProfileLink"]] = None, + **kwargs + ): + super(ContactProfile, self).__init__(tags=tags, location=location, **kwargs) + self.etag = None + self.minimum_viable_contact_duration = minimum_viable_contact_duration + self.minimum_elevation_degrees = minimum_elevation_degrees + self.auto_tracking_configuration = auto_tracking_configuration + self.links = links + + +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, + *, + polarization: Union[str, "Polarization"], + direction: Union[str, "Direction"], + channels: List["ContactProfileLinkChannel"], + gain_over_temperature: Optional[float] = None, + eirpd_bw: Optional[float] = None, + **kwargs + ): + super(ContactProfileLink, self).__init__(**kwargs) + self.polarization = polarization + self.direction = direction + self.gain_over_temperature = gain_over_temperature + self.eirpd_bw = eirpd_bw + self.channels = 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, + *, + center_frequency_m_hz: float, + bandwidth_m_hz: float, + end_point: "EndPoint", + modulation_configuration: Optional[str] = None, + demodulation_configuration: Optional[str] = None, + encoding_configuration: Optional[str] = None, + decoding_configuration: Optional[str] = None, + **kwargs + ): + super(ContactProfileLinkChannel, self).__init__(**kwargs) + self.center_frequency_m_hz = center_frequency_m_hz + self.bandwidth_m_hz = bandwidth_m_hz + self.end_point = end_point + self.modulation_configuration = modulation_configuration + self.demodulation_configuration = demodulation_configuration + self.encoding_configuration = encoding_configuration + self.decoding_configuration = decoding_configuration + + +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, + *, + value: Optional[List["ContactProfile"]] = None, + **kwargs + ): + super(ContactProfileListResult, self).__init__(**kwargs) + self.value = value + 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, + *, + ip_address: str, + end_point_name: str, + port: str, + protocol: Union[str, "Protocol"], + **kwargs + ): + super(EndPoint, self).__init__(**kwargs) + self.ip_address = ip_address + self.end_point_name = end_point_name + self.port = port + self.protocol = 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, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + 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, + *, + value: Optional[List["ResourceIdListResultValueItem"]] = None, + **kwargs + ): + super(ResourceIdListResult, self).__init__(**kwargs) + self.value = value + 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, + *, + id: Optional[str] = None, + **kwargs + ): + 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. + + 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, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + norad_id: Optional[str] = None, + title_line: Optional[str] = None, + tle_line1: Optional[str] = None, + tle_line2: Optional[str] = None, + links: Optional[List["SpacecraftLink"]] = None, + **kwargs + ): + super(Spacecraft, self).__init__(tags=tags, location=location, **kwargs) + self.etag = None + 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 + self.links = links + + +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, + *, + center_frequency_m_hz: float, + bandwidth_m_hz: float, + direction: Union[str, "Direction"], + polarization: Union[str, "Polarization"], + **kwargs + ): + super(SpacecraftLink, self).__init__(**kwargs) + self.center_frequency_m_hz = center_frequency_m_hz + self.bandwidth_m_hz = bandwidth_m_hz + self.direction = direction + self.polarization = 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, + *, + value: Optional[List["Spacecraft"]] = None, + **kwargs + ): + super(SpacecraftListResult, self).__init__(**kwargs) + self.value = value + 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, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +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, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + 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 new file mode 100644 index 000000000000..332d78334cb4 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._operations import Operations +from ._spacecrafts_operations import SpacecraftsOperations +from ._contacts_operations import ContactsOperations +from ._contact_profiles_operations import ContactProfilesOperations +from ._available_ground_stations_operations import AvailableGroundStationsOperations + +__all__ = [ + 'Operations', + 'SpacecraftsOperations', + 'ContactsOperations', + 'ContactProfilesOperations', + 'AvailableGroundStationsOperations', +] 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 new file mode 100644 index 000000000000..dc2e9627b098 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_available_ground_stations_operations.py @@ -0,0 +1,172 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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]] + +class AvailableGroundStationsOperations(object): + """AvailableGroundStationsOperations 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_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 list_by_capability( + self, + capability="EarthObservation", # type: Union[str, "_models.Enum6"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableGroundStationListResult"] + """Returns list of available ground stations. + + :param capability: Ground Station Capability. + :type capability: str or ~azure_orbital.models.Enum6 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableGroundStationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.AvailableGroundStationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AvailableGroundStationListResult', 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(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 + + return ItemPaged( + get_next, extract_data + ) + list_by_capability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations'} # type: ignore + + def get( + self, + ground_station_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableGroundStation"] + 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.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'groundStationName': self._serialize.url("ground_station_name", ground_station_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + + deserialized = self._deserialize('AvailableGroundStation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName}'} # type: ignore diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py new file mode 100644 index 000000000000..13e331bcb011 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contact_profiles_operations.py @@ -0,0 +1,579 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +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]] + +class ContactProfilesOperations(object): + """ContactProfilesOperations 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_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( + self, + resource_group_name, # type: str + contact_profile_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type resource_group_name: str + :param contact_profile_name: Contact Profile Name. + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + + deserialized = self._deserialize('ContactProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + contact_profile_name, # type: str + location, # type: str + tags=None, # type: Optional[Dict[str, str]] + minimum_viable_contact_duration=None, # type: Optional[str] + minimum_elevation_degrees=None, # type: Optional[float] + auto_tracking_configuration=None, # type: Optional[Union[str, "_models.AutoTrackingConfiguration"]] + links=None, # type: Optional[List["_models.ContactProfileLink"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.ContactProfile" + 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) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('ContactProfile', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ContactProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + 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"] + """Creates or updates a contact profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param contact_profile_name: Contact Profile Name. + :type contact_profile_name: str + :param location: The geo-location where the resource lives. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, 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. + :type auto_tracking_configuration: str or ~azure_orbital.models.AutoTrackingConfiguration + :param links: Links of the Contact Profile. + :type links: list[~azure_orbital.models.ContactProfileLink] + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContactProfile"] + 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._create_or_update_initial( + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + location=location, + tags=tags, + minimum_viable_contact_duration=minimum_viable_contact_duration, + minimum_elevation_degrees=minimum_elevation_degrees, + auto_tracking_configuration=auto_tracking_configuration, + links=links, + 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('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) + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + contact_profile_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-04-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'contactProfileName': self._serialize.url("contact_profile_name", contact_profile_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + contact_profile_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a specified contact profile resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param contact_profile_name: Contact Profile Name. + :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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._delete_initial( + resource_group_name=resource_group_name, + contact_profile_name=contact_profile_name, + 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) + 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 + ) + 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 + + def update_tags( + self, + resource_group_name, # type: str + contact_profile_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.ContactProfile" + """Updates the specified contact profile tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 + + 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) + + deserialized = self._deserialize('ContactProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ContactProfileListResult"] + """Returns list of contact profiles. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContactProfileListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.ContactProfileListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(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) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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 + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles'} # type: ignore + + def list( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ContactProfileListResult"] + """Returns list of contact profiles. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContactProfileListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.ContactProfileListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(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) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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 + + return ItemPaged( + get_next, extract_data + ) + 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 new file mode 100644 index 000000000000..46b06fd0e05b --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_contacts_operations.py @@ -0,0 +1,440 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +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]] + +class ContactsOperations(object): + """ContactsOperations 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_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 list( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(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) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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 + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts'} # type: ignore + + def get( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + contact_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type resource_group_name: str + :param spacecraft_name: Spacecraft ID. + :type spacecraft_name: str + :param contact_name: Contact Name. + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + 'contactName': self._serialize.url("contact_name", contact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + + deserialized = self._deserialize('Contact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + contact_name, # type: str + parameters, # type: "_models.Contact" + **kwargs # type: Any + ): + # type: (...) -> "_models.Contact" + 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) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Contact', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Contact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + 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"] + """Creates a contact. + + :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 contact_name: Contact Name. + :type contact_name: str + :param parameters: The parameters to provide for the created contact. + :type parameters: ~azure_orbital.models.Contact + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 Contact or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure_orbital.models.Contact] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Contact"] + 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._create_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + parameters=parameters, + 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('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) + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + contact_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-04-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + 'contactName': self._serialize.url("contact_name", contact_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + contact_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a specified contact. + + :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 contact_name: Contact Name. + :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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._delete_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_name=contact_name, + 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) + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}'} # type: ignore diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py new file mode 100644 index 000000000000..e2b44b516e23 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_operations.py @@ -0,0 +1,109 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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]] + +class Operations(object): + """Operations 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_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 list( + self, + **kwargs # type: Any + ): + # type: (...) -> 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = 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) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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) + 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 + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Orbital/operations'} # 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 new file mode 100644 index 000000000000..148664d9ff61 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/operations/_spacecrafts_operations.py @@ -0,0 +1,728 @@ +# 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 datetime +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +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]] + +class SpacecraftsOperations(object): + """SpacecraftsOperations 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_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 list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SpacecraftListResult"] + """Return list of spacecrafts. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SpacecraftListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.SpacecraftListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(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) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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 + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/spacecrafts'} # type: ignore + + def list( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SpacecraftListResult"] + """Return list of spacecrafts. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SpacecraftListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_orbital.models.SpacecraftListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(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) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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 + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts'} # type: ignore + + def get( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type resource_group_name: str + :param spacecraft_name: Spacecraft ID. + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + + deserialized = self._deserialize('Spacecraft', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + location, # type: str + tags=None, # type: Optional[Dict[str, str]] + norad_id=None, # type: Optional[str] + title_line=None, # type: Optional[str] + tle_line1=None, # type: Optional[str] + tle_line2=None, # type: Optional[str] + links=None, # type: Optional[List["_models.SpacecraftLink"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.Spacecraft" + 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) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Spacecraft', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Spacecraft', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + 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"] + """Creates or updates a spacecraft resource. + + :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 location: The geo-location where the resource lives. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param norad_id: NORAD ID of the spacecraft. + :type norad_id: 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] + :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 Spacecraft or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure_orbital.models.Spacecraft] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Spacecraft"] + 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._create_or_update_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + location=location, + tags=tags, + norad_id=norad_id, + title_line=title_line, + tle_line1=tle_line1, + tle_line2=tle_line2, + links=links, + 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('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) + 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-04-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a specified spacecraft resource. + + :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 + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._delete_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + 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) + 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 + ) + 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 + + def update_tags( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + parameters, # type: "_models.TagsObject" + **kwargs # type: Any + ): + # type: (...) -> "_models.Spacecraft" + """Updates the specified spacecraft tags. + + :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 parameters: Parameters supplied to update spacecraft tags. + :type parameters: ~azure_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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 + + 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) + + deserialized = self._deserialize('Spacecraft', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}'} # type: ignore + + def _list_available_contacts_initial( + self, + resource_group_name, # type: str + spacecraft_name, # type: str + contact_profile, # type: "_models.ResourceReference" + ground_station_name, # type: str + start_time, # type: datetime.datetime + end_time, # type: datetime.datetime + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableContactsListResult" + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _parameters = _models.ContactParameters(contact_profile=contact_profile, ground_station_name=ground_station_name, start_time=start_time, end_time=end_time) + api_version = "2021-04-04-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._list_available_contacts_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'spacecraftName': self._serialize.url("spacecraft_name", spacecraft_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # 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) + 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) + + deserialized = self._deserialize('AvailableContactsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _list_available_contacts_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/listAvailableContacts'} # type: ignore + + 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"] + """Return list of available contacts. + + :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 contact_profile: The reference to the contact profile resource. + :type contact_profile: ~azure_orbital.models.ResourceReference + :param ground_station_name: Name of Azure Ground Station. + :type ground_station_name: str + :param start_time: Start time of a contact. + :type start_time: ~datetime.datetime + :param end_time: End time of a contact. + :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. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableContactsListResult"] + 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._list_available_contacts_initial( + resource_group_name=resource_group_name, + spacecraft_name=spacecraft_name, + contact_profile=contact_profile, + ground_station_name=ground_station_name, + start_time=start_time, + end_time=end_time, + 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 + + 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) + 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 + ) + 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 diff --git a/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/py.typed b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/azure/mgmt/orbital/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/orbital/azure-mgmt-orbital/sdk_packaging.toml b/sdk/orbital/azure-mgmt-orbital/sdk_packaging.toml new file mode 100644 index 000000000000..44209147485f --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-orbital" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/orbital/azure-mgmt-orbital/setup.cfg b/sdk/orbital/azure-mgmt-orbital/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/orbital/azure-mgmt-orbital/setup.py b/sdk/orbital/azure-mgmt-orbital/setup.py new file mode 100644 index 000000000000..7a49c41f69c7 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/setup.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-orbital" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/orbital/ci.yml b/sdk/orbital/ci.yml new file mode 100644 index 000000000000..150540605bca --- /dev/null +++ b/sdk/orbital/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/orbital/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/orbital/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: orbital + Artifacts: + - name: azure-mgmt-orbital + safeName: azuremgmtorbital