diff --git a/sdk/azurestack/azure-mgmt-azurestack/_meta.json b/sdk/azurestack/azure-mgmt-azurestack/_meta.json index 231a159efafd..13db63dcf760 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/_meta.json +++ b/sdk/azurestack/azure-mgmt-azurestack/_meta.json @@ -1,8 +1,11 @@ { - "autorest": "3.0.6369", - "use": "@autorest/python@5.6.2", - "commit": "ea6ceada9e22eb0d455288d339955dfe56521302", + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "754938e4cb9416358b02dcc11f444adf14b3b7b6", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/azurestack/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.6.2 --version=3.0.6369", + "autorest_command": "autorest specification/azurestack/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/azurestack/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/__init__.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/__init__.py index baf0ccc80f5f..57a5d857493f 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/__init__.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AzureStackManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_azure_stack_management_client.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_azure_stack_management_client.py index f25c3bfa7b04..9c70dd462799 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_azure_stack_management_client.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_azure_stack_management_client.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import AzureStackManagementClientConfiguration +from .operations import CloudManifestFileOperations, CustomerSubscriptionsOperations, LinkedSubscriptionsOperations, Operations, ProductsOperations, RegistrationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential -from ._configuration import AzureStackManagementClientConfiguration -from .operations import Operations -from .operations import CloudManifestFileOperations -from .operations import CustomerSubscriptionsOperations -from .operations import ProductsOperations -from .operations import RegistrationsOperations -from .operations import LinkedSubscriptionsOperations -from . import models - - -class AzureStackManagementClient(object): +class AzureStackManagementClient: """Azure Stack. :ivar operations: Operations operations @@ -35,7 +29,8 @@ class AzureStackManagementClient(object): :ivar cloud_manifest_file: CloudManifestFileOperations operations :vartype cloud_manifest_file: azure.mgmt.azurestack.operations.CloudManifestFileOperations :ivar customer_subscriptions: CustomerSubscriptionsOperations operations - :vartype customer_subscriptions: azure.mgmt.azurestack.operations.CustomerSubscriptionsOperations + :vartype customer_subscriptions: + azure.mgmt.azurestack.operations.CustomerSubscriptionsOperations :ivar products: ProductsOperations operations :vartype products: azure.mgmt.azurestack.operations.ProductsOperations :ivar registrations: RegistrationsOperations operations @@ -44,41 +39,60 @@ class AzureStackManagementClient(object): :vartype linked_subscriptions: azure.mgmt.azurestack.operations.LinkedSubscriptionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials that uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials that uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ 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 = AzureStackManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureStackManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_manifest_file = CloudManifestFileOperations(self._client, self._config, self._serialize, self._deserialize) + self.customer_subscriptions = CustomerSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.products = ProductsOperations(self._client, self._config, self._serialize, self._deserialize) + self.registrations = RegistrationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.linked_subscriptions = LinkedSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_manifest_file = CloudManifestFileOperations( - self._client, self._config, self._serialize, self._deserialize) - self.customer_subscriptions = CustomerSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.products = ProductsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registrations = RegistrationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.linked_subscriptions = LinkedSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_configuration.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_configuration.py index 53a1c0957dff..cb27769c3efb 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_configuration.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class AzureStackManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AzureStackManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AzureStackManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_metadata.json b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_metadata.json index 33c346444236..f0bcc148a76b 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_metadata.json +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_metadata.json @@ -5,13 +5,13 @@ "name": "AzureStackManagementClient", "filename": "_azure_stack_management_client", "description": "Azure Stack.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": false, "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\": [\"AzureStackManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "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\": [\"AzureStackManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureStackManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", @@ -104,11 +103,5 @@ "products": "ProductsOperations", "registrations": "RegistrationsOperations", "linked_subscriptions": "LinkedSubscriptionsOperations" - }, - "operation_mixins": { - "sync_imports": "None", - "async_imports": "None", - "operations": { - } } } \ No newline at end of file diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_patch.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_vendor.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_version.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_version.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/__init__.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/__init__.py index b1c20109416e..cf82ecc3f8f7 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/__init__.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_stack_management_client import AzureStackManagementClient __all__ = ['AzureStackManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_azure_stack_management_client.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_azure_stack_management_client.py index 91fc40d3bba6..e1f2a0a625c6 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_azure_stack_management_client.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_azure_stack_management_client.py @@ -6,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AzureStackManagementClientConfiguration +from .operations import CloudManifestFileOperations, CustomerSubscriptionsOperations, LinkedSubscriptionsOperations, Operations, ProductsOperations, RegistrationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AzureStackManagementClientConfiguration -from .operations import Operations -from .operations import CloudManifestFileOperations -from .operations import CustomerSubscriptionsOperations -from .operations import ProductsOperations -from .operations import RegistrationsOperations -from .operations import LinkedSubscriptionsOperations -from .. import models - - -class AzureStackManagementClient(object): +class AzureStackManagementClient: """Azure Stack. :ivar operations: Operations operations @@ -33,49 +29,71 @@ class AzureStackManagementClient(object): :ivar cloud_manifest_file: CloudManifestFileOperations operations :vartype cloud_manifest_file: azure.mgmt.azurestack.aio.operations.CloudManifestFileOperations :ivar customer_subscriptions: CustomerSubscriptionsOperations operations - :vartype customer_subscriptions: azure.mgmt.azurestack.aio.operations.CustomerSubscriptionsOperations + :vartype customer_subscriptions: + azure.mgmt.azurestack.aio.operations.CustomerSubscriptionsOperations :ivar products: ProductsOperations operations :vartype products: azure.mgmt.azurestack.aio.operations.ProductsOperations :ivar registrations: RegistrationsOperations operations :vartype registrations: azure.mgmt.azurestack.aio.operations.RegistrationsOperations :ivar linked_subscriptions: LinkedSubscriptionsOperations operations - :vartype linked_subscriptions: azure.mgmt.azurestack.aio.operations.LinkedSubscriptionsOperations + :vartype linked_subscriptions: + azure.mgmt.azurestack.aio.operations.LinkedSubscriptionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials that uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials that uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureStackManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AzureStackManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.cloud_manifest_file = CloudManifestFileOperations(self._client, self._config, self._serialize, self._deserialize) + self.customer_subscriptions = CustomerSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.products = ProductsOperations(self._client, self._config, self._serialize, self._deserialize) + self.registrations = RegistrationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.linked_subscriptions = LinkedSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.cloud_manifest_file = CloudManifestFileOperations( - self._client, self._config, self._serialize, self._deserialize) - self.customer_subscriptions = CustomerSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.products = ProductsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registrations = RegistrationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.linked_subscriptions = LinkedSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_configuration.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_configuration.py index 10a75cee4d56..ca000215d381 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_configuration.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AzureStackManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AzureStackManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_patch.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_cloud_manifest_file_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_cloud_manifest_file_operations.py index 337d3857a018..4f5ed31aabc8 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_cloud_manifest_file_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_cloud_manifest_file_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cloud_manifest_file_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,9 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, - **kwargs + **kwargs: Any ) -> "_models.CloudManifestFileResponse": """Returns a cloud specific manifest JSON file with latest version. @@ -56,27 +61,20 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CloudManifestFileResponse', pipeline_response) @@ -85,13 +83,16 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.AzureStack/cloudManifestFiles'} # type: ignore + + @distributed_trace_async async def get( self, verification_version: str, version_creation_date: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.CloudManifestFileResponse": """Returns a cloud specific manifest JSON file. @@ -109,33 +110,22 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'verificationVersion': self._serialize.url("verification_version", verification_version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if version_creation_date is not None: - query_parameters['versionCreationDate'] = self._serialize.query("version_creation_date", version_creation_date, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + verification_version=verification_version, + version_creation_date=version_creation_date, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CloudManifestFileResponse', pipeline_response) @@ -144,4 +134,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/providers/Microsoft.AzureStack/cloudManifestFiles/{verificationVersion}'} # type: ignore + diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_customer_subscriptions_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_customer_subscriptions_operations.py index 08c4a31c8caa..f57dfd05aefa 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_customer_subscriptions_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_customer_subscriptions_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._customer_subscriptions_operations import build_create_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group: str, registration_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.CustomerSubscriptionList"]: """Returns a list of products. @@ -54,8 +60,10 @@ def list( :param registration_name: Name of the Azure Stack registration. :type registration_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomerSubscriptionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestack.models.CustomerSubscriptionList] + :return: An iterator like instance of either CustomerSubscriptionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestack.models.CustomerSubscriptionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomerSubscriptionList"] @@ -63,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CustomerSubscriptionList', pipeline_response) + deserialized = self._deserialize("CustomerSubscriptionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,23 +110,25 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions'} # type: ignore + @distributed_trace_async async def get( self, resource_group: str, registration_name: str, customer_subscription_name: str, - **kwargs + **kwargs: Any ) -> "_models.CustomerSubscription": """Returns the specified product. @@ -141,34 +148,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'customerSubscriptionName': self._serialize.url("customer_subscription_name", customer_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + customer_subscription_name=customer_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CustomerSubscription', pipeline_response) @@ -177,14 +174,17 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group: str, registration_name: str, customer_subscription_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a customer subscription under a registration. @@ -204,34 +204,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'customerSubscriptionName': self._serialize.url("customer_subscription_name", customer_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + customer_subscription_name=customer_subscription_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -239,13 +229,15 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}'} # type: ignore + + @distributed_trace_async async def create( self, resource_group: str, registration_name: str, customer_subscription_name: str, customer_creation_parameters: "_models.CustomerSubscription", - **kwargs + **kwargs: Any ) -> "_models.CustomerSubscription": """Creates a new customer subscription under a registration. @@ -267,39 +259,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'customerSubscriptionName': self._serialize.url("customer_subscription_name", customer_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(customer_creation_parameters, 'CustomerSubscription') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + customer_subscription_name=customer_subscription_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(customer_creation_parameters, 'CustomerSubscription') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CustomerSubscription', pipeline_response) @@ -308,4 +290,6 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}'} # type: ignore + diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_linked_subscriptions_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_linked_subscriptions_operations.py index 095d00e6062b..d7275e76a8b9 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_linked_subscriptions_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_linked_subscriptions_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._linked_subscriptions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,18 +46,21 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource_group( self, resource_group: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.LinkedSubscriptionsList"]: """Returns a list of all linked subscriptions under current resource group. :param resource_group: Name of the resource group. :type resource_group: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LinkedSubscriptionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestack.models.LinkedSubscriptionsList] + :return: An iterator like instance of either LinkedSubscriptionsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestack.models.LinkedSubscriptionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscriptionsList"] @@ -60,35 +68,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('LinkedSubscriptionsList', pipeline_response) + deserialized = self._deserialize("LinkedSubscriptionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,26 +105,30 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions'} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.LinkedSubscriptionsList"]: """Returns a list of all linked subscriptions under current subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LinkedSubscriptionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestack.models.LinkedSubscriptionsList] + :return: An iterator like instance of either LinkedSubscriptionsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestack.models.LinkedSubscriptionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscriptionsList"] @@ -128,34 +136,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('LinkedSubscriptionsList', pipeline_response) + deserialized = self._deserialize("LinkedSubscriptionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -168,22 +171,24 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStack/linkedSubscriptions'} # type: ignore + @distributed_trace_async async def get( self, resource_group: str, linked_subscription_name: str, - **kwargs + **kwargs: Any ) -> "_models.LinkedSubscription": """Returns the properties of a Linked Subscription resource. @@ -201,33 +206,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + linked_subscription_name=linked_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LinkedSubscription', pipeline_response) @@ -236,13 +231,16 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group: str, linked_subscription_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete the requested Linked Subscription resource. @@ -260,33 +258,23 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + linked_subscription_name=linked_subscription_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -294,12 +282,14 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group: str, linked_subscription_name: str, resource: "_models.LinkedSubscriptionParameter", - **kwargs + **kwargs: Any ) -> "_models.LinkedSubscription": """Create or update a linked subscription resource. @@ -319,38 +309,28 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'LinkedSubscriptionParameter') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + linked_subscription_name=linked_subscription_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'LinkedSubscriptionParameter') - 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -363,14 +343,17 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group: str, linked_subscription_name: str, resource: "_models.LinkedSubscriptionParameter", - **kwargs + **kwargs: Any ) -> "_models.LinkedSubscription": """Patch a Linked Subscription resource. @@ -390,38 +373,28 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(resource, 'LinkedSubscriptionParameter') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + linked_subscription_name=linked_subscription_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'LinkedSubscriptionParameter') - 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LinkedSubscription', pipeline_response) @@ -430,4 +403,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_operations.py index a098bc86b52d..05cd96bb2755 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationList"]: """Returns the list of supported REST operations. @@ -57,30 +63,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +96,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_products_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_products_operations.py index 027d75cf82d5..65d157692e3d 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_products_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_products_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._products_operations import build_get_product_request, build_get_products_request, build_get_request, build_list_details_request, build_list_request, build_upload_log_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group: str, registration_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ProductList"]: """Returns a list of products. @@ -63,36 +69,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProductList', pipeline_response) + deserialized = self._deserialize("ProductList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,23 +108,25 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products'} # type: ignore + @distributed_trace_async async def get( self, resource_group: str, registration_name: str, product_name: str, - **kwargs + **kwargs: Any ) -> "_models.Product": """Returns the specified product. @@ -141,34 +146,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'productName': self._serialize.url("product_name", product_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + product_name=product_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Product', pipeline_response) @@ -177,14 +172,17 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}'} # type: ignore + + @distributed_trace_async async def list_details( self, resource_group: str, registration_name: str, product_name: str, - **kwargs + **kwargs: Any ) -> "_models.ExtendedProduct": """Returns the extended properties of a product. @@ -204,34 +202,24 @@ async def list_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'productName': self._serialize.url("product_name", product_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_details_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + product_name=product_name, + template_url=self.list_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtendedProduct', pipeline_response) @@ -240,15 +228,18 @@ async def list_details( return cls(pipeline_response, deserialized, {}) return deserialized + list_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/listDetails'} # type: ignore + + @distributed_trace_async async def get_products( self, resource_group: str, registration_name: str, product_name: str, device_configuration: Optional["_models.DeviceConfiguration"] = None, - **kwargs + **kwargs: Any ) -> "_models.ProductList": """Returns a list of products. @@ -270,42 +261,32 @@ async def get_products( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_products.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'productName': self._serialize.url("product_name", product_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if device_configuration is not None: - body_content = self._serialize.body(device_configuration, 'DeviceConfiguration') + _json = self._serialize.body(device_configuration, 'DeviceConfiguration') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_get_products_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + product_name=product_name, + content_type=content_type, + json=_json, + template_url=self.get_products.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ProductList', pipeline_response) @@ -314,15 +295,18 @@ async def get_products( return cls(pipeline_response, deserialized, {}) return deserialized + get_products.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProducts'} # type: ignore + + @distributed_trace_async async def get_product( self, resource_group: str, registration_name: str, product_name: str, device_configuration: Optional["_models.DeviceConfiguration"] = None, - **kwargs + **kwargs: Any ) -> "_models.Product": """Returns the specified product. @@ -344,42 +328,32 @@ async def get_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_product.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'productName': self._serialize.url("product_name", product_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if device_configuration is not None: - body_content = self._serialize.body(device_configuration, 'DeviceConfiguration') + _json = self._serialize.body(device_configuration, 'DeviceConfiguration') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_get_product_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + product_name=product_name, + content_type=content_type, + json=_json, + template_url=self.get_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Product', pipeline_response) @@ -388,15 +362,18 @@ async def get_product( return cls(pipeline_response, deserialized, {}) return deserialized + get_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProduct'} # type: ignore + + @distributed_trace_async async def upload_log( self, resource_group: str, registration_name: str, product_name: str, marketplace_product_log_update: Optional["_models.MarketplaceProductLogUpdate"] = None, - **kwargs + **kwargs: Any ) -> "_models.ProductLog": """Returns the specified product. @@ -418,42 +395,32 @@ async def upload_log( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_log.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'productName': self._serialize.url("product_name", product_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if marketplace_product_log_update is not None: - body_content = self._serialize.body(marketplace_product_log_update, 'MarketplaceProductLogUpdate') + _json = self._serialize.body(marketplace_product_log_update, 'MarketplaceProductLogUpdate') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_upload_log_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + product_name=product_name, + content_type=content_type, + json=_json, + template_url=self.upload_log.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ProductLog', pipeline_response) @@ -462,4 +429,6 @@ async def upload_log( return cls(pipeline_response, deserialized, {}) return deserialized + upload_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/uploadProductLog'} # type: ignore + diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_registrations_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_registrations_operations.py index 2f2131c73c71..cde63935584d 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_registrations_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_registrations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registrations_operations import build_create_or_update_request, build_delete_request, build_enable_remote_management_request, build_get_activation_key_request, build_get_request, build_list_by_subscription_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,10 +46,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RegistrationList"]: """Returns a list of all registrations. @@ -60,35 +66,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegistrationList', pipeline_response) + deserialized = self._deserialize("RegistrationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,22 +103,88 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations'} # type: ignore + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.RegistrationList"]: + """Returns a list of all registrations under current subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegistrationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestack.models.RegistrationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistrationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RegistrationList", 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStack/registrations'} # type: ignore + + @distributed_trace_async async def get( self, resource_group: str, registration_name: str, - **kwargs + **kwargs: Any ) -> "_models.Registration": """Returns the properties of an Azure Stack registration. @@ -134,33 +202,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Registration', pipeline_response) @@ -169,13 +227,16 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group: str, registration_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete the requested Azure Stack registration. @@ -193,33 +254,23 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -227,12 +278,14 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group: str, registration_name: str, token: "_models.RegistrationParameter", - **kwargs + **kwargs: Any ) -> "_models.Registration": """Create or update an Azure Stack registration. @@ -252,38 +305,28 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token, 'RegistrationParameter') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token, 'RegistrationParameter') - 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -296,14 +339,17 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group: str, registration_name: str, token: "_models.RegistrationParameter", - **kwargs + **kwargs: Any ) -> "_models.Registration": """Patch an Azure Stack registration. @@ -323,38 +369,28 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token, 'RegistrationParameter') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token, 'RegistrationParameter') - 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Registration', pipeline_response) @@ -363,13 +399,16 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'} # type: ignore + + @distributed_trace_async async def get_activation_key( self, resource_group: str, registration_name: str, - **kwargs + **kwargs: Any ) -> "_models.ActivationKeyResult": """Returns Azure Stack Activation Key. @@ -387,33 +426,23 @@ async def get_activation_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_activation_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_activation_key_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.get_activation_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivationKeyResult', pipeline_response) @@ -422,13 +451,16 @@ async def get_activation_key( return cls(pipeline_response, deserialized, {}) return deserialized + get_activation_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/getactivationkey'} # type: ignore + + @distributed_trace_async async def enable_remote_management( self, resource_group: str, registration_name: str, - **kwargs + **kwargs: Any ) -> None: """Enables remote management for device under the Azure Stack registration. @@ -446,34 +478,27 @@ async def enable_remote_management( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/json" - - # Construct URL - url = self.enable_remote_management.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_remote_management_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.enable_remote_management.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) enable_remote_management.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/enableRemoteManagement'} # type: ignore + diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/__init__.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/__init__.py index 5a9d84253069..b120908d1685 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/__init__.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/__init__.py @@ -6,78 +6,42 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ActivationKeyResult - from ._models_py3 import CloudManifestFileDeploymentData - from ._models_py3 import CloudManifestFileProperties - from ._models_py3 import CloudManifestFileResponse - from ._models_py3 import Compatibility - from ._models_py3 import CustomerSubscription - from ._models_py3 import CustomerSubscriptionList - from ._models_py3 import DataDiskImage - from ._models_py3 import DeviceConfiguration - from ._models_py3 import Display - from ._models_py3 import ErrorDetails - from ._models_py3 import ErrorResponse - from ._models_py3 import ExtendedProduct - from ._models_py3 import ExtendedProductProperties - from ._models_py3 import IconUris - from ._models_py3 import LinkedSubscription - from ._models_py3 import LinkedSubscriptionParameter - from ._models_py3 import LinkedSubscriptionsList - from ._models_py3 import MarketplaceProductLogUpdate - from ._models_py3 import Operation - from ._models_py3 import OperationList - from ._models_py3 import OsDiskImage - from ._models_py3 import Product - from ._models_py3 import ProductLink - from ._models_py3 import ProductList - from ._models_py3 import ProductLog - from ._models_py3 import ProductProperties - from ._models_py3 import Registration - from ._models_py3 import RegistrationList - from ._models_py3 import RegistrationParameter - from ._models_py3 import Resource - from ._models_py3 import SystemData - from ._models_py3 import TrackedResource - from ._models_py3 import VirtualMachineExtensionProductProperties - from ._models_py3 import VirtualMachineProductProperties -except (SyntaxError, ImportError): - from ._models import ActivationKeyResult # type: ignore - from ._models import CloudManifestFileDeploymentData # type: ignore - from ._models import CloudManifestFileProperties # type: ignore - from ._models import CloudManifestFileResponse # type: ignore - from ._models import Compatibility # type: ignore - from ._models import CustomerSubscription # type: ignore - from ._models import CustomerSubscriptionList # type: ignore - from ._models import DataDiskImage # type: ignore - from ._models import DeviceConfiguration # type: ignore - from ._models import Display # type: ignore - from ._models import ErrorDetails # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ExtendedProduct # type: ignore - from ._models import ExtendedProductProperties # type: ignore - from ._models import IconUris # type: ignore - from ._models import LinkedSubscription # type: ignore - from ._models import LinkedSubscriptionParameter # type: ignore - from ._models import LinkedSubscriptionsList # type: ignore - from ._models import MarketplaceProductLogUpdate # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationList # type: ignore - from ._models import OsDiskImage # type: ignore - from ._models import Product # type: ignore - from ._models import ProductLink # type: ignore - from ._models import ProductList # type: ignore - from ._models import ProductLog # type: ignore - from ._models import ProductProperties # type: ignore - from ._models import Registration # type: ignore - from ._models import RegistrationList # type: ignore - from ._models import RegistrationParameter # type: ignore - from ._models import Resource # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import VirtualMachineExtensionProductProperties # type: ignore - from ._models import VirtualMachineProductProperties # type: ignore +from ._models_py3 import ActivationKeyResult +from ._models_py3 import CloudManifestFileDeploymentData +from ._models_py3 import CloudManifestFileProperties +from ._models_py3 import CloudManifestFileResponse +from ._models_py3 import Compatibility +from ._models_py3 import CustomerSubscription +from ._models_py3 import CustomerSubscriptionList +from ._models_py3 import DataDiskImage +from ._models_py3 import DeviceConfiguration +from ._models_py3 import Display +from ._models_py3 import ErrorDetails +from ._models_py3 import ErrorResponse +from ._models_py3 import ExtendedProduct +from ._models_py3 import ExtendedProductProperties +from ._models_py3 import IconUris +from ._models_py3 import LinkedSubscription +from ._models_py3 import LinkedSubscriptionParameter +from ._models_py3 import LinkedSubscriptionsList +from ._models_py3 import MarketplaceProductLogUpdate +from ._models_py3 import Operation +from ._models_py3 import OperationList +from ._models_py3 import OsDiskImage +from ._models_py3 import Product +from ._models_py3 import ProductLink +from ._models_py3 import ProductList +from ._models_py3 import ProductLog +from ._models_py3 import ProductProperties +from ._models_py3 import Registration +from ._models_py3 import RegistrationList +from ._models_py3 import RegistrationParameter +from ._models_py3 import Resource +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import VirtualMachineExtensionProductProperties +from ._models_py3 import VirtualMachineProductProperties + from ._azure_stack_management_client_enums import ( Category, diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_azure_stack_management_client_enums.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_azure_stack_management_client_enums.py index 44c8218635a0..f271fba7b2f7 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_azure_stack_management_client_enums.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_azure_stack_management_client_enums.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class Category(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Category(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Identity system of the device. """ AZURE_AD = "AzureAD" ADFS = "ADFS" -class CompatibilityIssue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CompatibilityIssue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Compatibility issue """ @@ -48,7 +33,7 @@ class CompatibilityIssue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CONNECTION_TO_AZURE_REQUIRED = "ConnectionToAzureRequired" DISCONNECTED_ENVIRONMENT_REQUIRED = "DisconnectedEnvironmentRequired" -class ComputeRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComputeRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Compute role type (IaaS or PaaS). """ @@ -56,7 +41,7 @@ class ComputeRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): IAA_S = "IaaS" PAA_S = "PaaS" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -65,13 +50,13 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Location(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Location(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Location of the resource. """ GLOBAL_ENUM = "global" -class OperatingSystem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatingSystem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Operating system type (Windows or Linux). """ @@ -79,7 +64,7 @@ class OperatingSystem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WINDOWS = "Windows" LINUX = "Linux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource. """ diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models.py deleted file mode 100644 index 827ca6dadb46..000000000000 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models.py +++ /dev/null @@ -1,1430 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class ActivationKeyResult(msrest.serialization.Model): - """The resource containing the Azure Stack activation key. - - :param activation_key: Azure Stack activation key. - :type activation_key: str - """ - - _attribute_map = { - 'activation_key': {'key': 'activationKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ActivationKeyResult, self).__init__(**kwargs) - self.activation_key = kwargs.get('activation_key', None) - - -class CloudManifestFileDeploymentData(msrest.serialization.Model): - """Cloud specific manifest data for AzureStack deployment. - - :param external_dsms_certificates: Dsms external certificates. - :type external_dsms_certificates: str - :param custom_cloud_verification_key: Signing verification public key. - :type custom_cloud_verification_key: str - :param custom_cloud_arm_endpoint: ARM endpoint. - :type custom_cloud_arm_endpoint: str - :param external_dsms_endpoint: Dsms endpoint. - :type external_dsms_endpoint: str - """ - - _attribute_map = { - 'external_dsms_certificates': {'key': 'externalDsmsCertificates', 'type': 'str'}, - 'custom_cloud_verification_key': {'key': 'customCloudVerificationKey', 'type': 'str'}, - 'custom_cloud_arm_endpoint': {'key': 'customEnvironmentEndpoints.customCloudArmEndpoint', 'type': 'str'}, - 'external_dsms_endpoint': {'key': 'customEnvironmentEndpoints.externalDsmsEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudManifestFileDeploymentData, self).__init__(**kwargs) - self.external_dsms_certificates = kwargs.get('external_dsms_certificates', None) - self.custom_cloud_verification_key = kwargs.get('custom_cloud_verification_key', None) - self.custom_cloud_arm_endpoint = kwargs.get('custom_cloud_arm_endpoint', None) - self.external_dsms_endpoint = kwargs.get('external_dsms_endpoint', None) - - -class CloudManifestFileProperties(msrest.serialization.Model): - """Cloud specific manifest JSON properties. - - :param deployment_data: Cloud specific manifest data. - :type deployment_data: ~azure.mgmt.azurestack.models.CloudManifestFileDeploymentData - :param signature: Signature of the cloud specific manifest data. - :type signature: str - """ - - _attribute_map = { - 'deployment_data': {'key': 'deploymentData', 'type': 'CloudManifestFileDeploymentData'}, - 'signature': {'key': 'signature', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudManifestFileProperties, self).__init__(**kwargs) - self.deployment_data = kwargs.get('deployment_data', None) - self.signature = kwargs.get('signature', None) - - -class Resource(msrest.serialization.Model): - """Base resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: ID of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of Resource. - :vartype type: str - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = kwargs.get('etag', None) - - -class CloudManifestFileResponse(Resource): - """Cloud specific manifest GET response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: ID of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of Resource. - :vartype type: str - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - :param properties: Cloud specific manifest data. - :type properties: ~azure.mgmt.azurestack.models.CloudManifestFileProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'CloudManifestFileProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudManifestFileResponse, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class Compatibility(msrest.serialization.Model): - """Product compatibility. - - :param is_compatible: Tells if product is compatible with current device. - :type is_compatible: bool - :param message: Short error message if any compatibility issues are found. - :type message: str - :param description: Full error message if any compatibility issues are found. - :type description: str - :param issues: List of all issues found. - :type issues: list[str or ~azure.mgmt.azurestack.models.CompatibilityIssue] - """ - - _attribute_map = { - 'is_compatible': {'key': 'isCompatible', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'issues': {'key': 'issues', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Compatibility, self).__init__(**kwargs) - self.is_compatible = kwargs.get('is_compatible', None) - self.message = kwargs.get('message', None) - self.description = kwargs.get('description', None) - self.issues = kwargs.get('issues', None) - - -class CustomerSubscription(Resource): - """Customer subscription. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: ID of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of Resource. - :vartype type: str - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestack.models.SystemData - :param tenant_id: Tenant Id. - :type tenant_id: str - """ - - _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'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomerSubscription, self).__init__(**kwargs) - self.system_data = None - self.tenant_id = kwargs.get('tenant_id', None) - - -class CustomerSubscriptionList(msrest.serialization.Model): - """Pageable list of customer subscriptions. - - :param next_link: URI to the next page. - :type next_link: str - :param value: List of customer subscriptions. - :type value: list[~azure.mgmt.azurestack.models.CustomerSubscription] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[CustomerSubscription]'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomerSubscriptionList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class DataDiskImage(msrest.serialization.Model): - """Data disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar lun: The LUN. - :vartype lun: int - :ivar source_blob_sas_uri: SAS key for source blob. - :vartype source_blob_sas_uri: str - """ - - _validation = { - 'lun': {'readonly': True}, - 'source_blob_sas_uri': {'readonly': True}, - } - - _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - 'source_blob_sas_uri': {'key': 'sourceBlobSasUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataDiskImage, self).__init__(**kwargs) - self.lun = None - self.source_blob_sas_uri = None - - -class DeviceConfiguration(msrest.serialization.Model): - """Device Configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar device_version: Version of the device. - :vartype device_version: str - :ivar identity_system: Identity system of the device. Possible values include: "AzureAD", - "ADFS". - :vartype identity_system: str or ~azure.mgmt.azurestack.models.Category - """ - - _validation = { - 'device_version': {'readonly': True}, - 'identity_system': {'readonly': True}, - } - - _attribute_map = { - 'device_version': {'key': 'deviceVersion', 'type': 'str'}, - 'identity_system': {'key': 'identitySystem', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeviceConfiguration, self).__init__(**kwargs) - self.device_version = None - self.identity_system = None - - -class Display(msrest.serialization.Model): - """Contains the localized display information for this particular operation or action. - - :param provider: The localized, friendly version of the resource provider name. - :type provider: str - :param resource: The localized, friendly version of the resource type related to this action or - operation; the resource type should match the public documentation for the resource provider. - :type resource: str - :param operation: The localized, friendly name for the operation. Use the name as it will - displayed to the user. - :type operation: str - :param description: The localized, friendly description for the operation. The description will - be displayed to the user. It should be thorough and concise for used in both tooltips and - detailed views. - :type description: str - """ - - _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(Display, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class ErrorDetails(msrest.serialization.Model): - """The details of the error. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - :ivar target: The target of the particular error. - :vartype target: str - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetails, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - - -class ErrorResponse(msrest.serialization.Model): - """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. - - :param error: The details of the error. - :type error: ~azure.mgmt.azurestack.models.ErrorDetails - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ExtendedProduct(msrest.serialization.Model): - """Extended description about the product required for installing it into Azure Stack. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar gallery_package_blob_sas_uri: The URI to the .azpkg file that provides information - required for showing product in the gallery. - :vartype gallery_package_blob_sas_uri: str - :ivar product_kind: Specifies the kind of the product (virtualMachine or - virtualMachineExtension). - :vartype product_kind: str - :ivar compute_role: Specifies kind of compute role included in the package. Possible values - include: "None", "IaaS", "PaaS". - :vartype compute_role: str or ~azure.mgmt.azurestack.models.ComputeRole - :ivar is_system_extension: Specifies if product is a Virtual Machine Extension. - :vartype is_system_extension: bool - :ivar support_multiple_extensions: Indicates if specified product supports multiple extensions. - :vartype support_multiple_extensions: bool - :ivar version_properties_version: Specifies product version. - :vartype version_properties_version: str - :ivar vm_os_type: Specifies operating system used by the product. Possible values include: - "None", "Windows", "Linux". - :vartype vm_os_type: str or ~azure.mgmt.azurestack.models.OperatingSystem - :ivar vm_scale_set_enabled: Indicates if virtual machine Scale Set is enabled in the specified - product. - :vartype vm_scale_set_enabled: bool - :ivar uri: The URI. - :vartype uri: str - :ivar version: Specifies product version. - :vartype version: str - :ivar os_disk_image: OS disk image used by product. - :vartype os_disk_image: ~azure.mgmt.azurestack.models.OsDiskImage - :ivar data_disk_images: List of attached data disks. - :vartype data_disk_images: list[~azure.mgmt.azurestack.models.DataDiskImage] - """ - - _validation = { - 'gallery_package_blob_sas_uri': {'readonly': True}, - 'product_kind': {'readonly': True}, - 'compute_role': {'readonly': True}, - 'is_system_extension': {'readonly': True}, - 'support_multiple_extensions': {'readonly': True}, - 'version_properties_version': {'readonly': True}, - 'vm_os_type': {'readonly': True}, - 'vm_scale_set_enabled': {'readonly': True}, - 'uri': {'readonly': True}, - 'version': {'readonly': True}, - 'os_disk_image': {'readonly': True}, - 'data_disk_images': {'readonly': True}, - } - - _attribute_map = { - 'gallery_package_blob_sas_uri': {'key': 'galleryPackageBlobSasUri', 'type': 'str'}, - 'product_kind': {'key': 'productKind', 'type': 'str'}, - 'compute_role': {'key': 'properties.computeRole', 'type': 'str'}, - 'is_system_extension': {'key': 'properties.isSystemExtension', 'type': 'bool'}, - 'support_multiple_extensions': {'key': 'properties.supportMultipleExtensions', 'type': 'bool'}, - 'version_properties_version': {'key': 'properties.version', 'type': 'str'}, - 'vm_os_type': {'key': 'properties.vmOsType', 'type': 'str'}, - 'vm_scale_set_enabled': {'key': 'properties.vmScaleSetEnabled', 'type': 'bool'}, - 'uri': {'key': 'properties.sourceBlob.uri', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'os_disk_image': {'key': 'properties.osDiskImage', 'type': 'OsDiskImage'}, - 'data_disk_images': {'key': 'properties.dataDiskImages', 'type': '[DataDiskImage]'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedProduct, self).__init__(**kwargs) - self.gallery_package_blob_sas_uri = None - self.product_kind = None - self.compute_role = None - self.is_system_extension = None - self.support_multiple_extensions = None - self.version_properties_version = None - self.vm_os_type = None - self.vm_scale_set_enabled = None - self.uri = None - self.version = None - self.os_disk_image = None - self.data_disk_images = None - - -class VirtualMachineProductProperties(msrest.serialization.Model): - """Product information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: Specifies product version. - :vartype version: str - :ivar os_disk_image: OS disk image used by product. - :vartype os_disk_image: ~azure.mgmt.azurestack.models.OsDiskImage - :ivar data_disk_images: List of attached data disks. - :vartype data_disk_images: list[~azure.mgmt.azurestack.models.DataDiskImage] - """ - - _validation = { - 'version': {'readonly': True}, - 'os_disk_image': {'readonly': True}, - 'data_disk_images': {'readonly': True}, - } - - _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'os_disk_image': {'key': 'osDiskImage', 'type': 'OsDiskImage'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[DataDiskImage]'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineProductProperties, self).__init__(**kwargs) - self.version = None - self.os_disk_image = None - self.data_disk_images = None - - -class VirtualMachineExtensionProductProperties(msrest.serialization.Model): - """Product information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compute_role: Specifies kind of compute role included in the package. Possible values - include: "None", "IaaS", "PaaS". - :vartype compute_role: str or ~azure.mgmt.azurestack.models.ComputeRole - :ivar is_system_extension: Specifies if product is a Virtual Machine Extension. - :vartype is_system_extension: bool - :ivar support_multiple_extensions: Indicates if specified product supports multiple extensions. - :vartype support_multiple_extensions: bool - :ivar version: Specifies product version. - :vartype version: str - :ivar vm_os_type: Specifies operating system used by the product. Possible values include: - "None", "Windows", "Linux". - :vartype vm_os_type: str or ~azure.mgmt.azurestack.models.OperatingSystem - :ivar vm_scale_set_enabled: Indicates if virtual machine Scale Set is enabled in the specified - product. - :vartype vm_scale_set_enabled: bool - :ivar uri: The URI. - :vartype uri: str - """ - - _validation = { - 'compute_role': {'readonly': True}, - 'is_system_extension': {'readonly': True}, - 'support_multiple_extensions': {'readonly': True}, - 'version': {'readonly': True}, - 'vm_os_type': {'readonly': True}, - 'vm_scale_set_enabled': {'readonly': True}, - 'uri': {'readonly': True}, - } - - _attribute_map = { - 'compute_role': {'key': 'computeRole', 'type': 'str'}, - 'is_system_extension': {'key': 'isSystemExtension', 'type': 'bool'}, - 'support_multiple_extensions': {'key': 'supportMultipleExtensions', 'type': 'bool'}, - 'version': {'key': 'version', 'type': 'str'}, - 'vm_os_type': {'key': 'vmOsType', 'type': 'str'}, - 'vm_scale_set_enabled': {'key': 'vmScaleSetEnabled', 'type': 'bool'}, - 'uri': {'key': 'sourceBlob.uri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualMachineExtensionProductProperties, self).__init__(**kwargs) - self.compute_role = None - self.is_system_extension = None - self.support_multiple_extensions = None - self.version = None - self.vm_os_type = None - self.vm_scale_set_enabled = None - self.uri = None - - -class ExtendedProductProperties(VirtualMachineExtensionProductProperties, VirtualMachineProductProperties): - """Product information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar os_disk_image: OS disk image used by product. - :vartype os_disk_image: ~azure.mgmt.azurestack.models.OsDiskImage - :ivar data_disk_images: List of attached data disks. - :vartype data_disk_images: list[~azure.mgmt.azurestack.models.DataDiskImage] - :ivar compute_role: Specifies kind of compute role included in the package. Possible values - include: "None", "IaaS", "PaaS". - :vartype compute_role: str or ~azure.mgmt.azurestack.models.ComputeRole - :ivar is_system_extension: Specifies if product is a Virtual Machine Extension. - :vartype is_system_extension: bool - :ivar support_multiple_extensions: Indicates if specified product supports multiple extensions. - :vartype support_multiple_extensions: bool - :ivar version: Specifies product version. - :vartype version: str - :ivar vm_os_type: Specifies operating system used by the product. Possible values include: - "None", "Windows", "Linux". - :vartype vm_os_type: str or ~azure.mgmt.azurestack.models.OperatingSystem - :ivar vm_scale_set_enabled: Indicates if virtual machine Scale Set is enabled in the specified - product. - :vartype vm_scale_set_enabled: bool - :ivar uri: The URI. - :vartype uri: str - """ - - _validation = { - 'os_disk_image': {'readonly': True}, - 'data_disk_images': {'readonly': True}, - 'compute_role': {'readonly': True}, - 'is_system_extension': {'readonly': True}, - 'support_multiple_extensions': {'readonly': True}, - 'version': {'readonly': True}, - 'vm_os_type': {'readonly': True}, - 'vm_scale_set_enabled': {'readonly': True}, - 'uri': {'readonly': True}, - } - - _attribute_map = { - 'os_disk_image': {'key': 'osDiskImage', 'type': 'OsDiskImage'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[DataDiskImage]'}, - 'compute_role': {'key': 'computeRole', 'type': 'str'}, - 'is_system_extension': {'key': 'isSystemExtension', 'type': 'bool'}, - 'support_multiple_extensions': {'key': 'supportMultipleExtensions', 'type': 'bool'}, - 'version': {'key': 'version', 'type': 'str'}, - 'vm_os_type': {'key': 'vmOsType', 'type': 'str'}, - 'vm_scale_set_enabled': {'key': 'vmScaleSetEnabled', 'type': 'bool'}, - 'uri': {'key': 'sourceBlob.uri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedProductProperties, self).__init__(**kwargs) - self.os_disk_image = None - self.data_disk_images = None - self.compute_role = None - self.is_system_extension = None - self.support_multiple_extensions = None - self.version = None - self.vm_os_type = None - self.vm_scale_set_enabled = None - self.uri = None - - -class IconUris(msrest.serialization.Model): - """Links to product icons. - - :param large: URI to large icon. - :type large: str - :param wide: URI to wide icon. - :type wide: str - :param medium: URI to medium icon. - :type medium: str - :param small: URI to small icon. - :type small: str - :param hero: URI to hero icon. - :type hero: str - """ - - _attribute_map = { - 'large': {'key': 'large', 'type': 'str'}, - 'wide': {'key': 'wide', 'type': 'str'}, - 'medium': {'key': 'medium', 'type': 'str'}, - 'small': {'key': 'small', 'type': 'str'}, - 'hero': {'key': 'hero', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IconUris, self).__init__(**kwargs) - self.large = kwargs.get('large', None) - self.wide = kwargs.get('wide', None) - self.medium = kwargs.get('medium', None) - self.small = kwargs.get('small', None) - self.hero = kwargs.get('hero', None) - - -class TrackedResource(msrest.serialization.Model): - """Base resource object. - - 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: ID of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of Resource. - :vartype type: str - :ivar kind: The kind of the resource. - :vartype kind: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestack.models.SystemData - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param tags: A set of tags. Custom tags for the resource. - :type tags: dict[str, str] - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'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'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.kind = None - self.system_data = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.etag = kwargs.get('etag', None) - - -class LinkedSubscription(TrackedResource): - """Linked Subscription information. - - 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: ID of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of Resource. - :vartype type: str - :ivar kind: The kind of the resource. - :vartype kind: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestack.models.SystemData - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param tags: A set of tags. Custom tags for the resource. - :type tags: dict[str, str] - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - :param linked_subscription_id: The identifier associated with the device subscription. - :type linked_subscription_id: str - :param registration_resource_id: The identifier associated with the device registration. - :type registration_resource_id: str - :ivar device_id: The identifier of the Azure Stack device for remote management. - :vartype device_id: str - :ivar device_object_id: The object identifier associated with the Azure Stack device connecting - to Azure. - :vartype device_object_id: str - :ivar device_link_state: The connection state of the Azure Stack device. - :vartype device_link_state: str - :ivar last_connected_time: The last remote management connection time for the Azure Stack - device connected to the linked subscription resource. - :vartype last_connected_time: str - :ivar device_connection_status: The status of the remote management connection of the Azure - Stack device. - :vartype device_connection_status: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'device_id': {'readonly': True}, - 'device_object_id': {'readonly': True}, - 'device_link_state': {'readonly': True}, - 'last_connected_time': {'readonly': True}, - 'device_connection_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'linked_subscription_id': {'key': 'properties.linkedSubscriptionId', 'type': 'str'}, - 'registration_resource_id': {'key': 'properties.registrationResourceId', 'type': 'str'}, - 'device_id': {'key': 'properties.deviceId', 'type': 'str'}, - 'device_object_id': {'key': 'properties.deviceObjectId', 'type': 'str'}, - 'device_link_state': {'key': 'properties.deviceLinkState', 'type': 'str'}, - 'last_connected_time': {'key': 'properties.lastConnectedTime', 'type': 'str'}, - 'device_connection_status': {'key': 'properties.deviceConnectionStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LinkedSubscription, self).__init__(**kwargs) - self.linked_subscription_id = kwargs.get('linked_subscription_id', None) - self.registration_resource_id = kwargs.get('registration_resource_id', None) - self.device_id = None - self.device_object_id = None - self.device_link_state = None - self.last_connected_time = None - self.device_connection_status = None - - -class LinkedSubscriptionParameter(msrest.serialization.Model): - """Linked Subscription resource. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param linked_subscription_id: Required. The identifier associated with the device - subscription. - :type linked_subscription_id: str - :param registration_resource_id: Required. The identifier associated with the device - registration. - :type registration_resource_id: str - """ - - _validation = { - 'location': {'required': True}, - 'linked_subscription_id': {'required': True}, - 'registration_resource_id': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'linked_subscription_id': {'key': 'properties.linkedSubscriptionId', 'type': 'str'}, - 'registration_resource_id': {'key': 'properties.registrationResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LinkedSubscriptionParameter, self).__init__(**kwargs) - self.location = kwargs['location'] - self.linked_subscription_id = kwargs['linked_subscription_id'] - self.registration_resource_id = kwargs['registration_resource_id'] - - -class LinkedSubscriptionsList(msrest.serialization.Model): - """List of linked subscriptions with paging support. - - :param next_link: URI to the next page. - :type next_link: str - :param value: List of Linked Subscriptions. - :type value: list[~azure.mgmt.azurestack.models.LinkedSubscription] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[LinkedSubscription]'}, - } - - def __init__( - self, - **kwargs - ): - super(LinkedSubscriptionsList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class MarketplaceProductLogUpdate(msrest.serialization.Model): - """Update details for product log. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation: Operation to log. - :vartype operation: str - :ivar status: Operation status to log. - :vartype status: str - :ivar error: Error related to the operation. - :vartype error: str - :ivar details: Error details related to operation. - :vartype details: str - """ - - _validation = { - 'operation': {'readonly': True}, - 'status': {'readonly': True}, - 'error': {'readonly': True}, - 'details': {'readonly': True}, - } - - _attribute_map = { - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MarketplaceProductLogUpdate, self).__init__(**kwargs) - self.operation = None - self.status = None - self.error = None - self.details = None - - -class Operation(msrest.serialization.Model): - """Describes the supported REST operation. - - :param name: The name of the operation being performed on this particular object. - :type name: str - :param display: Contains the localized display information for this particular operation or - action. - :type display: ~azure.mgmt.azurestack.models.Display - :param origin: The intended executor of the operation. - :type origin: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'Display'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - - -class OperationList(msrest.serialization.Model): - """List of Operations. - - :param value: Array of operations. - :type value: list[~azure.mgmt.azurestack.models.Operation] - :param next_link: URI to the next page of operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OsDiskImage(msrest.serialization.Model): - """OS disk image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operating_system: OS operating system type. Possible values include: "None", "Windows", - "Linux". - :vartype operating_system: str or ~azure.mgmt.azurestack.models.OperatingSystem - :ivar source_blob_sas_uri: SAS key for source blob. - :vartype source_blob_sas_uri: str - """ - - _validation = { - 'operating_system': {'readonly': True}, - 'source_blob_sas_uri': {'readonly': True}, - } - - _attribute_map = { - 'operating_system': {'key': 'operatingSystem', 'type': 'str'}, - 'source_blob_sas_uri': {'key': 'sourceBlobSasUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OsDiskImage, self).__init__(**kwargs) - self.operating_system = None - self.source_blob_sas_uri = None - - -class Product(Resource): - """Product information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: ID of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of Resource. - :vartype type: str - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestack.models.SystemData - :param display_name: The display name of the product. - :type display_name: str - :param description: The description of the product. - :type description: str - :param publisher_display_name: The user-friendly name of the product publisher. - :type publisher_display_name: str - :param publisher_identifier: Publisher identifier. - :type publisher_identifier: str - :param offer: The offer representing the product. - :type offer: str - :param offer_version: The version of the product offer. - :type offer_version: str - :param sku: The product SKU. - :type sku: str - :param billing_part_number: The part number used for billing purposes. - :type billing_part_number: str - :param vm_extension_type: The type of the Virtual Machine Extension. - :type vm_extension_type: str - :param gallery_item_identity: The identifier of the gallery item corresponding to the product. - :type gallery_item_identity: str - :param icon_uris: Additional links available for this product. - :type icon_uris: ~azure.mgmt.azurestack.models.IconUris - :param links: Additional links available for this product. - :type links: list[~azure.mgmt.azurestack.models.ProductLink] - :param legal_terms: The legal terms. - :type legal_terms: str - :param privacy_policy: The privacy policy. - :type privacy_policy: str - :param payload_length: The length of product content. - :type payload_length: long - :param product_kind: The kind of the product (virtualMachine or virtualMachineExtension). - :type product_kind: str - :param product_properties: Additional properties for the product. - :type product_properties: ~azure.mgmt.azurestack.models.ProductProperties - :param compatibility: Product compatibility with current device. - :type compatibility: ~azure.mgmt.azurestack.models.Compatibility - """ - - _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'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'publisher_display_name': {'key': 'properties.publisherDisplayName', 'type': 'str'}, - 'publisher_identifier': {'key': 'properties.publisherIdentifier', 'type': 'str'}, - 'offer': {'key': 'properties.offer', 'type': 'str'}, - 'offer_version': {'key': 'properties.offerVersion', 'type': 'str'}, - 'sku': {'key': 'properties.sku', 'type': 'str'}, - 'billing_part_number': {'key': 'properties.billingPartNumber', 'type': 'str'}, - 'vm_extension_type': {'key': 'properties.vmExtensionType', 'type': 'str'}, - 'gallery_item_identity': {'key': 'properties.galleryItemIdentity', 'type': 'str'}, - 'icon_uris': {'key': 'properties.iconUris', 'type': 'IconUris'}, - 'links': {'key': 'properties.links', 'type': '[ProductLink]'}, - 'legal_terms': {'key': 'properties.legalTerms', 'type': 'str'}, - 'privacy_policy': {'key': 'properties.privacyPolicy', 'type': 'str'}, - 'payload_length': {'key': 'properties.payloadLength', 'type': 'long'}, - 'product_kind': {'key': 'properties.productKind', 'type': 'str'}, - 'product_properties': {'key': 'properties.productProperties', 'type': 'ProductProperties'}, - 'compatibility': {'key': 'properties.compatibility', 'type': 'Compatibility'}, - } - - def __init__( - self, - **kwargs - ): - super(Product, self).__init__(**kwargs) - self.system_data = None - self.display_name = kwargs.get('display_name', None) - self.description = kwargs.get('description', None) - self.publisher_display_name = kwargs.get('publisher_display_name', None) - self.publisher_identifier = kwargs.get('publisher_identifier', None) - self.offer = kwargs.get('offer', None) - self.offer_version = kwargs.get('offer_version', None) - self.sku = kwargs.get('sku', None) - self.billing_part_number = kwargs.get('billing_part_number', None) - self.vm_extension_type = kwargs.get('vm_extension_type', None) - self.gallery_item_identity = kwargs.get('gallery_item_identity', None) - self.icon_uris = kwargs.get('icon_uris', None) - self.links = kwargs.get('links', None) - self.legal_terms = kwargs.get('legal_terms', None) - self.privacy_policy = kwargs.get('privacy_policy', None) - self.payload_length = kwargs.get('payload_length', None) - self.product_kind = kwargs.get('product_kind', None) - self.product_properties = kwargs.get('product_properties', None) - self.compatibility = kwargs.get('compatibility', None) - - -class ProductLink(msrest.serialization.Model): - """Link with additional information about a product. - - :param display_name: The description of the link. - :type display_name: str - :param uri: The URI corresponding to the link. - :type uri: str - """ - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProductLink, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.uri = kwargs.get('uri', None) - - -class ProductList(msrest.serialization.Model): - """Pageable list of products. - - :param next_link: URI to the next page. - :type next_link: str - :param value: List of products. - :type value: list[~azure.mgmt.azurestack.models.Product] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Product]'}, - } - - def __init__( - self, - **kwargs - ): - super(ProductList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class ProductLog(msrest.serialization.Model): - """Product action log. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Log ID. - :vartype id: str - :ivar product_id: Logged product ID. - :vartype product_id: str - :ivar subscription_id: Logged subscription ID. - :vartype subscription_id: str - :ivar registration_name: Logged registration name. - :vartype registration_name: str - :ivar resource_group_name: Logged resource group name. - :vartype resource_group_name: str - :ivar operation: Logged operation. - :vartype operation: str - :ivar start_date: Operation start datetime. - :vartype start_date: str - :ivar end_date: Operation end datetime. - :vartype end_date: str - :ivar status: Operation status. - :vartype status: str - :ivar error: Operation error data. - :vartype error: str - :ivar details: Operation error details. - :vartype details: str - """ - - _validation = { - 'id': {'readonly': True}, - 'product_id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'registration_name': {'readonly': True}, - 'resource_group_name': {'readonly': True}, - 'operation': {'readonly': True}, - 'start_date': {'readonly': True}, - 'end_date': {'readonly': True}, - 'status': {'readonly': True}, - 'error': {'readonly': True}, - 'details': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'product_id': {'key': 'productId', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'registration_name': {'key': 'registrationName', 'type': 'str'}, - 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'start_date': {'key': 'startDate', 'type': 'str'}, - 'end_date': {'key': 'endDate', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProductLog, self).__init__(**kwargs) - self.id = None - self.product_id = None - self.subscription_id = None - self.registration_name = None - self.resource_group_name = None - self.operation = None - self.start_date = None - self.end_date = None - self.status = None - self.error = None - self.details = None - - -class ProductProperties(msrest.serialization.Model): - """Additional properties of the product. - - :param version: The version. - :type version: str - """ - - _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProductProperties, self).__init__(**kwargs) - self.version = kwargs.get('version', None) - - -class Registration(TrackedResource): - """Registration information. - - 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: ID of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of Resource. - :vartype type: str - :ivar kind: The kind of the resource. - :vartype kind: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.azurestack.models.SystemData - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param tags: A set of tags. Custom tags for the resource. - :type tags: dict[str, str] - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - :param object_id: The object identifier associated with the Azure Stack connecting to Azure. - :type object_id: str - :param cloud_id: The identifier of the registered Azure Stack. - :type cloud_id: str - :param billing_model: Specifies the billing mode for the Azure Stack registration. - :type billing_model: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'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'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'object_id': {'key': 'properties.objectId', 'type': 'str'}, - 'cloud_id': {'key': 'properties.cloudId', 'type': 'str'}, - 'billing_model': {'key': 'properties.billingModel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Registration, self).__init__(**kwargs) - self.object_id = kwargs.get('object_id', None) - self.cloud_id = kwargs.get('cloud_id', None) - self.billing_model = kwargs.get('billing_model', None) - - -class RegistrationList(msrest.serialization.Model): - """Pageable list of registrations. - - :param next_link: URI to the next page. - :type next_link: str - :param value: List of Registrations. - :type value: list[~azure.mgmt.azurestack.models.Registration] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Registration]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistrationList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class RegistrationParameter(msrest.serialization.Model): - """Registration resource. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param registration_token: Required. The token identifying registered Azure Stack. - :type registration_token: str - """ - - _validation = { - 'location': {'required': True}, - 'registration_token': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'registration_token': {'key': 'properties.registrationToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistrationParameter, self).__init__(**kwargs) - self.location = kwargs['location'] - self.registration_token = kwargs['registration_token'] - - -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.mgmt.azurestack.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.mgmt.azurestack.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) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models_py3.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models_py3.py index 8117e67254d1..783baea044b1 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models_py3.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models_py3.py @@ -18,8 +18,8 @@ class ActivationKeyResult(msrest.serialization.Model): """The resource containing the Azure Stack activation key. - :param activation_key: Azure Stack activation key. - :type activation_key: str + :ivar activation_key: Azure Stack activation key. + :vartype activation_key: str """ _attribute_map = { @@ -32,6 +32,10 @@ def __init__( activation_key: Optional[str] = None, **kwargs ): + """ + :keyword activation_key: Azure Stack activation key. + :paramtype activation_key: str + """ super(ActivationKeyResult, self).__init__(**kwargs) self.activation_key = activation_key @@ -39,14 +43,14 @@ def __init__( class CloudManifestFileDeploymentData(msrest.serialization.Model): """Cloud specific manifest data for AzureStack deployment. - :param external_dsms_certificates: Dsms external certificates. - :type external_dsms_certificates: str - :param custom_cloud_verification_key: Signing verification public key. - :type custom_cloud_verification_key: str - :param custom_cloud_arm_endpoint: ARM endpoint. - :type custom_cloud_arm_endpoint: str - :param external_dsms_endpoint: Dsms endpoint. - :type external_dsms_endpoint: str + :ivar external_dsms_certificates: Dsms external certificates. + :vartype external_dsms_certificates: str + :ivar custom_cloud_verification_key: Signing verification public key. + :vartype custom_cloud_verification_key: str + :ivar custom_cloud_arm_endpoint: ARM endpoint. + :vartype custom_cloud_arm_endpoint: str + :ivar external_dsms_endpoint: Dsms endpoint. + :vartype external_dsms_endpoint: str """ _attribute_map = { @@ -65,6 +69,16 @@ def __init__( external_dsms_endpoint: Optional[str] = None, **kwargs ): + """ + :keyword external_dsms_certificates: Dsms external certificates. + :paramtype external_dsms_certificates: str + :keyword custom_cloud_verification_key: Signing verification public key. + :paramtype custom_cloud_verification_key: str + :keyword custom_cloud_arm_endpoint: ARM endpoint. + :paramtype custom_cloud_arm_endpoint: str + :keyword external_dsms_endpoint: Dsms endpoint. + :paramtype external_dsms_endpoint: str + """ super(CloudManifestFileDeploymentData, self).__init__(**kwargs) self.external_dsms_certificates = external_dsms_certificates self.custom_cloud_verification_key = custom_cloud_verification_key @@ -75,10 +89,10 @@ def __init__( class CloudManifestFileProperties(msrest.serialization.Model): """Cloud specific manifest JSON properties. - :param deployment_data: Cloud specific manifest data. - :type deployment_data: ~azure.mgmt.azurestack.models.CloudManifestFileDeploymentData - :param signature: Signature of the cloud specific manifest data. - :type signature: str + :ivar deployment_data: Cloud specific manifest data. + :vartype deployment_data: ~azure.mgmt.azurestack.models.CloudManifestFileDeploymentData + :ivar signature: Signature of the cloud specific manifest data. + :vartype signature: str """ _attribute_map = { @@ -93,6 +107,12 @@ def __init__( signature: Optional[str] = None, **kwargs ): + """ + :keyword deployment_data: Cloud specific manifest data. + :paramtype deployment_data: ~azure.mgmt.azurestack.models.CloudManifestFileDeploymentData + :keyword signature: Signature of the cloud specific manifest data. + :paramtype signature: str + """ super(CloudManifestFileProperties, self).__init__(**kwargs) self.deployment_data = deployment_data self.signature = signature @@ -109,8 +129,8 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Type of Resource. :vartype type: str - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str + :ivar etag: The entity tag used for optimistic concurrency when modifying the resource. + :vartype etag: str """ _validation = { @@ -132,6 +152,10 @@ def __init__( etag: Optional[str] = None, **kwargs ): + """ + :keyword etag: The entity tag used for optimistic concurrency when modifying the resource. + :paramtype etag: str + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -150,10 +174,10 @@ class CloudManifestFileResponse(Resource): :vartype name: str :ivar type: Type of Resource. :vartype type: str - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - :param properties: Cloud specific manifest data. - :type properties: ~azure.mgmt.azurestack.models.CloudManifestFileProperties + :ivar etag: The entity tag used for optimistic concurrency when modifying the resource. + :vartype etag: str + :ivar properties: Cloud specific manifest data. + :vartype properties: ~azure.mgmt.azurestack.models.CloudManifestFileProperties """ _validation = { @@ -177,6 +201,12 @@ def __init__( properties: Optional["CloudManifestFileProperties"] = None, **kwargs ): + """ + :keyword etag: The entity tag used for optimistic concurrency when modifying the resource. + :paramtype etag: str + :keyword properties: Cloud specific manifest data. + :paramtype properties: ~azure.mgmt.azurestack.models.CloudManifestFileProperties + """ super(CloudManifestFileResponse, self).__init__(etag=etag, **kwargs) self.properties = properties @@ -184,14 +214,14 @@ def __init__( class Compatibility(msrest.serialization.Model): """Product compatibility. - :param is_compatible: Tells if product is compatible with current device. - :type is_compatible: bool - :param message: Short error message if any compatibility issues are found. - :type message: str - :param description: Full error message if any compatibility issues are found. - :type description: str - :param issues: List of all issues found. - :type issues: list[str or ~azure.mgmt.azurestack.models.CompatibilityIssue] + :ivar is_compatible: Tells if product is compatible with current device. + :vartype is_compatible: bool + :ivar message: Short error message if any compatibility issues are found. + :vartype message: str + :ivar description: Full error message if any compatibility issues are found. + :vartype description: str + :ivar issues: List of all issues found. + :vartype issues: list[str or ~azure.mgmt.azurestack.models.CompatibilityIssue] """ _attribute_map = { @@ -210,6 +240,16 @@ def __init__( issues: Optional[List[Union[str, "CompatibilityIssue"]]] = None, **kwargs ): + """ + :keyword is_compatible: Tells if product is compatible with current device. + :paramtype is_compatible: bool + :keyword message: Short error message if any compatibility issues are found. + :paramtype message: str + :keyword description: Full error message if any compatibility issues are found. + :paramtype description: str + :keyword issues: List of all issues found. + :paramtype issues: list[str or ~azure.mgmt.azurestack.models.CompatibilityIssue] + """ super(Compatibility, self).__init__(**kwargs) self.is_compatible = is_compatible self.message = message @@ -228,12 +268,12 @@ class CustomerSubscription(Resource): :vartype name: str :ivar type: Type of Resource. :vartype type: str - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str + :ivar etag: The entity tag used for optimistic concurrency when modifying the resource. + :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.azurestack.models.SystemData - :param tenant_id: Tenant Id. - :type tenant_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _validation = { @@ -259,6 +299,12 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword etag: The entity tag used for optimistic concurrency when modifying the resource. + :paramtype etag: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(CustomerSubscription, self).__init__(etag=etag, **kwargs) self.system_data = None self.tenant_id = tenant_id @@ -267,10 +313,10 @@ def __init__( class CustomerSubscriptionList(msrest.serialization.Model): """Pageable list of customer subscriptions. - :param next_link: URI to the next page. - :type next_link: str - :param value: List of customer subscriptions. - :type value: list[~azure.mgmt.azurestack.models.CustomerSubscription] + :ivar next_link: URI to the next page. + :vartype next_link: str + :ivar value: List of customer subscriptions. + :vartype value: list[~azure.mgmt.azurestack.models.CustomerSubscription] """ _attribute_map = { @@ -285,6 +331,12 @@ def __init__( value: Optional[List["CustomerSubscription"]] = None, **kwargs ): + """ + :keyword next_link: URI to the next page. + :paramtype next_link: str + :keyword value: List of customer subscriptions. + :paramtype value: list[~azure.mgmt.azurestack.models.CustomerSubscription] + """ super(CustomerSubscriptionList, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -315,6 +367,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None self.source_blob_sas_uri = None @@ -346,6 +400,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeviceConfiguration, self).__init__(**kwargs) self.device_version = None self.identity_system = None @@ -354,18 +410,18 @@ def __init__( class Display(msrest.serialization.Model): """Contains the localized display information for this particular operation or action. - :param provider: The localized, friendly version of the resource provider name. - :type provider: str - :param resource: The localized, friendly version of the resource type related to this action or + :ivar provider: The localized, friendly version of the resource provider name. + :vartype provider: str + :ivar resource: The localized, friendly version of the resource type related to this action or operation; the resource type should match the public documentation for the resource provider. - :type resource: str - :param operation: The localized, friendly name for the operation. Use the name as it will + :vartype resource: str + :ivar operation: The localized, friendly name for the operation. Use the name as it will displayed to the user. - :type operation: str - :param description: The localized, friendly description for the operation. The description will + :vartype operation: str + :ivar description: The localized, friendly description for the operation. The description will be displayed to the user. It should be thorough and concise for used in both tooltips and detailed views. - :type description: str + :vartype description: str """ _attribute_map = { @@ -384,6 +440,21 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The localized, friendly version of the resource provider name. + :paramtype provider: str + :keyword resource: The localized, friendly version of the resource type related to this action + or operation; the resource type should match the public documentation for the resource + provider. + :paramtype resource: str + :keyword operation: The localized, friendly name for the operation. Use the name as it will + displayed to the user. + :paramtype operation: str + :keyword description: The localized, friendly description for the operation. The description + will be displayed to the user. It should be thorough and concise for used in both tooltips and + detailed views. + :paramtype description: str + """ super(Display, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -420,6 +491,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetails, self).__init__(**kwargs) self.code = None self.message = None @@ -429,8 +502,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. - :param error: The details of the error. - :type error: ~azure.mgmt.azurestack.models.ErrorDetails + :ivar error: The details of the error. + :vartype error: ~azure.mgmt.azurestack.models.ErrorDetails """ _attribute_map = { @@ -443,6 +516,10 @@ def __init__( error: Optional["ErrorDetails"] = None, **kwargs ): + """ + :keyword error: The details of the error. + :paramtype error: ~azure.mgmt.azurestack.models.ErrorDetails + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -517,6 +594,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtendedProduct, self).__init__(**kwargs) self.gallery_package_blob_sas_uri = None self.product_kind = None @@ -561,6 +640,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineProductProperties, self).__init__(**kwargs) self.version = None self.os_disk_image = None @@ -615,6 +696,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineExtensionProductProperties, self).__init__(**kwargs) self.compute_role = None self.is_system_extension = None @@ -681,6 +764,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtendedProductProperties, self).__init__(**kwargs) self.os_disk_image = None self.data_disk_images = None @@ -696,16 +781,16 @@ def __init__( class IconUris(msrest.serialization.Model): """Links to product icons. - :param large: URI to large icon. - :type large: str - :param wide: URI to wide icon. - :type wide: str - :param medium: URI to medium icon. - :type medium: str - :param small: URI to small icon. - :type small: str - :param hero: URI to hero icon. - :type hero: str + :ivar large: URI to large icon. + :vartype large: str + :ivar wide: URI to wide icon. + :vartype wide: str + :ivar medium: URI to medium icon. + :vartype medium: str + :ivar small: URI to small icon. + :vartype small: str + :ivar hero: URI to hero icon. + :vartype hero: str """ _attribute_map = { @@ -726,6 +811,18 @@ def __init__( hero: Optional[str] = None, **kwargs ): + """ + :keyword large: URI to large icon. + :paramtype large: str + :keyword wide: URI to wide icon. + :paramtype wide: str + :keyword medium: URI to medium icon. + :paramtype medium: str + :keyword small: URI to small icon. + :paramtype small: str + :keyword hero: URI to hero icon. + :paramtype hero: str + """ super(IconUris, self).__init__(**kwargs) self.large = large self.wide = wide @@ -751,12 +848,12 @@ class TrackedResource(msrest.serialization.Model): :vartype kind: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.azurestack.models.SystemData - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param tags: A set of tags. Custom tags for the resource. - :type tags: dict[str, str] - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str + :ivar location: Required. Location of the resource. Possible values include: "global". + :vartype location: str or ~azure.mgmt.azurestack.models.Location + :ivar tags: A set of tags. Custom tags for the resource. + :vartype tags: dict[str, str] + :ivar etag: The entity tag used for optimistic concurrency when modifying the resource. + :vartype etag: str """ _validation = { @@ -787,6 +884,14 @@ def __init__( etag: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Location of the resource. Possible values include: "global". + :paramtype location: str or ~azure.mgmt.azurestack.models.Location + :keyword tags: A set of tags. Custom tags for the resource. + :paramtype tags: dict[str, str] + :keyword etag: The entity tag used for optimistic concurrency when modifying the resource. + :paramtype etag: str + """ super(TrackedResource, self).__init__(**kwargs) self.id = None self.name = None @@ -815,16 +920,16 @@ class LinkedSubscription(TrackedResource): :vartype kind: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.azurestack.models.SystemData - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param tags: A set of tags. Custom tags for the resource. - :type tags: dict[str, str] - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - :param linked_subscription_id: The identifier associated with the device subscription. - :type linked_subscription_id: str - :param registration_resource_id: The identifier associated with the device registration. - :type registration_resource_id: str + :ivar location: Required. Location of the resource. Possible values include: "global". + :vartype location: str or ~azure.mgmt.azurestack.models.Location + :ivar tags: A set of tags. Custom tags for the resource. + :vartype tags: dict[str, str] + :ivar etag: The entity tag used for optimistic concurrency when modifying the resource. + :vartype etag: str + :ivar linked_subscription_id: The identifier associated with the device subscription. + :vartype linked_subscription_id: str + :ivar registration_resource_id: The identifier associated with the device registration. + :vartype registration_resource_id: str :ivar device_id: The identifier of the Azure Stack device for remote management. :vartype device_id: str :ivar device_object_id: The object identifier associated with the Azure Stack device connecting @@ -882,6 +987,18 @@ def __init__( registration_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Location of the resource. Possible values include: "global". + :paramtype location: str or ~azure.mgmt.azurestack.models.Location + :keyword tags: A set of tags. Custom tags for the resource. + :paramtype tags: dict[str, str] + :keyword etag: The entity tag used for optimistic concurrency when modifying the resource. + :paramtype etag: str + :keyword linked_subscription_id: The identifier associated with the device subscription. + :paramtype linked_subscription_id: str + :keyword registration_resource_id: The identifier associated with the device registration. + :paramtype registration_resource_id: str + """ super(LinkedSubscription, self).__init__(location=location, tags=tags, etag=etag, **kwargs) self.linked_subscription_id = linked_subscription_id self.registration_resource_id = registration_resource_id @@ -897,14 +1014,13 @@ class LinkedSubscriptionParameter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param linked_subscription_id: Required. The identifier associated with the device - subscription. - :type linked_subscription_id: str - :param registration_resource_id: Required. The identifier associated with the device + :ivar location: Required. Location of the resource. Possible values include: "global". + :vartype location: str or ~azure.mgmt.azurestack.models.Location + :ivar linked_subscription_id: Required. The identifier associated with the device subscription. + :vartype linked_subscription_id: str + :ivar registration_resource_id: Required. The identifier associated with the device registration. - :type registration_resource_id: str + :vartype registration_resource_id: str """ _validation = { @@ -927,6 +1043,16 @@ def __init__( registration_resource_id: str, **kwargs ): + """ + :keyword location: Required. Location of the resource. Possible values include: "global". + :paramtype location: str or ~azure.mgmt.azurestack.models.Location + :keyword linked_subscription_id: Required. The identifier associated with the device + subscription. + :paramtype linked_subscription_id: str + :keyword registration_resource_id: Required. The identifier associated with the device + registration. + :paramtype registration_resource_id: str + """ super(LinkedSubscriptionParameter, self).__init__(**kwargs) self.location = location self.linked_subscription_id = linked_subscription_id @@ -936,10 +1062,10 @@ def __init__( class LinkedSubscriptionsList(msrest.serialization.Model): """List of linked subscriptions with paging support. - :param next_link: URI to the next page. - :type next_link: str - :param value: List of Linked Subscriptions. - :type value: list[~azure.mgmt.azurestack.models.LinkedSubscription] + :ivar next_link: URI to the next page. + :vartype next_link: str + :ivar value: List of Linked Subscriptions. + :vartype value: list[~azure.mgmt.azurestack.models.LinkedSubscription] """ _attribute_map = { @@ -954,6 +1080,12 @@ def __init__( value: Optional[List["LinkedSubscription"]] = None, **kwargs ): + """ + :keyword next_link: URI to the next page. + :paramtype next_link: str + :keyword value: List of Linked Subscriptions. + :paramtype value: list[~azure.mgmt.azurestack.models.LinkedSubscription] + """ super(LinkedSubscriptionsList, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -992,6 +1124,8 @@ def __init__( self, **kwargs ): + """ + """ super(MarketplaceProductLogUpdate, self).__init__(**kwargs) self.operation = None self.status = None @@ -1002,13 +1136,13 @@ def __init__( class Operation(msrest.serialization.Model): """Describes the supported REST operation. - :param name: The name of the operation being performed on this particular object. - :type name: str - :param display: Contains the localized display information for this particular operation or + :ivar name: The name of the operation being performed on this particular object. + :vartype name: str + :ivar display: Contains the localized display information for this particular operation or action. - :type display: ~azure.mgmt.azurestack.models.Display - :param origin: The intended executor of the operation. - :type origin: str + :vartype display: ~azure.mgmt.azurestack.models.Display + :ivar origin: The intended executor of the operation. + :vartype origin: str """ _attribute_map = { @@ -1025,6 +1159,15 @@ def __init__( origin: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the operation being performed on this particular object. + :paramtype name: str + :keyword display: Contains the localized display information for this particular operation or + action. + :paramtype display: ~azure.mgmt.azurestack.models.Display + :keyword origin: The intended executor of the operation. + :paramtype origin: str + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1034,10 +1177,10 @@ def __init__( class OperationList(msrest.serialization.Model): """List of Operations. - :param value: Array of operations. - :type value: list[~azure.mgmt.azurestack.models.Operation] - :param next_link: URI to the next page of operations. - :type next_link: str + :ivar value: Array of operations. + :vartype value: list[~azure.mgmt.azurestack.models.Operation] + :ivar next_link: URI to the next page of operations. + :vartype next_link: str """ _attribute_map = { @@ -1052,6 +1195,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Array of operations. + :paramtype value: list[~azure.mgmt.azurestack.models.Operation] + :keyword next_link: URI to the next page of operations. + :paramtype next_link: str + """ super(OperationList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1083,6 +1232,8 @@ def __init__( self, **kwargs ): + """ + """ super(OsDiskImage, self).__init__(**kwargs) self.operating_system = None self.source_blob_sas_uri = None @@ -1099,46 +1250,46 @@ class Product(Resource): :vartype name: str :ivar type: Type of Resource. :vartype type: str - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str + :ivar etag: The entity tag used for optimistic concurrency when modifying the resource. + :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.azurestack.models.SystemData - :param display_name: The display name of the product. - :type display_name: str - :param description: The description of the product. - :type description: str - :param publisher_display_name: The user-friendly name of the product publisher. - :type publisher_display_name: str - :param publisher_identifier: Publisher identifier. - :type publisher_identifier: str - :param offer: The offer representing the product. - :type offer: str - :param offer_version: The version of the product offer. - :type offer_version: str - :param sku: The product SKU. - :type sku: str - :param billing_part_number: The part number used for billing purposes. - :type billing_part_number: str - :param vm_extension_type: The type of the Virtual Machine Extension. - :type vm_extension_type: str - :param gallery_item_identity: The identifier of the gallery item corresponding to the product. - :type gallery_item_identity: str - :param icon_uris: Additional links available for this product. - :type icon_uris: ~azure.mgmt.azurestack.models.IconUris - :param links: Additional links available for this product. - :type links: list[~azure.mgmt.azurestack.models.ProductLink] - :param legal_terms: The legal terms. - :type legal_terms: str - :param privacy_policy: The privacy policy. - :type privacy_policy: str - :param payload_length: The length of product content. - :type payload_length: long - :param product_kind: The kind of the product (virtualMachine or virtualMachineExtension). - :type product_kind: str - :param product_properties: Additional properties for the product. - :type product_properties: ~azure.mgmt.azurestack.models.ProductProperties - :param compatibility: Product compatibility with current device. - :type compatibility: ~azure.mgmt.azurestack.models.Compatibility + :ivar display_name: The display name of the product. + :vartype display_name: str + :ivar description: The description of the product. + :vartype description: str + :ivar publisher_display_name: The user-friendly name of the product publisher. + :vartype publisher_display_name: str + :ivar publisher_identifier: Publisher identifier. + :vartype publisher_identifier: str + :ivar offer: The offer representing the product. + :vartype offer: str + :ivar offer_version: The version of the product offer. + :vartype offer_version: str + :ivar sku: The product SKU. + :vartype sku: str + :ivar billing_part_number: The part number used for billing purposes. + :vartype billing_part_number: str + :ivar vm_extension_type: The type of the Virtual Machine Extension. + :vartype vm_extension_type: str + :ivar gallery_item_identity: The identifier of the gallery item corresponding to the product. + :vartype gallery_item_identity: str + :ivar icon_uris: Additional links available for this product. + :vartype icon_uris: ~azure.mgmt.azurestack.models.IconUris + :ivar links: Additional links available for this product. + :vartype links: list[~azure.mgmt.azurestack.models.ProductLink] + :ivar legal_terms: The legal terms. + :vartype legal_terms: str + :ivar privacy_policy: The privacy policy. + :vartype privacy_policy: str + :ivar payload_length: The length of product content. + :vartype payload_length: long + :ivar product_kind: The kind of the product (virtualMachine or virtualMachineExtension). + :vartype product_kind: str + :ivar product_properties: Additional properties for the product. + :vartype product_properties: ~azure.mgmt.azurestack.models.ProductProperties + :ivar compatibility: Product compatibility with current device. + :vartype compatibility: ~azure.mgmt.azurestack.models.Compatibility """ _validation = { @@ -1198,6 +1349,47 @@ def __init__( compatibility: Optional["Compatibility"] = None, **kwargs ): + """ + :keyword etag: The entity tag used for optimistic concurrency when modifying the resource. + :paramtype etag: str + :keyword display_name: The display name of the product. + :paramtype display_name: str + :keyword description: The description of the product. + :paramtype description: str + :keyword publisher_display_name: The user-friendly name of the product publisher. + :paramtype publisher_display_name: str + :keyword publisher_identifier: Publisher identifier. + :paramtype publisher_identifier: str + :keyword offer: The offer representing the product. + :paramtype offer: str + :keyword offer_version: The version of the product offer. + :paramtype offer_version: str + :keyword sku: The product SKU. + :paramtype sku: str + :keyword billing_part_number: The part number used for billing purposes. + :paramtype billing_part_number: str + :keyword vm_extension_type: The type of the Virtual Machine Extension. + :paramtype vm_extension_type: str + :keyword gallery_item_identity: The identifier of the gallery item corresponding to the + product. + :paramtype gallery_item_identity: str + :keyword icon_uris: Additional links available for this product. + :paramtype icon_uris: ~azure.mgmt.azurestack.models.IconUris + :keyword links: Additional links available for this product. + :paramtype links: list[~azure.mgmt.azurestack.models.ProductLink] + :keyword legal_terms: The legal terms. + :paramtype legal_terms: str + :keyword privacy_policy: The privacy policy. + :paramtype privacy_policy: str + :keyword payload_length: The length of product content. + :paramtype payload_length: long + :keyword product_kind: The kind of the product (virtualMachine or virtualMachineExtension). + :paramtype product_kind: str + :keyword product_properties: Additional properties for the product. + :paramtype product_properties: ~azure.mgmt.azurestack.models.ProductProperties + :keyword compatibility: Product compatibility with current device. + :paramtype compatibility: ~azure.mgmt.azurestack.models.Compatibility + """ super(Product, self).__init__(etag=etag, **kwargs) self.system_data = None self.display_name = display_name @@ -1223,10 +1415,10 @@ def __init__( class ProductLink(msrest.serialization.Model): """Link with additional information about a product. - :param display_name: The description of the link. - :type display_name: str - :param uri: The URI corresponding to the link. - :type uri: str + :ivar display_name: The description of the link. + :vartype display_name: str + :ivar uri: The URI corresponding to the link. + :vartype uri: str """ _attribute_map = { @@ -1241,6 +1433,12 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword display_name: The description of the link. + :paramtype display_name: str + :keyword uri: The URI corresponding to the link. + :paramtype uri: str + """ super(ProductLink, self).__init__(**kwargs) self.display_name = display_name self.uri = uri @@ -1249,10 +1447,10 @@ def __init__( class ProductList(msrest.serialization.Model): """Pageable list of products. - :param next_link: URI to the next page. - :type next_link: str - :param value: List of products. - :type value: list[~azure.mgmt.azurestack.models.Product] + :ivar next_link: URI to the next page. + :vartype next_link: str + :ivar value: List of products. + :vartype value: list[~azure.mgmt.azurestack.models.Product] """ _attribute_map = { @@ -1267,6 +1465,12 @@ def __init__( value: Optional[List["Product"]] = None, **kwargs ): + """ + :keyword next_link: URI to the next page. + :paramtype next_link: str + :keyword value: List of products. + :paramtype value: list[~azure.mgmt.azurestack.models.Product] + """ super(ProductList, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -1333,6 +1537,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProductLog, self).__init__(**kwargs) self.id = None self.product_id = None @@ -1350,8 +1556,8 @@ def __init__( class ProductProperties(msrest.serialization.Model): """Additional properties of the product. - :param version: The version. - :type version: str + :ivar version: The version. + :vartype version: str """ _attribute_map = { @@ -1364,6 +1570,10 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword version: The version. + :paramtype version: str + """ super(ProductProperties, self).__init__(**kwargs) self.version = version @@ -1385,18 +1595,18 @@ class Registration(TrackedResource): :vartype kind: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.azurestack.models.SystemData - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param tags: A set of tags. Custom tags for the resource. - :type tags: dict[str, str] - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - :param object_id: The object identifier associated with the Azure Stack connecting to Azure. - :type object_id: str - :param cloud_id: The identifier of the registered Azure Stack. - :type cloud_id: str - :param billing_model: Specifies the billing mode for the Azure Stack registration. - :type billing_model: str + :ivar location: Required. Location of the resource. Possible values include: "global". + :vartype location: str or ~azure.mgmt.azurestack.models.Location + :ivar tags: A set of tags. Custom tags for the resource. + :vartype tags: dict[str, str] + :ivar etag: The entity tag used for optimistic concurrency when modifying the resource. + :vartype etag: str + :ivar object_id: The object identifier associated with the Azure Stack connecting to Azure. + :vartype object_id: str + :ivar cloud_id: The identifier of the registered Azure Stack. + :vartype cloud_id: str + :ivar billing_model: Specifies the billing mode for the Azure Stack registration. + :vartype billing_model: str """ _validation = { @@ -1433,6 +1643,20 @@ def __init__( billing_model: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Location of the resource. Possible values include: "global". + :paramtype location: str or ~azure.mgmt.azurestack.models.Location + :keyword tags: A set of tags. Custom tags for the resource. + :paramtype tags: dict[str, str] + :keyword etag: The entity tag used for optimistic concurrency when modifying the resource. + :paramtype etag: str + :keyword object_id: The object identifier associated with the Azure Stack connecting to Azure. + :paramtype object_id: str + :keyword cloud_id: The identifier of the registered Azure Stack. + :paramtype cloud_id: str + :keyword billing_model: Specifies the billing mode for the Azure Stack registration. + :paramtype billing_model: str + """ super(Registration, self).__init__(location=location, tags=tags, etag=etag, **kwargs) self.object_id = object_id self.cloud_id = cloud_id @@ -1442,10 +1666,10 @@ def __init__( class RegistrationList(msrest.serialization.Model): """Pageable list of registrations. - :param next_link: URI to the next page. - :type next_link: str - :param value: List of Registrations. - :type value: list[~azure.mgmt.azurestack.models.Registration] + :ivar next_link: URI to the next page. + :vartype next_link: str + :ivar value: List of Registrations. + :vartype value: list[~azure.mgmt.azurestack.models.Registration] """ _attribute_map = { @@ -1460,6 +1684,12 @@ def __init__( value: Optional[List["Registration"]] = None, **kwargs ): + """ + :keyword next_link: URI to the next page. + :paramtype next_link: str + :keyword value: List of Registrations. + :paramtype value: list[~azure.mgmt.azurestack.models.Registration] + """ super(RegistrationList, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -1470,10 +1700,10 @@ class RegistrationParameter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param registration_token: Required. The token identifying registered Azure Stack. - :type registration_token: str + :ivar location: Required. Location of the resource. Possible values include: "global". + :vartype location: str or ~azure.mgmt.azurestack.models.Location + :ivar registration_token: Required. The token identifying registered Azure Stack. + :vartype registration_token: str """ _validation = { @@ -1493,6 +1723,12 @@ def __init__( registration_token: str, **kwargs ): + """ + :keyword location: Required. Location of the resource. Possible values include: "global". + :paramtype location: str or ~azure.mgmt.azurestack.models.Location + :keyword registration_token: Required. The token identifying registered Azure Stack. + :paramtype registration_token: str + """ super(RegistrationParameter, self).__init__(**kwargs) self.location = location self.registration_token = registration_token @@ -1501,20 +1737,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.azurestack.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.azurestack.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.azurestack.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.azurestack.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1537,6 +1773,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.azurestack.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.azurestack.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_cloud_manifest_file_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_cloud_manifest_file_operations.py index f52f3edde7cd..f2a5c0727aa7 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_cloud_manifest_file_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_cloud_manifest_file_operations.py @@ -5,22 +5,84 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AzureStack/cloudManifestFiles') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + verification_version: str, + *, + version_creation_date: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AzureStack/cloudManifestFiles/{verificationVersion}') + path_format_arguments = { + "verificationVersion": _SERIALIZER.url("verification_version", verification_version, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if version_creation_date is not None: + query_parameters['versionCreationDate'] = _SERIALIZER.query("version_creation_date", version_creation_date, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class CloudManifestFileOperations(object): """CloudManifestFileOperations operations. @@ -44,11 +106,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudManifestFileResponse" + **kwargs: Any + ) -> "_models.CloudManifestFileResponse": """Returns a cloud specific manifest JSON file with latest version. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,27 +123,20 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CloudManifestFileResponse', pipeline_response) @@ -90,15 +145,17 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.AzureStack/cloudManifestFiles'} # type: ignore + + @distributed_trace def get( self, - verification_version, # type: str - version_creation_date=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.CloudManifestFileResponse" + verification_version: str, + version_creation_date: Optional[str] = None, + **kwargs: Any + ) -> "_models.CloudManifestFileResponse": """Returns a cloud specific manifest JSON file. :param verification_version: Signing verification key version. @@ -115,33 +172,22 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'verificationVersion': self._serialize.url("verification_version", verification_version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if version_creation_date is not None: - query_parameters['versionCreationDate'] = self._serialize.query("version_creation_date", version_creation_date, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + verification_version=verification_version, + version_creation_date=version_creation_date, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CloudManifestFileResponse', pipeline_response) @@ -150,4 +196,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/providers/Microsoft.AzureStack/cloudManifestFiles/{verificationVersion}'} # type: ignore + diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_customer_subscriptions_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_customer_subscriptions_operations.py index 4aeefc291cd6..3e058c56323b 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_customer_subscriptions_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_customer_subscriptions_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group: str, + registration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group: str, + registration_name: str, + customer_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + "customerSubscriptionName": _SERIALIZER.url("customer_subscription_name", customer_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group: str, + registration_name: str, + customer_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + "customerSubscriptionName": _SERIALIZER.url("customer_subscription_name", customer_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id: str, + resource_group: str, + registration_name: str, + customer_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + "customerSubscriptionName": _SERIALIZER.url("customer_subscription_name", customer_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class CustomerSubscriptionsOperations(object): """CustomerSubscriptionsOperations operations. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group, # type: str - registration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomerSubscriptionList"] + resource_group: str, + registration_name: str, + **kwargs: Any + ) -> Iterable["_models.CustomerSubscriptionList"]: """Returns a list of products. :param resource_group: Name of the resource group. @@ -59,7 +217,8 @@ def list( :param registration_name: Name of the Azure Stack registration. :type registration_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomerSubscriptionList or the result of cls(response) + :return: An iterator like instance of either CustomerSubscriptionList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestack.models.CustomerSubscriptionList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -68,36 +227,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CustomerSubscriptionList', pipeline_response) + deserialized = self._deserialize("CustomerSubscriptionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,25 +266,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions'} # type: ignore + @distributed_trace def get( self, - resource_group, # type: str - registration_name, # type: str - customer_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomerSubscription" + resource_group: str, + registration_name: str, + customer_subscription_name: str, + **kwargs: Any + ) -> "_models.CustomerSubscription": """Returns the specified product. :param resource_group: Name of the resource group. @@ -147,34 +304,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'customerSubscriptionName': self._serialize.url("customer_subscription_name", customer_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + customer_subscription_name=customer_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CustomerSubscription', pipeline_response) @@ -183,16 +330,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group, # type: str - registration_name, # type: str - customer_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group: str, + registration_name: str, + customer_subscription_name: str, + **kwargs: Any + ) -> None: """Deletes a customer subscription under a registration. :param resource_group: Name of the resource group. @@ -211,34 +360,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'customerSubscriptionName': self._serialize.url("customer_subscription_name", customer_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + customer_subscription_name=customer_subscription_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -246,15 +385,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}'} # type: ignore + + @distributed_trace def create( self, - resource_group, # type: str - registration_name, # type: str - customer_subscription_name, # type: str - customer_creation_parameters, # type: "_models.CustomerSubscription" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomerSubscription" + resource_group: str, + registration_name: str, + customer_subscription_name: str, + customer_creation_parameters: "_models.CustomerSubscription", + **kwargs: Any + ) -> "_models.CustomerSubscription": """Creates a new customer subscription under a registration. :param resource_group: Name of the resource group. @@ -275,39 +415,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'customerSubscriptionName': self._serialize.url("customer_subscription_name", customer_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(customer_creation_parameters, 'CustomerSubscription') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + customer_subscription_name=customer_subscription_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(customer_creation_parameters, 'CustomerSubscription') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CustomerSubscription', pipeline_response) @@ -316,4 +446,6 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}'} # type: ignore + diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_linked_subscriptions_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_linked_subscriptions_operations.py index fee017626afc..38cadcd29153 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_linked_subscriptions_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_linked_subscriptions_operations.py @@ -5,23 +5,248 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStack/linkedSubscriptions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group: str, + linked_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "linkedSubscriptionName": _SERIALIZER.url("linked_subscription_name", linked_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group: str, + linked_subscription_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "linkedSubscriptionName": _SERIALIZER.url("linked_subscription_name", linked_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group: str, + linked_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "linkedSubscriptionName": _SERIALIZER.url("linked_subscription_name", linked_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group: str, + linked_subscription_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "linkedSubscriptionName": _SERIALIZER.url("linked_subscription_name", linked_subscription_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LinkedSubscriptionsOperations(object): """LinkedSubscriptionsOperations operations. @@ -45,18 +270,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource_group( self, - resource_group, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.LinkedSubscriptionsList"] + resource_group: str, + **kwargs: Any + ) -> Iterable["_models.LinkedSubscriptionsList"]: """Returns a list of all linked subscriptions under current resource group. :param resource_group: Name of the resource group. :type resource_group: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LinkedSubscriptionsList or the result of cls(response) + :return: An iterator like instance of either LinkedSubscriptionsList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestack.models.LinkedSubscriptionsList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -65,35 +291,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('LinkedSubscriptionsList', pipeline_response) + deserialized = self._deserialize("LinkedSubscriptionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,26 +328,28 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions'} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.LinkedSubscriptionsList"] + **kwargs: Any + ) -> Iterable["_models.LinkedSubscriptionsList"]: """Returns a list of all linked subscriptions under current subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LinkedSubscriptionsList or the result of cls(response) + :return: An iterator like instance of either LinkedSubscriptionsList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestack.models.LinkedSubscriptionsList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -134,34 +358,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('LinkedSubscriptionsList', pipeline_response) + deserialized = self._deserialize("LinkedSubscriptionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,24 +393,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStack/linkedSubscriptions'} # type: ignore + @distributed_trace def get( self, - resource_group, # type: str - linked_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.LinkedSubscription" + resource_group: str, + linked_subscription_name: str, + **kwargs: Any + ) -> "_models.LinkedSubscription": """Returns the properties of a Linked Subscription resource. :param resource_group: Name of the resource group. @@ -208,33 +428,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + linked_subscription_name=linked_subscription_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LinkedSubscription', pipeline_response) @@ -243,15 +453,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group, # type: str - linked_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group: str, + linked_subscription_name: str, + **kwargs: Any + ) -> None: """Delete the requested Linked Subscription resource. :param resource_group: Name of the resource group. @@ -268,33 +480,23 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + linked_subscription_name=linked_subscription_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -302,14 +504,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group, # type: str - linked_subscription_name, # type: str - resource, # type: "_models.LinkedSubscriptionParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.LinkedSubscription" + resource_group: str, + linked_subscription_name: str, + resource: "_models.LinkedSubscriptionParameter", + **kwargs: Any + ) -> "_models.LinkedSubscription": """Create or update a linked subscription resource. :param resource_group: Name of the resource group. @@ -328,38 +531,28 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'LinkedSubscriptionParameter') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + linked_subscription_name=linked_subscription_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'LinkedSubscriptionParameter') - 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -372,16 +565,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + @distributed_trace def update( self, - resource_group, # type: str - linked_subscription_name, # type: str - resource, # type: "_models.LinkedSubscriptionParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.LinkedSubscription" + resource_group: str, + linked_subscription_name: str, + resource: "_models.LinkedSubscriptionParameter", + **kwargs: Any + ) -> "_models.LinkedSubscription": """Patch a Linked Subscription resource. :param resource_group: Name of the resource group. @@ -400,38 +595,28 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(resource, 'LinkedSubscriptionParameter') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + linked_subscription_name=linked_subscription_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'LinkedSubscriptionParameter') - 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LinkedSubscription', pipeline_response) @@ -440,4 +625,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_operations.py index 36fe2ccc45a5..4a3f460c3fa0 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AzureStack/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationList"] + **kwargs: Any + ) -> Iterable["_models.OperationList"]: """Returns the list of supported REST operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,30 +89,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +122,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_products_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_products_operations.py index 49c04c7bba85..3a0b7f27ccf9 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_products_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_products_operations.py @@ -5,23 +5,273 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group: str, + registration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group: str, + registration_name: str, + product_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + "productName": _SERIALIZER.url("product_name", product_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_details_request( + subscription_id: str, + resource_group: str, + registration_name: str, + product_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/listDetails') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + "productName": _SERIALIZER.url("product_name", product_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_products_request( + subscription_id: str, + resource_group: str, + registration_name: str, + product_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProducts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + "productName": _SERIALIZER.url("product_name", product_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_product_request( + subscription_id: str, + resource_group: str, + registration_name: str, + product_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProduct') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + "productName": _SERIALIZER.url("product_name", product_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_upload_log_request( + subscription_id: str, + resource_group: str, + registration_name: str, + product_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/uploadProductLog') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + "productName": _SERIALIZER.url("product_name", product_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ProductsOperations(object): """ProductsOperations operations. @@ -45,13 +295,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group, # type: str - registration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProductList"] + resource_group: str, + registration_name: str, + **kwargs: Any + ) -> Iterable["_models.ProductList"]: """Returns a list of products. :param resource_group: Name of the resource group. @@ -68,36 +318,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProductList', pipeline_response) + deserialized = self._deserialize("ProductList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,25 +357,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products'} # type: ignore + @distributed_trace def get( self, - resource_group, # type: str - registration_name, # type: str - product_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Product" + resource_group: str, + registration_name: str, + product_name: str, + **kwargs: Any + ) -> "_models.Product": """Returns the specified product. :param resource_group: Name of the resource group. @@ -147,34 +395,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'productName': self._serialize.url("product_name", product_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + product_name=product_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Product', pipeline_response) @@ -183,16 +421,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}'} # type: ignore + + @distributed_trace def list_details( self, - resource_group, # type: str - registration_name, # type: str - product_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtendedProduct" + resource_group: str, + registration_name: str, + product_name: str, + **kwargs: Any + ) -> "_models.ExtendedProduct": """Returns the extended properties of a product. :param resource_group: Name of the resource group. @@ -211,34 +451,24 @@ def list_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'productName': self._serialize.url("product_name", product_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_details_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + product_name=product_name, + template_url=self.list_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtendedProduct', pipeline_response) @@ -247,17 +477,19 @@ def list_details( return cls(pipeline_response, deserialized, {}) return deserialized + list_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/listDetails'} # type: ignore + + @distributed_trace def get_products( self, - resource_group, # type: str - registration_name, # type: str - product_name, # type: str - device_configuration=None, # type: Optional["_models.DeviceConfiguration"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ProductList" + resource_group: str, + registration_name: str, + product_name: str, + device_configuration: Optional["_models.DeviceConfiguration"] = None, + **kwargs: Any + ) -> "_models.ProductList": """Returns a list of products. :param resource_group: Name of the resource group. @@ -278,42 +510,32 @@ def get_products( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_products.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'productName': self._serialize.url("product_name", product_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if device_configuration is not None: - body_content = self._serialize.body(device_configuration, 'DeviceConfiguration') + _json = self._serialize.body(device_configuration, 'DeviceConfiguration') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_get_products_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + product_name=product_name, + content_type=content_type, + json=_json, + template_url=self.get_products.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ProductList', pipeline_response) @@ -322,17 +544,19 @@ def get_products( return cls(pipeline_response, deserialized, {}) return deserialized + get_products.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProducts'} # type: ignore + + @distributed_trace def get_product( self, - resource_group, # type: str - registration_name, # type: str - product_name, # type: str - device_configuration=None, # type: Optional["_models.DeviceConfiguration"] - **kwargs # type: Any - ): - # type: (...) -> "_models.Product" + resource_group: str, + registration_name: str, + product_name: str, + device_configuration: Optional["_models.DeviceConfiguration"] = None, + **kwargs: Any + ) -> "_models.Product": """Returns the specified product. :param resource_group: Name of the resource group. @@ -353,42 +577,32 @@ def get_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_product.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'productName': self._serialize.url("product_name", product_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if device_configuration is not None: - body_content = self._serialize.body(device_configuration, 'DeviceConfiguration') + _json = self._serialize.body(device_configuration, 'DeviceConfiguration') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_get_product_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + product_name=product_name, + content_type=content_type, + json=_json, + template_url=self.get_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Product', pipeline_response) @@ -397,17 +611,19 @@ def get_product( return cls(pipeline_response, deserialized, {}) return deserialized + get_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProduct'} # type: ignore + + @distributed_trace def upload_log( self, - resource_group, # type: str - registration_name, # type: str - product_name, # type: str - marketplace_product_log_update=None, # type: Optional["_models.MarketplaceProductLogUpdate"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ProductLog" + resource_group: str, + registration_name: str, + product_name: str, + marketplace_product_log_update: Optional["_models.MarketplaceProductLogUpdate"] = None, + **kwargs: Any + ) -> "_models.ProductLog": """Returns the specified product. :param resource_group: Name of the resource group. @@ -428,42 +644,32 @@ def upload_log( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.upload_log.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - 'productName': self._serialize.url("product_name", product_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if marketplace_product_log_update is not None: - body_content = self._serialize.body(marketplace_product_log_update, 'MarketplaceProductLogUpdate') + _json = self._serialize.body(marketplace_product_log_update, 'MarketplaceProductLogUpdate') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_upload_log_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + product_name=product_name, + content_type=content_type, + json=_json, + template_url=self.upload_log.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ProductLog', pipeline_response) @@ -472,4 +678,6 @@ def upload_log( return cls(pipeline_response, deserialized, {}) return deserialized + upload_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/uploadProductLog'} # type: ignore + diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_registrations_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_registrations_operations.py index 043eed7022ed..c7885bf4b2fd 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_registrations_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_registrations_operations.py @@ -5,23 +5,312 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStack/registrations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group: str, + registration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group: str, + registration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group: str, + registration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group: str, + registration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_activation_key_request( + subscription_id: str, + resource_group: str, + registration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/getactivationkey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_enable_remote_management_request( + subscription_id: str, + resource_group: str, + registration_name: str, + **kwargs: Any +) -> HttpRequest: + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/enableRemoteManagement') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroup": _SERIALIZER.url("resource_group", resource_group, 'str'), + "registrationName": _SERIALIZER.url("registration_name", registration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) class RegistrationsOperations(object): """RegistrationsOperations operations. @@ -45,12 +334,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RegistrationList"] + resource_group: str, + **kwargs: Any + ) -> Iterable["_models.RegistrationList"]: """Returns a list of all registrations. :param resource_group: Name of the resource group. @@ -65,35 +354,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegistrationList', pipeline_response) + deserialized = self._deserialize("RegistrationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,24 +391,89 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations'} # type: ignore + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.RegistrationList"]: + """Returns a list of all registrations under current subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegistrationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestack.models.RegistrationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistrationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RegistrationList", 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStack/registrations'} # type: ignore + + @distributed_trace def get( self, - resource_group, # type: str - registration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Registration" + resource_group: str, + registration_name: str, + **kwargs: Any + ) -> "_models.Registration": """Returns the properties of an Azure Stack registration. :param resource_group: Name of the resource group. @@ -140,33 +490,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-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'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Registration', pipeline_response) @@ -175,15 +515,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group, # type: str - registration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group: str, + registration_name: str, + **kwargs: Any + ) -> None: """Delete the requested Azure Stack registration. :param resource_group: Name of the resource group. @@ -200,33 +542,23 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -234,14 +566,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group, # type: str - registration_name, # type: str - token, # type: "_models.RegistrationParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registration" + resource_group: str, + registration_name: str, + token: "_models.RegistrationParameter", + **kwargs: Any + ) -> "_models.Registration": """Create or update an Azure Stack registration. :param resource_group: Name of the resource group. @@ -260,38 +593,28 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token, 'RegistrationParameter') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token, 'RegistrationParameter') - 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -304,16 +627,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'} # type: ignore + + @distributed_trace def update( self, - resource_group, # type: str - registration_name, # type: str - token, # type: "_models.RegistrationParameter" - **kwargs # type: Any - ): - # type: (...) -> "_models.Registration" + resource_group: str, + registration_name: str, + token: "_models.RegistrationParameter", + **kwargs: Any + ) -> "_models.Registration": """Patch an Azure Stack registration. :param resource_group: Name of the resource group. @@ -332,38 +657,28 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(token, 'RegistrationParameter') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(token, 'RegistrationParameter') - 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Registration', pipeline_response) @@ -372,15 +687,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'} # type: ignore + + @distributed_trace def get_activation_key( self, - resource_group, # type: str - registration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ActivationKeyResult" + resource_group: str, + registration_name: str, + **kwargs: Any + ) -> "_models.ActivationKeyResult": """Returns Azure Stack Activation Key. :param resource_group: Name of the resource group. @@ -397,33 +714,23 @@ def get_activation_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_activation_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_activation_key_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.get_activation_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivationKeyResult', pipeline_response) @@ -432,15 +739,17 @@ def get_activation_key( return cls(pipeline_response, deserialized, {}) return deserialized + get_activation_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/getactivationkey'} # type: ignore + + @distributed_trace def enable_remote_management( self, - resource_group, # type: str - registration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group: str, + registration_name: str, + **kwargs: Any + ) -> None: """Enables remote management for device under the Azure Stack registration. :param resource_group: Name of the resource group. @@ -457,34 +766,27 @@ def enable_remote_management( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/json" - - # Construct URL - url = self.enable_remote_management.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_remote_management_request( + subscription_id=self._config.subscription_id, + resource_group=resource_group, + registration_name=registration_name, + template_url=self.enable_remote_management.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) enable_remote_management.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/enableRemoteManagement'} # type: ignore +