diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/_meta.json b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/_meta.json index 4c290e0bfeb0..b951c2684f63 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/_meta.json +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.0", - "@autorest/modelerfour@4.19.1" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "d58622331b5775038608c0cc6dc6d76f1543bf47", + "commit": "7abc4511b9cac664f6d977b6c5de789dabe45c1a", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/deploymentmanager/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.1 --version=3.4.2", + "autorest_command": "autorest specification/deploymentmanager/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/deploymentmanager/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/__init__.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/__init__.py index 96f7cf2fb38e..258b33f35226 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/__init__.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AzureDeploymentManager'] -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/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_azure_deployment_manager.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_azure_deployment_manager.py index e54be67b9b3a..107273eb6129 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_azure_deployment_manager.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_azure_deployment_manager.py @@ -6,34 +6,27 @@ # 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 AzureDeploymentManagerConfiguration +from .operations import ArtifactSourcesOperations, Operations, RolloutsOperations, ServiceTopologiesOperations, ServiceUnitsOperations, ServicesOperations, StepsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import AzureDeploymentManagerConfiguration -from .operations import ServiceTopologiesOperations -from .operations import ServicesOperations -from .operations import ServiceUnitsOperations -from .operations import StepsOperations -from .operations import RolloutsOperations -from .operations import ArtifactSourcesOperations -from .operations import Operations -from . import models - -class AzureDeploymentManager(object): +class AzureDeploymentManager: """REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM). See https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. :ivar service_topologies: ServiceTopologiesOperations operations - :vartype service_topologies: azure.mgmt.deploymentmanager.operations.ServiceTopologiesOperations + :vartype service_topologies: + azure.mgmt.deploymentmanager.operations.ServiceTopologiesOperations :ivar services: ServicesOperations operations :vartype services: azure.mgmt.deploymentmanager.operations.ServicesOperations :ivar service_units: ServiceUnitsOperations operations @@ -48,62 +41,63 @@ class AzureDeploymentManager(object): :vartype operations: azure.mgmt.deploymentmanager.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which 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 - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureDeploymentManagerConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureDeploymentManagerConfiguration(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.service_topologies = ServiceTopologiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_units = ServiceUnitsOperations(self._client, self._config, self._serialize, self._deserialize) + self.steps = StepsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rollouts = RolloutsOperations(self._client, self._config, self._serialize, self._deserialize) + self.artifact_sources = ArtifactSourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.service_topologies = ServiceTopologiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.service_units = ServiceUnitsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.steps = StepsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rollouts = RolloutsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.artifact_sources = ArtifactSourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_configuration.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_configuration.py index b76d6075bf67..193c6f7995b3 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_configuration.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_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 AzureDeploymentManagerConfiguration(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(AzureDeploymentManagerConfiguration, 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(AzureDeploymentManagerConfiguration, 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/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_metadata.json b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_metadata.json index 764c958e3dfa..d255a451258a 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_metadata.json +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_metadata.json @@ -5,13 +5,13 @@ "name": "AzureDeploymentManager", "filename": "_azure_deployment_manager", "description": "REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM). See https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureDeploymentManagerConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureDeploymentManagerConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureDeploymentManagerConfiguration\"]}}, \"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\": [\"AzureDeploymentManagerConfiguration\"]}}, \"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": { "service_topologies": "ServiceTopologiesOperations", diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_patch.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_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/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_vendor.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_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/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_version.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_version.py index c47f66669f1b..06919be30fe3 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_version.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/_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 = "0.9.1" diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/__init__.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/__init__.py index 739fcaf517e9..a5c58527c514 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/__init__.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_deployment_manager import AzureDeploymentManager __all__ = ['AzureDeploymentManager'] + +# `._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/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/_azure_deployment_manager.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/_azure_deployment_manager.py index 5f515a3e52af..61ac57533864 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/_azure_deployment_manager.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/_azure_deployment_manager.py @@ -6,32 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AzureDeploymentManagerConfiguration +from .operations import ArtifactSourcesOperations, Operations, RolloutsOperations, ServiceTopologiesOperations, ServiceUnitsOperations, ServicesOperations, StepsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AzureDeploymentManagerConfiguration -from .operations import ServiceTopologiesOperations -from .operations import ServicesOperations -from .operations import ServiceUnitsOperations -from .operations import StepsOperations -from .operations import RolloutsOperations -from .operations import ArtifactSourcesOperations -from .operations import Operations -from .. import models - - -class AzureDeploymentManager(object): +class AzureDeploymentManager: """REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM). See https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. :ivar service_topologies: ServiceTopologiesOperations operations - :vartype service_topologies: azure.mgmt.deploymentmanager.aio.operations.ServiceTopologiesOperations + :vartype service_topologies: + azure.mgmt.deploymentmanager.aio.operations.ServiceTopologiesOperations :ivar services: ServicesOperations operations :vartype services: azure.mgmt.deploymentmanager.aio.operations.ServicesOperations :ivar service_units: ServiceUnitsOperations operations @@ -41,65 +36,69 @@ class AzureDeploymentManager(object): :ivar rollouts: RolloutsOperations operations :vartype rollouts: azure.mgmt.deploymentmanager.aio.operations.RolloutsOperations :ivar artifact_sources: ArtifactSourcesOperations operations - :vartype artifact_sources: azure.mgmt.deploymentmanager.aio.operations.ArtifactSourcesOperations + :vartype artifact_sources: + azure.mgmt.deploymentmanager.aio.operations.ArtifactSourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.deploymentmanager.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which 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 - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureDeploymentManagerConfiguration(credential, subscription_id, **kwargs) + self._config = AzureDeploymentManagerConfiguration(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.service_topologies = ServiceTopologiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_units = ServiceUnitsOperations(self._client, self._config, self._serialize, self._deserialize) + self.steps = StepsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rollouts = RolloutsOperations(self._client, self._config, self._serialize, self._deserialize) + self.artifact_sources = ArtifactSourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + - self.service_topologies = ServiceTopologiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.service_units = ServiceUnitsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.steps = StepsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rollouts = RolloutsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.artifact_sources = ArtifactSourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/_configuration.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/_configuration.py index 82439a30c2d1..619bde1e036a 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/_configuration.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/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(AzureDeploymentManagerConfiguration, 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(AzureDeploymentManagerConfiguration, 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/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/_patch.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/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/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_artifact_sources_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_artifact_sources_operations.py index e254d9d7203d..e00fab09b3f5 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_artifact_sources_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_artifact_sources_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, List, 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._artifact_sources_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -67,35 +72,25 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'artifactSourceName': self._serialize.url("artifact_source_name", artifact_source_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 artifact_source_info is not None: - body_content = self._serialize.body(artifact_source_info, 'ArtifactSource') + _json = self._serialize.body(artifact_source_info, 'ArtifactSource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + artifact_source_name=artifact_source_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) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,8 +104,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -135,27 +133,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'artifactSourceName': self._serialize.url("artifact_source_name", artifact_source_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + artifact_source_name=artifact_source_name, + template_url=self.get.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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,8 +157,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,27 +186,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'artifactSourceName': self._serialize.url("artifact_source_name", artifact_source_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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + artifact_source_name=artifact_source_name, + template_url=self.delete.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.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -228,6 +209,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -249,26 +232,16 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,4 +255,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_operations.py index d70227b9208f..66be723bdabb 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_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._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, **kwargs: Any @@ -58,21 +63,14 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 @@ -86,4 +84,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.DeploymentManager/operations'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_rollouts_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_rollouts_operations.py index 3e790f1835a9..165509b2f93b 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_rollouts_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_rollouts_operations.py @@ -5,18 +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, Callable, Dict, Generic, List, Optional, TypeVar, Union 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._rollouts_operations import build_cancel_request, build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_request, build_restart_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,35 +58,25 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_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 rollout_request is not None: - body_content = self._serialize.body(rollout_request, 'RolloutRequest') + _json = self._serialize.body(rollout_request, 'RolloutRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + rollout_name=rollout_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -92,14 +86,18 @@ async def _create_or_update_initial( response_headers = {} response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('RolloutRequest', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -120,15 +118,19 @@ async def begin_create_or_update( :type rollout_request: ~azure.mgmt.deploymentmanager.models.RolloutRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RolloutRequest or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RolloutRequest or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deploymentmanager.models.RolloutRequest] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RolloutRequest"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,30 +142,24 @@ async def begin_create_or_update( resource_group_name=resource_group_name, rollout_name=rollout_name, rollout_request=rollout_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('RolloutRequest', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -175,8 +171,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -205,29 +203,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_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') - if retry_attempt is not None: - query_parameters['retryAttempt'] = self._serialize.query("retry_attempt", retry_attempt, 'int') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + rollout_name=rollout_name, + retry_attempt=retry_attempt, + 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 @@ -241,8 +228,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -267,27 +257,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_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_name=resource_group_name, + rollout_name=rollout_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 @@ -300,6 +280,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'} # type: ignore + + @distributed_trace_async async def cancel( self, resource_group_name: str, @@ -324,27 +306,17 @@ async def cancel( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.cancel.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_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_cancel_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + rollout_name=rollout_name, + template_url=self.cancel.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 @@ -358,8 +330,11 @@ async def cancel( return cls(pipeline_response, deserialized, {}) return deserialized + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}/cancel'} # type: ignore + + @distributed_trace_async async def restart( self, resource_group_name: str, @@ -389,29 +364,18 @@ async def restart( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.restart.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if skip_succeeded is not None: - query_parameters['skipSucceeded'] = self._serialize.query("skip_succeeded", skip_succeeded, 'bool') - 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_restart_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + rollout_name=rollout_name, + skip_succeeded=skip_succeeded, + template_url=self.restart.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 @@ -425,8 +389,11 @@ async def restart( return cls(pipeline_response, deserialized, {}) return deserialized + restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}/restart'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -448,26 +415,16 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -481,4 +438,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_service_topologies_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_service_topologies_operations.py index 3077d154d8f4..fdcb9df74b34 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_service_topologies_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_service_topologies_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, List, 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._service_topologies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -67,32 +72,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_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(service_topology_info, 'ServiceTopologyResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_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(service_topology_info, 'ServiceTopologyResource') - 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 @@ -106,8 +101,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -132,27 +130,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + template_url=self.get.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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -166,8 +154,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -192,27 +183,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + template_url=self.delete.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.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -225,6 +206,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -246,26 +229,16 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -279,4 +252,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_service_units_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_service_units_operations.py index 7f69f4c20f8a..b7aa85829572 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_service_units_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_service_units_operations.py @@ -5,18 +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, Callable, Dict, Generic, List, Optional, TypeVar, Union 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._service_units_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,34 +60,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceUnitName': self._serialize.url("service_unit_name", service_unit_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(service_unit_info, 'ServiceUnitResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + service_unit_name=service_unit_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(service_unit_info, 'ServiceUnitResource') - 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 @@ -93,14 +87,18 @@ async def _create_or_update_initial( response_headers = {} response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('ServiceUnitResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -127,15 +125,20 @@ async def begin_create_or_update( :type service_unit_info: ~azure.mgmt.deploymentmanager.models.ServiceUnitResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceUnitResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deploymentmanager.models.ServiceUnitResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceUnitResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deploymentmanager.models.ServiceUnitResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceUnitResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,32 +152,24 @@ async def begin_create_or_update( service_name=service_name, service_unit_name=service_unit_name, service_unit_info=service_unit_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('ServiceUnitResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceUnitName': self._serialize.url("service_unit_name", service_unit_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -186,8 +181,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -218,29 +215,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceUnitName': self._serialize.url("service_unit_name", service_unit_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + service_unit_name=service_unit_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 @@ -254,8 +241,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -286,29 +276,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceUnitName': self._serialize.url("service_unit_name", service_unit_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_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + service_unit_name=service_unit_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 @@ -321,6 +301,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -348,28 +330,18 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + 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 @@ -383,4 +355,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_services_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_services_operations.py index acea1bacf974..50295b89fae8 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_services_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_services_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, List, 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._services_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -70,33 +75,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_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(service_info, 'ServiceResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_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(service_info, 'ServiceResource') - 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 @@ -110,8 +105,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -139,28 +137,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + template_url=self.get.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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -174,8 +162,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -203,28 +194,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + template_url=self.delete.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.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,6 +218,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -261,27 +244,17 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + 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 @@ -295,4 +268,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_steps_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_steps_operations.py index dd00f347d768..a8af2d9dba18 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_steps_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/aio/operations/_steps_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, List, 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._steps_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -67,35 +72,25 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'stepName': self._serialize.url("step_name", step_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 step_info is not None: - body_content = self._serialize.body(step_info, 'StepResource') + _json = self._serialize.body(step_info, 'StepResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + step_name=step_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) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,8 +104,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -135,27 +133,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'stepName': self._serialize.url("step_name", step_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + step_name=step_name, + template_url=self.get.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 = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,8 +157,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -195,27 +186,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'stepName': self._serialize.url("step_name", step_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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + step_name=step_name, + template_url=self.delete.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.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -228,6 +209,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -249,26 +232,16 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -282,4 +255,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/__init__.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/__init__.py index cc8ac258fd67..cf6bae6a5e90 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/__init__.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/__init__.py @@ -6,108 +6,57 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ApiKeyAuthentication - from ._models_py3 import ArtifactSource - from ._models_py3 import ArtifactSourceProperties - from ._models_py3 import ArtifactSourcePropertiesAutoGenerated - from ._models_py3 import Authentication - from ._models_py3 import CloudErrorBody - from ._models_py3 import HealthCheckStepAttributes - from ._models_py3 import HealthCheckStepProperties - from ._models_py3 import Identity - from ._models_py3 import Message - from ._models_py3 import Operation - from ._models_py3 import OperationDetail - from ._models_py3 import OperationsList - from ._models_py3 import PrePostStep - from ._models_py3 import Resource - from ._models_py3 import ResourceOperation - from ._models_py3 import RestHealthCheck - from ._models_py3 import RestHealthCheckStepAttributes - from ._models_py3 import RestRequest - from ._models_py3 import RestRequestAuthentication - from ._models_py3 import RestResponse - from ._models_py3 import RestResponseRegex - from ._models_py3 import Rollout - from ._models_py3 import RolloutIdentityAuthentication - from ._models_py3 import RolloutOperationInfo - from ._models_py3 import RolloutProperties - from ._models_py3 import RolloutPropertiesAutoGenerated - from ._models_py3 import RolloutRequest - from ._models_py3 import RolloutRequestProperties - from ._models_py3 import RolloutStep - from ._models_py3 import SasAuthentication - from ._models_py3 import Service - from ._models_py3 import ServiceProperties - from ._models_py3 import ServiceResource - from ._models_py3 import ServiceResourceProperties - from ._models_py3 import ServiceTopologyProperties - from ._models_py3 import ServiceTopologyResource - from ._models_py3 import ServiceTopologyResourceProperties - from ._models_py3 import ServiceUnit - from ._models_py3 import ServiceUnitArtifacts - from ._models_py3 import ServiceUnitProperties - from ._models_py3 import ServiceUnitResource - from ._models_py3 import ServiceUnitResourceProperties - from ._models_py3 import StepGroup - from ._models_py3 import StepOperationInfo - from ._models_py3 import StepProperties - from ._models_py3 import StepResource - from ._models_py3 import TrackedResource - from ._models_py3 import WaitStepAttributes - from ._models_py3 import WaitStepProperties -except (SyntaxError, ImportError): - from ._models import ApiKeyAuthentication # type: ignore - from ._models import ArtifactSource # type: ignore - from ._models import ArtifactSourceProperties # type: ignore - from ._models import ArtifactSourcePropertiesAutoGenerated # type: ignore - from ._models import Authentication # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import HealthCheckStepAttributes # type: ignore - from ._models import HealthCheckStepProperties # type: ignore - from ._models import Identity # type: ignore - from ._models import Message # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationsList # type: ignore - from ._models import PrePostStep # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceOperation # type: ignore - from ._models import RestHealthCheck # type: ignore - from ._models import RestHealthCheckStepAttributes # type: ignore - from ._models import RestRequest # type: ignore - from ._models import RestRequestAuthentication # type: ignore - from ._models import RestResponse # type: ignore - from ._models import RestResponseRegex # type: ignore - from ._models import Rollout # type: ignore - from ._models import RolloutIdentityAuthentication # type: ignore - from ._models import RolloutOperationInfo # type: ignore - from ._models import RolloutProperties # type: ignore - from ._models import RolloutPropertiesAutoGenerated # type: ignore - from ._models import RolloutRequest # type: ignore - from ._models import RolloutRequestProperties # type: ignore - from ._models import RolloutStep # type: ignore - from ._models import SasAuthentication # type: ignore - from ._models import Service # type: ignore - from ._models import ServiceProperties # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceProperties # type: ignore - from ._models import ServiceTopologyProperties # type: ignore - from ._models import ServiceTopologyResource # type: ignore - from ._models import ServiceTopologyResourceProperties # type: ignore - from ._models import ServiceUnit # type: ignore - from ._models import ServiceUnitArtifacts # type: ignore - from ._models import ServiceUnitProperties # type: ignore - from ._models import ServiceUnitResource # type: ignore - from ._models import ServiceUnitResourceProperties # type: ignore - from ._models import StepGroup # type: ignore - from ._models import StepOperationInfo # type: ignore - from ._models import StepProperties # type: ignore - from ._models import StepResource # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import WaitStepAttributes # type: ignore - from ._models import WaitStepProperties # type: ignore +from ._models_py3 import ApiKeyAuthentication +from ._models_py3 import ArtifactSource +from ._models_py3 import ArtifactSourceProperties +from ._models_py3 import ArtifactSourcePropertiesAutoGenerated +from ._models_py3 import Authentication +from ._models_py3 import CloudErrorBody +from ._models_py3 import HealthCheckStepAttributes +from ._models_py3 import HealthCheckStepProperties +from ._models_py3 import Identity +from ._models_py3 import Message +from ._models_py3 import Operation +from ._models_py3 import OperationDetail +from ._models_py3 import OperationsList +from ._models_py3 import PrePostStep +from ._models_py3 import Resource +from ._models_py3 import ResourceOperation +from ._models_py3 import RestHealthCheck +from ._models_py3 import RestHealthCheckStepAttributes +from ._models_py3 import RestRequest +from ._models_py3 import RestRequestAuthentication +from ._models_py3 import RestResponse +from ._models_py3 import RestResponseRegex +from ._models_py3 import Rollout +from ._models_py3 import RolloutIdentityAuthentication +from ._models_py3 import RolloutOperationInfo +from ._models_py3 import RolloutProperties +from ._models_py3 import RolloutPropertiesAutoGenerated +from ._models_py3 import RolloutRequest +from ._models_py3 import RolloutRequestProperties +from ._models_py3 import RolloutStep +from ._models_py3 import SasAuthentication +from ._models_py3 import Service +from ._models_py3 import ServiceProperties +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceProperties +from ._models_py3 import ServiceTopologyProperties +from ._models_py3 import ServiceTopologyResource +from ._models_py3 import ServiceTopologyResourceProperties +from ._models_py3 import ServiceUnit +from ._models_py3 import ServiceUnitArtifacts +from ._models_py3 import ServiceUnitProperties +from ._models_py3 import ServiceUnitResource +from ._models_py3 import ServiceUnitResourceProperties +from ._models_py3 import StepGroup +from ._models_py3 import StepOperationInfo +from ._models_py3 import StepProperties +from ._models_py3 import StepResource +from ._models_py3 import TrackedResource +from ._models_py3 import WaitStepAttributes +from ._models_py3 import WaitStepProperties + from ._azure_deployment_manager_enums import ( DeploymentMode, diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_azure_deployment_manager_enums.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_azure_deployment_manager_enums.py index 0d443b76af0b..3cd5001dc7bf 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_azure_deployment_manager_enums.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_azure_deployment_manager_enums.py @@ -6,62 +6,47 @@ # 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 DeploymentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes the type of ARM deployment to be performed on the resource. """ INCREMENTAL = "Incremental" COMPLETE = "Complete" -class RestAuthLocation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RestAuthLocation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The location of the authentication key/value pair in the request. """ QUERY = "Query" HEADER = "Header" -class RestAuthType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RestAuthType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication type. """ API_KEY = "ApiKey" ROLLOUT_IDENTITY = "RolloutIdentity" -class RestMatchQuantifier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RestMatchQuantifier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether any or all of the expressions should match with the response content. """ ALL = "All" ANY = "Any" -class RestRequestMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RestRequestMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The HTTP method to use for the request. """ GET = "GET" POST = "POST" -class StepType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StepType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of step. """ diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_models.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_models.py deleted file mode 100644 index 835f1ee92ccd..000000000000 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_models.py +++ /dev/null @@ -1,1969 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class RestRequestAuthentication(msrest.serialization.Model): - """The authentication information required in the REST health check request to the health provider. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ApiKeyAuthentication, RolloutIdentityAuthentication. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The authentication type.Constant filled by server. Possible values - include: "ApiKey", "RolloutIdentity". - :type type: str or ~azure.mgmt.deploymentmanager.models.RestAuthType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'ApiKey': 'ApiKeyAuthentication', 'RolloutIdentity': 'RolloutIdentityAuthentication'} - } - - def __init__( - self, - **kwargs - ): - super(RestRequestAuthentication, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class ApiKeyAuthentication(RestRequestAuthentication): - """ApiKey authentication gives a name and a value that can be included in either the request header or query parameters. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The authentication type.Constant filled by server. Possible values - include: "ApiKey", "RolloutIdentity". - :type type: str or ~azure.mgmt.deploymentmanager.models.RestAuthType - :param name: Required. The key name of the authentication key/value pair. - :type name: str - :param in_property: Required. The location of the authentication key/value pair in the request. - Possible values include: "Query", "Header". - :type in_property: str or ~azure.mgmt.deploymentmanager.models.RestAuthLocation - :param value: Required. The value of the authentication key/value pair. - :type value: str - """ - - _validation = { - 'type': {'required': True}, - 'name': {'required': True}, - 'in_property': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'in_property': {'key': 'in', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApiKeyAuthentication, self).__init__(**kwargs) - self.type = 'ApiKey' # type: str - self.name = kwargs['name'] - self.in_property = kwargs['in_property'] - self.value = kwargs['value'] - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class ArtifactSource(TrackedResource): - """The resource that defines the source location where the artifacts are located. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param source_type: The type of artifact source used. - :type source_type: str - :param artifact_root: The path from the location that the 'authentication' property [say, a SAS - URI to the blob container] refers to, to the location of the artifacts. This can be used to - differentiate different versions of the artifacts. Or, different types of artifacts like - binaries or templates. The location referenced by the authentication property concatenated with - this optional artifactRoot path forms the artifact source location where the artifacts are - expected to be found. - :type artifact_root: str - :param authentication: The authentication method to use to access the artifact source. - :type authentication: ~azure.mgmt.deploymentmanager.models.Authentication - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'source_type': {'key': 'properties.sourceType', 'type': 'str'}, - 'artifact_root': {'key': 'properties.artifactRoot', 'type': 'str'}, - 'authentication': {'key': 'properties.authentication', 'type': 'Authentication'}, - } - - def __init__( - self, - **kwargs - ): - super(ArtifactSource, self).__init__(**kwargs) - self.source_type = kwargs.get('source_type', None) - self.artifact_root = kwargs.get('artifact_root', None) - self.authentication = kwargs.get('authentication', None) - - -class ArtifactSourceProperties(msrest.serialization.Model): - """The properties that define the source location where the artifacts are located. - - All required parameters must be populated in order to send to Azure. - - :param source_type: Required. The type of artifact source used. - :type source_type: str - :param artifact_root: The path from the location that the 'authentication' property [say, a SAS - URI to the blob container] refers to, to the location of the artifacts. This can be used to - differentiate different versions of the artifacts. Or, different types of artifacts like - binaries or templates. The location referenced by the authentication property concatenated with - this optional artifactRoot path forms the artifact source location where the artifacts are - expected to be found. - :type artifact_root: str - :param authentication: Required. The authentication method to use to access the artifact - source. - :type authentication: ~azure.mgmt.deploymentmanager.models.Authentication - """ - - _validation = { - 'source_type': {'required': True}, - 'authentication': {'required': True}, - } - - _attribute_map = { - 'source_type': {'key': 'sourceType', 'type': 'str'}, - 'artifact_root': {'key': 'artifactRoot', 'type': 'str'}, - 'authentication': {'key': 'authentication', 'type': 'Authentication'}, - } - - def __init__( - self, - **kwargs - ): - super(ArtifactSourceProperties, self).__init__(**kwargs) - self.source_type = kwargs['source_type'] - self.artifact_root = kwargs.get('artifact_root', None) - self.authentication = kwargs['authentication'] - - -class ArtifactSourcePropertiesAutoGenerated(ArtifactSourceProperties): - """The properties that define the artifact source. - - All required parameters must be populated in order to send to Azure. - - :param source_type: Required. The type of artifact source used. - :type source_type: str - :param artifact_root: The path from the location that the 'authentication' property [say, a SAS - URI to the blob container] refers to, to the location of the artifacts. This can be used to - differentiate different versions of the artifacts. Or, different types of artifacts like - binaries or templates. The location referenced by the authentication property concatenated with - this optional artifactRoot path forms the artifact source location where the artifacts are - expected to be found. - :type artifact_root: str - :param authentication: Required. The authentication method to use to access the artifact - source. - :type authentication: ~azure.mgmt.deploymentmanager.models.Authentication - """ - - _validation = { - 'source_type': {'required': True}, - 'authentication': {'required': True}, - } - - _attribute_map = { - 'source_type': {'key': 'sourceType', 'type': 'str'}, - 'artifact_root': {'key': 'artifactRoot', 'type': 'str'}, - 'authentication': {'key': 'authentication', 'type': 'Authentication'}, - } - - def __init__( - self, - **kwargs - ): - super(ArtifactSourcePropertiesAutoGenerated, self).__init__(**kwargs) - - -class Authentication(msrest.serialization.Model): - """Defines the authentication method and properties to access the artifacts. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SasAuthentication. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The authentication type.Constant filled by server. - :type type: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Sas': 'SasAuthentication'} - } - - def __init__( - self, - **kwargs - ): - super(Authentication, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class CloudErrorBody(msrest.serialization.Model): - """Detailed error information of any failure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code string. - :vartype code: str - :ivar message: Descriptive error information. - :vartype message: str - :param target: Error target. - :type target: str - :param details: More detailed error information. - :type details: list[~azure.mgmt.deploymentmanager.models.CloudErrorBody] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class HealthCheckStepAttributes(msrest.serialization.Model): - """The attributes for the health check step. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: RestHealthCheckStepAttributes. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of health check.Constant filled by server. - :type type: str - :param wait_duration: The duration in ISO 8601 format for which health check waits idly without - any checks. - :type wait_duration: str - :param max_elastic_duration: The duration in ISO 8601 format for which the health check waits - for the resource to become healthy. Health check fails if it doesn't. Health check starts to - enforce healthyStateDuration once resource becomes healthy. - :type max_elastic_duration: str - :param healthy_state_duration: Required. The duration in ISO 8601 format for which the resource - is expected to be continuously healthy. If maxElasticDuration is specified, healthy state - duration is enforced after the detection of first healthy signal. - :type healthy_state_duration: str - """ - - _validation = { - 'type': {'required': True}, - 'healthy_state_duration': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'wait_duration': {'key': 'waitDuration', 'type': 'str'}, - 'max_elastic_duration': {'key': 'maxElasticDuration', 'type': 'str'}, - 'healthy_state_duration': {'key': 'healthyStateDuration', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'REST': 'RestHealthCheckStepAttributes'} - } - - def __init__( - self, - **kwargs - ): - super(HealthCheckStepAttributes, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.wait_duration = kwargs.get('wait_duration', None) - self.max_elastic_duration = kwargs.get('max_elastic_duration', None) - self.healthy_state_duration = kwargs['healthy_state_duration'] - - -class StepProperties(msrest.serialization.Model): - """The properties of a step resource. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: HealthCheckStepProperties, WaitStepProperties. - - All required parameters must be populated in order to send to Azure. - - :param step_type: Required. The type of step.Constant filled by server. Possible values - include: "Wait", "HealthCheck". - :type step_type: str or ~azure.mgmt.deploymentmanager.models.StepType - """ - - _validation = { - 'step_type': {'required': True}, - } - - _attribute_map = { - 'step_type': {'key': 'stepType', 'type': 'str'}, - } - - _subtype_map = { - 'step_type': {'HealthCheck': 'HealthCheckStepProperties', 'Wait': 'WaitStepProperties'} - } - - def __init__( - self, - **kwargs - ): - super(StepProperties, self).__init__(**kwargs) - self.step_type = None # type: Optional[str] - - -class HealthCheckStepProperties(StepProperties): - """Defines the properties of a health check step. - - All required parameters must be populated in order to send to Azure. - - :param step_type: Required. The type of step.Constant filled by server. Possible values - include: "Wait", "HealthCheck". - :type step_type: str or ~azure.mgmt.deploymentmanager.models.StepType - :param attributes: Required. The health check step attributes. - :type attributes: ~azure.mgmt.deploymentmanager.models.HealthCheckStepAttributes - """ - - _validation = { - 'step_type': {'required': True}, - 'attributes': {'required': True}, - } - - _attribute_map = { - 'step_type': {'key': 'stepType', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'HealthCheckStepAttributes'}, - } - - def __init__( - self, - **kwargs - ): - super(HealthCheckStepProperties, self).__init__(**kwargs) - self.step_type = 'HealthCheck' # type: str - self.attributes = kwargs['attributes'] - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The identity type. - :type type: str - :param identity_ids: Required. The list of identities. - :type identity_ids: list[str] - """ - - _validation = { - 'type': {'required': True}, - 'identity_ids': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'identity_ids': {'key': 'identityIds', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.type = kwargs['type'] - self.identity_ids = kwargs['identity_ids'] - - -class Message(msrest.serialization.Model): - """Supplementary contextual messages during a rollout. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar time_stamp: Time in UTC this message was provided. - :vartype time_stamp: ~datetime.datetime - :ivar message: The actual message text. - :vartype message: str - """ - - _validation = { - 'time_stamp': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Message, self).__init__(**kwargs) - self.time_stamp = None - self.message = None - - -class Operation(msrest.serialization.Model): - """Represents an operation that can be performed on the service. - - :param name: The name of the operation. - :type name: str - :param display: The display name of the operation. - :type display: ~azure.mgmt.deploymentmanager.models.OperationDetail - :param origin: The origin of the operation. - :type origin: str - :param properties: The properties of the operation. - :type properties: any - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDetail'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - 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) - self.properties = kwargs.get('properties', None) - - -class OperationDetail(msrest.serialization.Model): - """The detail about an operation. - - :param provider: The name of the provider that supports the operation. - :type provider: str - :param resource: The resource type on which this operation can be performed. - :type resource: str - :param operation: The name of the operation. - :type operation: str - :param description: The description of the operation. - :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(OperationDetail, 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 OperationsList(msrest.serialization.Model): - """The operations response. - - :param value: The list of supported operations. - :type value: ~azure.mgmt.deploymentmanager.models.Operation - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'Operation'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrePostStep(msrest.serialization.Model): - """The properties that define a step. - - All required parameters must be populated in order to send to Azure. - - :param step_id: Required. The resource Id of the step to be run. - :type step_id: str - """ - - _validation = { - 'step_id': {'required': True}, - } - - _attribute_map = { - 'step_id': {'key': 'stepId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrePostStep, self).__init__(**kwargs) - self.step_id = kwargs['step_id'] - - -class ResourceOperation(msrest.serialization.Model): - """Individual resource operation information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param resource_name: Name of the resource as specified in the artifacts. For ARM resources, - this is the name of the resource specified in the template. - :type resource_name: str - :ivar operation_id: Unique identifier of the operation. For ARM resources, this is the - operationId obtained from ARM service. - :vartype operation_id: str - :param resource_type: Type of the resource as specified in the artifacts. For ARM resources, - this is the type of the resource specified in the template. - :type resource_type: str - :ivar provisioning_state: State of the resource deployment. For ARM resources, this is the - current provisioning state of the resource. - :vartype provisioning_state: str - :ivar status_message: Descriptive information of the resource operation. - :vartype status_message: str - :ivar status_code: Http status code of the operation. - :vartype status_code: str - """ - - _validation = { - 'operation_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'status_message': {'readonly': True}, - 'status_code': {'readonly': True}, - } - - _attribute_map = { - 'resource_name': {'key': 'resourceName', 'type': 'str'}, - 'operation_id': {'key': 'operationId', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'status_message': {'key': 'statusMessage', 'type': 'str'}, - 'status_code': {'key': 'statusCode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceOperation, self).__init__(**kwargs) - self.resource_name = kwargs.get('resource_name', None) - self.operation_id = None - self.resource_type = kwargs.get('resource_type', None) - self.provisioning_state = None - self.status_message = None - self.status_code = None - - -class RestHealthCheck(msrest.serialization.Model): - """A REST based health check. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. A unique name for this check. - :type name: str - :param request: Required. The request to the health provider. - :type request: ~azure.mgmt.deploymentmanager.models.RestRequest - :param response: The expected response from the health provider. If no expected response is - provided, the default is to expect the received response to have an HTTP status code of 200 OK. - :type response: ~azure.mgmt.deploymentmanager.models.RestResponse - """ - - _validation = { - 'name': {'required': True}, - 'request': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'request': {'key': 'request', 'type': 'RestRequest'}, - 'response': {'key': 'response', 'type': 'RestResponse'}, - } - - def __init__( - self, - **kwargs - ): - super(RestHealthCheck, self).__init__(**kwargs) - self.name = kwargs['name'] - self.request = kwargs['request'] - self.response = kwargs.get('response', None) - - -class RestHealthCheckStepAttributes(HealthCheckStepAttributes): - """Defines the REST health check step properties. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of health check.Constant filled by server. - :type type: str - :param wait_duration: The duration in ISO 8601 format for which health check waits idly without - any checks. - :type wait_duration: str - :param max_elastic_duration: The duration in ISO 8601 format for which the health check waits - for the resource to become healthy. Health check fails if it doesn't. Health check starts to - enforce healthyStateDuration once resource becomes healthy. - :type max_elastic_duration: str - :param healthy_state_duration: Required. The duration in ISO 8601 format for which the resource - is expected to be continuously healthy. If maxElasticDuration is specified, healthy state - duration is enforced after the detection of first healthy signal. - :type healthy_state_duration: str - :param health_checks: The list of checks that form the health check step. - :type health_checks: list[~azure.mgmt.deploymentmanager.models.RestHealthCheck] - """ - - _validation = { - 'type': {'required': True}, - 'healthy_state_duration': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'wait_duration': {'key': 'waitDuration', 'type': 'str'}, - 'max_elastic_duration': {'key': 'maxElasticDuration', 'type': 'str'}, - 'healthy_state_duration': {'key': 'healthyStateDuration', 'type': 'str'}, - 'health_checks': {'key': 'properties.healthChecks', 'type': '[RestHealthCheck]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestHealthCheckStepAttributes, self).__init__(**kwargs) - self.type = 'REST' # type: str - self.health_checks = kwargs.get('health_checks', None) - - -class RestRequest(msrest.serialization.Model): - """The properties that make up a REST request. - - All required parameters must be populated in order to send to Azure. - - :param method: Required. The HTTP method to use for the request. Possible values include: - "GET", "POST". - :type method: str or ~azure.mgmt.deploymentmanager.models.RestRequestMethod - :param uri: Required. The HTTP URI to use for the request. - :type uri: str - :param authentication: Required. The authentication information required in the request to the - health provider. - :type authentication: ~azure.mgmt.deploymentmanager.models.RestRequestAuthentication - """ - - _validation = { - 'method': {'required': True}, - 'uri': {'required': True}, - 'authentication': {'required': True}, - } - - _attribute_map = { - 'method': {'key': 'method', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'authentication': {'key': 'authentication', 'type': 'RestRequestAuthentication'}, - } - - def __init__( - self, - **kwargs - ): - super(RestRequest, self).__init__(**kwargs) - self.method = kwargs['method'] - self.uri = kwargs['uri'] - self.authentication = kwargs['authentication'] - - -class RestResponse(msrest.serialization.Model): - """The properties that make up the expected REST response. - - :param success_status_codes: The HTTP status codes expected in a successful health check - response. The response is expected to match one of the given status codes. If no expected - status codes are provided, default expected status code is 200 OK. - :type success_status_codes: list[str] - :param regex: The regular expressions to match the response content with. - :type regex: ~azure.mgmt.deploymentmanager.models.RestResponseRegex - """ - - _attribute_map = { - 'success_status_codes': {'key': 'successStatusCodes', 'type': '[str]'}, - 'regex': {'key': 'regex', 'type': 'RestResponseRegex'}, - } - - def __init__( - self, - **kwargs - ): - super(RestResponse, self).__init__(**kwargs) - self.success_status_codes = kwargs.get('success_status_codes', None) - self.regex = kwargs.get('regex', None) - - -class RestResponseRegex(msrest.serialization.Model): - """The regular expressions to match the response content with. - - :param matches: The list of regular expressions. - :type matches: list[str] - :param match_quantifier: Indicates whether any or all of the expressions should match with the - response content. Possible values include: "All", "Any". - :type match_quantifier: str or ~azure.mgmt.deploymentmanager.models.RestMatchQuantifier - """ - - _attribute_map = { - 'matches': {'key': 'matches', 'type': '[str]'}, - 'match_quantifier': {'key': 'matchQuantifier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestResponseRegex, self).__init__(**kwargs) - self.matches = kwargs.get('matches', None) - self.match_quantifier = kwargs.get('match_quantifier', None) - - -class Rollout(TrackedResource): - """Defines the rollout. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.deploymentmanager.models.Identity - :param build_version: The version of the build being deployed. - :type build_version: str - :param artifact_source_id: The reference to the artifact source resource Id where the payload - is located. - :type artifact_source_id: str - :param target_service_topology_id: The resource Id of the service topology from which service - units are being referenced in step groups to be deployed. - :type target_service_topology_id: str - :param step_groups: The list of step groups that define the orchestration. - :type step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] - :ivar status: The current status of the rollout. - :vartype status: str - :ivar total_retry_attempts: The cardinal count of total number of retries performed on the - rollout at a given time. - :vartype total_retry_attempts: int - :ivar operation_info: Operational information of the rollout. - :vartype operation_info: ~azure.mgmt.deploymentmanager.models.RolloutOperationInfo - :ivar services: The detailed information on the services being deployed. - :vartype services: list[~azure.mgmt.deploymentmanager.models.Service] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'status': {'readonly': True}, - 'total_retry_attempts': {'readonly': True}, - 'operation_info': {'readonly': True}, - 'services': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'build_version': {'key': 'properties.buildVersion', 'type': 'str'}, - 'artifact_source_id': {'key': 'properties.artifactSourceId', 'type': 'str'}, - 'target_service_topology_id': {'key': 'properties.targetServiceTopologyId', 'type': 'str'}, - 'step_groups': {'key': 'properties.stepGroups', 'type': '[StepGroup]'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'total_retry_attempts': {'key': 'properties.totalRetryAttempts', 'type': 'int'}, - 'operation_info': {'key': 'properties.operationInfo', 'type': 'RolloutOperationInfo'}, - 'services': {'key': 'properties.services', 'type': '[Service]'}, - } - - def __init__( - self, - **kwargs - ): - super(Rollout, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.build_version = kwargs.get('build_version', None) - self.artifact_source_id = kwargs.get('artifact_source_id', None) - self.target_service_topology_id = kwargs.get('target_service_topology_id', None) - self.step_groups = kwargs.get('step_groups', None) - self.status = None - self.total_retry_attempts = None - self.operation_info = None - self.services = None - - -class RolloutIdentityAuthentication(RestRequestAuthentication): - """RolloutIdentity uses the user-assigned managed identity authentication context specified in the Identity property during rollout creation. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The authentication type.Constant filled by server. Possible values - include: "ApiKey", "RolloutIdentity". - :type type: str or ~azure.mgmt.deploymentmanager.models.RestAuthType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RolloutIdentityAuthentication, self).__init__(**kwargs) - self.type = 'RolloutIdentity' # type: str - - -class RolloutOperationInfo(msrest.serialization.Model): - """Detailed runtime information of the rollout. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar retry_attempt: The ordinal count of the number of retry attempts on a rollout. 0 if no - retries of the rollout have been performed. If the rollout is updated with a PUT, this count is - reset to 0. - :vartype retry_attempt: int - :ivar skip_succeeded_on_retry: True, if all steps that succeeded on the previous run/attempt - were chosen to be skipped in this retry attempt. False, otherwise. - :vartype skip_succeeded_on_retry: bool - :ivar start_time: The start time of the rollout in UTC. - :vartype start_time: ~datetime.datetime - :ivar end_time: The start time of the rollout in UTC. This property will not be set if the - rollout has not completed yet. - :vartype end_time: ~datetime.datetime - :ivar error: The detailed error information for any failure. - :vartype error: ~azure.mgmt.deploymentmanager.models.CloudErrorBody - """ - - _validation = { - 'retry_attempt': {'readonly': True}, - 'skip_succeeded_on_retry': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'retry_attempt': {'key': 'retryAttempt', 'type': 'int'}, - 'skip_succeeded_on_retry': {'key': 'skipSucceededOnRetry', 'type': 'bool'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, - } - - def __init__( - self, - **kwargs - ): - super(RolloutOperationInfo, self).__init__(**kwargs) - self.retry_attempt = None - self.skip_succeeded_on_retry = None - self.start_time = None - self.end_time = None - self.error = None - - -class RolloutProperties(msrest.serialization.Model): - """Defines the properties of a rollout. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The current status of the rollout. - :vartype status: str - :ivar total_retry_attempts: The cardinal count of total number of retries performed on the - rollout at a given time. - :vartype total_retry_attempts: int - :ivar operation_info: Operational information of the rollout. - :vartype operation_info: ~azure.mgmt.deploymentmanager.models.RolloutOperationInfo - :ivar services: The detailed information on the services being deployed. - :vartype services: list[~azure.mgmt.deploymentmanager.models.Service] - """ - - _validation = { - 'status': {'readonly': True}, - 'total_retry_attempts': {'readonly': True}, - 'operation_info': {'readonly': True}, - 'services': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'total_retry_attempts': {'key': 'totalRetryAttempts', 'type': 'int'}, - 'operation_info': {'key': 'operationInfo', 'type': 'RolloutOperationInfo'}, - 'services': {'key': 'services', 'type': '[Service]'}, - } - - def __init__( - self, - **kwargs - ): - super(RolloutProperties, self).__init__(**kwargs) - self.status = None - self.total_retry_attempts = None - self.operation_info = None - self.services = None - - -class RolloutRequestProperties(msrest.serialization.Model): - """The properties for defining a rollout. - - All required parameters must be populated in order to send to Azure. - - :param build_version: Required. The version of the build being deployed. - :type build_version: str - :param artifact_source_id: The reference to the artifact source resource Id where the payload - is located. - :type artifact_source_id: str - :param target_service_topology_id: Required. The resource Id of the service topology from which - service units are being referenced in step groups to be deployed. - :type target_service_topology_id: str - :param step_groups: Required. The list of step groups that define the orchestration. - :type step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] - """ - - _validation = { - 'build_version': {'required': True}, - 'target_service_topology_id': {'required': True}, - 'step_groups': {'required': True}, - } - - _attribute_map = { - 'build_version': {'key': 'buildVersion', 'type': 'str'}, - 'artifact_source_id': {'key': 'artifactSourceId', 'type': 'str'}, - 'target_service_topology_id': {'key': 'targetServiceTopologyId', 'type': 'str'}, - 'step_groups': {'key': 'stepGroups', 'type': '[StepGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(RolloutRequestProperties, self).__init__(**kwargs) - self.build_version = kwargs['build_version'] - self.artifact_source_id = kwargs.get('artifact_source_id', None) - self.target_service_topology_id = kwargs['target_service_topology_id'] - self.step_groups = kwargs['step_groups'] - - -class RolloutPropertiesAutoGenerated(RolloutRequestProperties, RolloutProperties): - """The properties that define a rollout. - - 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 status: The current status of the rollout. - :vartype status: str - :ivar total_retry_attempts: The cardinal count of total number of retries performed on the - rollout at a given time. - :vartype total_retry_attempts: int - :ivar operation_info: Operational information of the rollout. - :vartype operation_info: ~azure.mgmt.deploymentmanager.models.RolloutOperationInfo - :ivar services: The detailed information on the services being deployed. - :vartype services: list[~azure.mgmt.deploymentmanager.models.Service] - :param build_version: Required. The version of the build being deployed. - :type build_version: str - :param artifact_source_id: The reference to the artifact source resource Id where the payload - is located. - :type artifact_source_id: str - :param target_service_topology_id: Required. The resource Id of the service topology from which - service units are being referenced in step groups to be deployed. - :type target_service_topology_id: str - :param step_groups: Required. The list of step groups that define the orchestration. - :type step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] - """ - - _validation = { - 'status': {'readonly': True}, - 'total_retry_attempts': {'readonly': True}, - 'operation_info': {'readonly': True}, - 'services': {'readonly': True}, - 'build_version': {'required': True}, - 'target_service_topology_id': {'required': True}, - 'step_groups': {'required': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'total_retry_attempts': {'key': 'totalRetryAttempts', 'type': 'int'}, - 'operation_info': {'key': 'operationInfo', 'type': 'RolloutOperationInfo'}, - 'services': {'key': 'services', 'type': '[Service]'}, - 'build_version': {'key': 'buildVersion', 'type': 'str'}, - 'artifact_source_id': {'key': 'artifactSourceId', 'type': 'str'}, - 'target_service_topology_id': {'key': 'targetServiceTopologyId', 'type': 'str'}, - 'step_groups': {'key': 'stepGroups', 'type': '[StepGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(RolloutPropertiesAutoGenerated, self).__init__(**kwargs) - self.status = None - self.total_retry_attempts = None - self.operation_info = None - self.services = None - self.build_version = kwargs['build_version'] - self.artifact_source_id = kwargs.get('artifact_source_id', None) - self.target_service_topology_id = kwargs['target_service_topology_id'] - self.step_groups = kwargs['step_groups'] - - -class RolloutRequest(TrackedResource): - """Defines the PUT rollout request body. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param identity: Required. Identity for the resource. - :type identity: ~azure.mgmt.deploymentmanager.models.Identity - :param build_version: Required. The version of the build being deployed. - :type build_version: str - :param artifact_source_id: The reference to the artifact source resource Id where the payload - is located. - :type artifact_source_id: str - :param target_service_topology_id: Required. The resource Id of the service topology from which - service units are being referenced in step groups to be deployed. - :type target_service_topology_id: str - :param step_groups: Required. The list of step groups that define the orchestration. - :type step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'identity': {'required': True}, - 'build_version': {'required': True}, - 'target_service_topology_id': {'required': True}, - 'step_groups': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'build_version': {'key': 'properties.buildVersion', 'type': 'str'}, - 'artifact_source_id': {'key': 'properties.artifactSourceId', 'type': 'str'}, - 'target_service_topology_id': {'key': 'properties.targetServiceTopologyId', 'type': 'str'}, - 'step_groups': {'key': 'properties.stepGroups', 'type': '[StepGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(RolloutRequest, self).__init__(**kwargs) - self.identity = kwargs['identity'] - self.build_version = kwargs['build_version'] - self.artifact_source_id = kwargs.get('artifact_source_id', None) - self.target_service_topology_id = kwargs['target_service_topology_id'] - self.step_groups = kwargs['step_groups'] - - -class RolloutStep(msrest.serialization.Model): - """Defines a specific step on a target service unit. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name of the step. - :type name: str - :ivar status: Current state of the step. - :vartype status: str - :param step_group: The step group the current step is part of. - :type step_group: str - :ivar operation_info: Detailed information of specific action execution. - :vartype operation_info: ~azure.mgmt.deploymentmanager.models.StepOperationInfo - :ivar resource_operations: Set of resource operations that were performed, if any, on an Azure - resource. - :vartype resource_operations: list[~azure.mgmt.deploymentmanager.models.ResourceOperation] - :ivar messages: Supplementary informative messages during rollout. - :vartype messages: list[~azure.mgmt.deploymentmanager.models.Message] - """ - - _validation = { - 'name': {'required': True}, - 'status': {'readonly': True}, - 'operation_info': {'readonly': True}, - 'resource_operations': {'readonly': True}, - 'messages': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'step_group': {'key': 'stepGroup', 'type': 'str'}, - 'operation_info': {'key': 'operationInfo', 'type': 'StepOperationInfo'}, - 'resource_operations': {'key': 'resourceOperations', 'type': '[ResourceOperation]'}, - 'messages': {'key': 'messages', 'type': '[Message]'}, - } - - def __init__( - self, - **kwargs - ): - super(RolloutStep, self).__init__(**kwargs) - self.name = kwargs['name'] - self.status = None - self.step_group = kwargs.get('step_group', None) - self.operation_info = None - self.resource_operations = None - self.messages = None - - -class SasAuthentication(Authentication): - """Defines the properties to access the artifacts using an Azure Storage SAS URI. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The authentication type.Constant filled by server. - :type type: str - :param sas_uri: The SAS URI to the Azure Storage blob container. Any offset from the root of - the container to where the artifacts are located can be defined in the artifactRoot. - :type sas_uri: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'sas_uri': {'key': 'properties.sasUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SasAuthentication, self).__init__(**kwargs) - self.type = 'Sas' # type: str - self.sas_uri = kwargs.get('sas_uri', None) - - -class ServiceProperties(msrest.serialization.Model): - """The properties of a service. - - All required parameters must be populated in order to send to Azure. - - :param target_location: Required. The Azure location to which the resources in the service - belong to or should be deployed to. - :type target_location: str - :param target_subscription_id: Required. The subscription to which the resources in the service - belong to or should be deployed to. - :type target_subscription_id: str - """ - - _validation = { - 'target_location': {'required': True}, - 'target_subscription_id': {'required': True}, - } - - _attribute_map = { - 'target_location': {'key': 'targetLocation', 'type': 'str'}, - 'target_subscription_id': {'key': 'targetSubscriptionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceProperties, self).__init__(**kwargs) - self.target_location = kwargs['target_location'] - self.target_subscription_id = kwargs['target_subscription_id'] - - -class Service(ServiceProperties): - """Defines a service. - - All required parameters must be populated in order to send to Azure. - - :param target_location: Required. The Azure location to which the resources in the service - belong to or should be deployed to. - :type target_location: str - :param target_subscription_id: Required. The subscription to which the resources in the service - belong to or should be deployed to. - :type target_subscription_id: str - :param name: Name of the service. - :type name: str - :param service_units: The detailed information about the units that make up the service. - :type service_units: list[~azure.mgmt.deploymentmanager.models.ServiceUnit] - """ - - _validation = { - 'target_location': {'required': True}, - 'target_subscription_id': {'required': True}, - } - - _attribute_map = { - 'target_location': {'key': 'targetLocation', 'type': 'str'}, - 'target_subscription_id': {'key': 'targetSubscriptionId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'service_units': {'key': 'serviceUnits', 'type': '[ServiceUnit]'}, - } - - def __init__( - self, - **kwargs - ): - super(Service, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.service_units = kwargs.get('service_units', None) - - -class ServiceResource(TrackedResource): - """The resource representation of a service in a service topology. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param target_location: Required. The Azure location to which the resources in the service - belong to or should be deployed to. - :type target_location: str - :param target_subscription_id: Required. The subscription to which the resources in the service - belong to or should be deployed to. - :type target_subscription_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'target_location': {'required': True}, - 'target_subscription_id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'target_location': {'key': 'properties.targetLocation', 'type': 'str'}, - 'target_subscription_id': {'key': 'properties.targetSubscriptionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResource, self).__init__(**kwargs) - self.target_location = kwargs['target_location'] - self.target_subscription_id = kwargs['target_subscription_id'] - - -class ServiceResourceProperties(ServiceProperties): - """The properties that define a service in a service topology. - - All required parameters must be populated in order to send to Azure. - - :param target_location: Required. The Azure location to which the resources in the service - belong to or should be deployed to. - :type target_location: str - :param target_subscription_id: Required. The subscription to which the resources in the service - belong to or should be deployed to. - :type target_subscription_id: str - """ - - _validation = { - 'target_location': {'required': True}, - 'target_subscription_id': {'required': True}, - } - - _attribute_map = { - 'target_location': {'key': 'targetLocation', 'type': 'str'}, - 'target_subscription_id': {'key': 'targetSubscriptionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceProperties, self).__init__(**kwargs) - - -class ServiceTopologyProperties(msrest.serialization.Model): - """The properties of a service topology. - - :param artifact_source_id: The resource Id of the artifact source that contains the artifacts - that can be referenced in the service units. - :type artifact_source_id: str - """ - - _attribute_map = { - 'artifact_source_id': {'key': 'artifactSourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceTopologyProperties, self).__init__(**kwargs) - self.artifact_source_id = kwargs.get('artifact_source_id', None) - - -class ServiceTopologyResource(TrackedResource): - """The resource representation of a service topology. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param artifact_source_id: The resource Id of the artifact source that contains the artifacts - that can be referenced in the service units. - :type artifact_source_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'artifact_source_id': {'key': 'properties.artifactSourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceTopologyResource, self).__init__(**kwargs) - self.artifact_source_id = kwargs.get('artifact_source_id', None) - - -class ServiceTopologyResourceProperties(ServiceTopologyProperties): - """The properties that define the service topology. - - :param artifact_source_id: The resource Id of the artifact source that contains the artifacts - that can be referenced in the service units. - :type artifact_source_id: str - """ - - _attribute_map = { - 'artifact_source_id': {'key': 'artifactSourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceTopologyResourceProperties, self).__init__(**kwargs) - - -class ServiceUnitProperties(msrest.serialization.Model): - """Defines the properties of a service unit. - - All required parameters must be populated in order to send to Azure. - - :param target_resource_group: Required. The Azure Resource Group to which the resources in the - service unit belong to or should be deployed to. - :type target_resource_group: str - :param deployment_mode: Required. Describes the type of ARM deployment to be performed on the - resource. Possible values include: "Incremental", "Complete". - :type deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode - :param artifacts: The artifacts for the service unit. - :type artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts - """ - - _validation = { - 'target_resource_group': {'required': True}, - 'deployment_mode': {'required': True}, - } - - _attribute_map = { - 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, - 'deployment_mode': {'key': 'deploymentMode', 'type': 'str'}, - 'artifacts': {'key': 'artifacts', 'type': 'ServiceUnitArtifacts'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceUnitProperties, self).__init__(**kwargs) - self.target_resource_group = kwargs['target_resource_group'] - self.deployment_mode = kwargs['deployment_mode'] - self.artifacts = kwargs.get('artifacts', None) - - -class ServiceUnit(ServiceUnitProperties): - """Defines a service unit. - - All required parameters must be populated in order to send to Azure. - - :param target_resource_group: Required. The Azure Resource Group to which the resources in the - service unit belong to or should be deployed to. - :type target_resource_group: str - :param deployment_mode: Required. Describes the type of ARM deployment to be performed on the - resource. Possible values include: "Incremental", "Complete". - :type deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode - :param artifacts: The artifacts for the service unit. - :type artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts - :param name: Name of the service unit. - :type name: str - :param steps: Detailed step information, if present. - :type steps: list[~azure.mgmt.deploymentmanager.models.RolloutStep] - """ - - _validation = { - 'target_resource_group': {'required': True}, - 'deployment_mode': {'required': True}, - } - - _attribute_map = { - 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, - 'deployment_mode': {'key': 'deploymentMode', 'type': 'str'}, - 'artifacts': {'key': 'artifacts', 'type': 'ServiceUnitArtifacts'}, - 'name': {'key': 'name', 'type': 'str'}, - 'steps': {'key': 'steps', 'type': '[RolloutStep]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceUnit, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.steps = kwargs.get('steps', None) - - -class ServiceUnitArtifacts(msrest.serialization.Model): - """Defines the artifacts of a service unit. - - :param template_uri: The full URI of the ARM template file with the SAS token. - :type template_uri: str - :param parameters_uri: The full URI of the ARM parameters file with the SAS token. - :type parameters_uri: str - :param template_artifact_source_relative_path: The path to the ARM template file relative to - the artifact source. - :type template_artifact_source_relative_path: str - :param parameters_artifact_source_relative_path: The path to the ARM parameters file relative - to the artifact source. - :type parameters_artifact_source_relative_path: str - """ - - _attribute_map = { - 'template_uri': {'key': 'templateUri', 'type': 'str'}, - 'parameters_uri': {'key': 'parametersUri', 'type': 'str'}, - 'template_artifact_source_relative_path': {'key': 'templateArtifactSourceRelativePath', 'type': 'str'}, - 'parameters_artifact_source_relative_path': {'key': 'parametersArtifactSourceRelativePath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceUnitArtifacts, self).__init__(**kwargs) - self.template_uri = kwargs.get('template_uri', None) - self.parameters_uri = kwargs.get('parameters_uri', None) - self.template_artifact_source_relative_path = kwargs.get('template_artifact_source_relative_path', None) - self.parameters_artifact_source_relative_path = kwargs.get('parameters_artifact_source_relative_path', None) - - -class ServiceUnitResource(TrackedResource): - """Represents the response of a service unit resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param target_resource_group: Required. The Azure Resource Group to which the resources in the - service unit belong to or should be deployed to. - :type target_resource_group: str - :param deployment_mode: Required. Describes the type of ARM deployment to be performed on the - resource. Possible values include: "Incremental", "Complete". - :type deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode - :param artifacts: The artifacts for the service unit. - :type artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'target_resource_group': {'required': True}, - 'deployment_mode': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'target_resource_group': {'key': 'properties.targetResourceGroup', 'type': 'str'}, - 'deployment_mode': {'key': 'properties.deploymentMode', 'type': 'str'}, - 'artifacts': {'key': 'properties.artifacts', 'type': 'ServiceUnitArtifacts'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceUnitResource, self).__init__(**kwargs) - self.target_resource_group = kwargs['target_resource_group'] - self.deployment_mode = kwargs['deployment_mode'] - self.artifacts = kwargs.get('artifacts', None) - - -class ServiceUnitResourceProperties(ServiceUnitProperties): - """The properties that define the service unit. - - All required parameters must be populated in order to send to Azure. - - :param target_resource_group: Required. The Azure Resource Group to which the resources in the - service unit belong to or should be deployed to. - :type target_resource_group: str - :param deployment_mode: Required. Describes the type of ARM deployment to be performed on the - resource. Possible values include: "Incremental", "Complete". - :type deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode - :param artifacts: The artifacts for the service unit. - :type artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts - """ - - _validation = { - 'target_resource_group': {'required': True}, - 'deployment_mode': {'required': True}, - } - - _attribute_map = { - 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, - 'deployment_mode': {'key': 'deploymentMode', 'type': 'str'}, - 'artifacts': {'key': 'artifacts', 'type': 'ServiceUnitArtifacts'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceUnitResourceProperties, self).__init__(**kwargs) - - -class StepGroup(msrest.serialization.Model): - """The properties that define a Step group in a rollout. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the step group. - :type name: str - :param depends_on_step_groups: The list of step group names on which this step group depends - on. - :type depends_on_step_groups: list[str] - :param pre_deployment_steps: The list of steps to be run before deploying the target. - :type pre_deployment_steps: list[~azure.mgmt.deploymentmanager.models.PrePostStep] - :param deployment_target_id: Required. The resource Id of service unit to be deployed. The - service unit should be from the service topology referenced in targetServiceTopologyId. - :type deployment_target_id: str - :param post_deployment_steps: The list of steps to be run after deploying the target. - :type post_deployment_steps: list[~azure.mgmt.deploymentmanager.models.PrePostStep] - """ - - _validation = { - 'name': {'required': True}, - 'deployment_target_id': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'depends_on_step_groups': {'key': 'dependsOnStepGroups', 'type': '[str]'}, - 'pre_deployment_steps': {'key': 'preDeploymentSteps', 'type': '[PrePostStep]'}, - 'deployment_target_id': {'key': 'deploymentTargetId', 'type': 'str'}, - 'post_deployment_steps': {'key': 'postDeploymentSteps', 'type': '[PrePostStep]'}, - } - - def __init__( - self, - **kwargs - ): - super(StepGroup, self).__init__(**kwargs) - self.name = kwargs['name'] - self.depends_on_step_groups = kwargs.get('depends_on_step_groups', None) - self.pre_deployment_steps = kwargs.get('pre_deployment_steps', None) - self.deployment_target_id = kwargs['deployment_target_id'] - self.post_deployment_steps = kwargs.get('post_deployment_steps', None) - - -class StepOperationInfo(msrest.serialization.Model): - """Detailed information of a specific step run. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar deployment_name: The name of the ARM deployment initiated as part of the step. - :vartype deployment_name: str - :ivar correlation_id: Unique identifier to track the request for ARM-based resources. - :vartype correlation_id: str - :ivar start_time: Start time of the action in UTC. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the action in UTC. - :vartype end_time: ~datetime.datetime - :ivar last_updated_time: Last time in UTC this operation was updated. - :vartype last_updated_time: ~datetime.datetime - :param error: The errors, if any, for the action. - :type error: ~azure.mgmt.deploymentmanager.models.CloudErrorBody - """ - - _validation = { - 'deployment_name': {'readonly': True}, - 'correlation_id': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'last_updated_time': {'readonly': True}, - } - - _attribute_map = { - 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, - } - - def __init__( - self, - **kwargs - ): - super(StepOperationInfo, self).__init__(**kwargs) - self.deployment_name = None - self.correlation_id = None - self.start_time = None - self.end_time = None - self.last_updated_time = None - self.error = kwargs.get('error', None) - - -class StepResource(TrackedResource): - """The resource representation of a rollout step. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param properties: Required. The properties that define the step. - :type properties: ~azure.mgmt.deploymentmanager.models.StepProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'StepProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(StepResource, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class WaitStepAttributes(msrest.serialization.Model): - """The parameters for the wait step. - - All required parameters must be populated in order to send to Azure. - - :param duration: Required. The duration in ISO 8601 format of how long the wait should be. - :type duration: str - """ - - _validation = { - 'duration': {'required': True}, - } - - _attribute_map = { - 'duration': {'key': 'duration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WaitStepAttributes, self).__init__(**kwargs) - self.duration = kwargs['duration'] - - -class WaitStepProperties(StepProperties): - """Defines the properties of a Wait step. - - All required parameters must be populated in order to send to Azure. - - :param step_type: Required. The type of step.Constant filled by server. Possible values - include: "Wait", "HealthCheck". - :type step_type: str or ~azure.mgmt.deploymentmanager.models.StepType - :param attributes: Required. The Wait attributes. - :type attributes: ~azure.mgmt.deploymentmanager.models.WaitStepAttributes - """ - - _validation = { - 'step_type': {'required': True}, - 'attributes': {'required': True}, - } - - _attribute_map = { - 'step_type': {'key': 'stepType', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'WaitStepAttributes'}, - } - - def __init__( - self, - **kwargs - ): - super(WaitStepProperties, self).__init__(**kwargs) - self.step_type = 'Wait' # type: str - self.attributes = kwargs['attributes'] diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_models_py3.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_models_py3.py index b8d3dcc3747a..ba4c532c0eda 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_models_py3.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/models/_models_py3.py @@ -21,9 +21,9 @@ class RestRequestAuthentication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The authentication type.Constant filled by server. Possible values + :ivar type: Required. The authentication type.Constant filled by server. Possible values include: "ApiKey", "RolloutIdentity". - :type type: str or ~azure.mgmt.deploymentmanager.models.RestAuthType + :vartype type: str or ~azure.mgmt.deploymentmanager.models.RestAuthType """ _validation = { @@ -42,6 +42,8 @@ def __init__( self, **kwargs ): + """ + """ super(RestRequestAuthentication, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -51,16 +53,16 @@ class ApiKeyAuthentication(RestRequestAuthentication): All required parameters must be populated in order to send to Azure. - :param type: Required. The authentication type.Constant filled by server. Possible values + :ivar type: Required. The authentication type.Constant filled by server. Possible values include: "ApiKey", "RolloutIdentity". - :type type: str or ~azure.mgmt.deploymentmanager.models.RestAuthType - :param name: Required. The key name of the authentication key/value pair. - :type name: str - :param in_property: Required. The location of the authentication key/value pair in the request. + :vartype type: str or ~azure.mgmt.deploymentmanager.models.RestAuthType + :ivar name: Required. The key name of the authentication key/value pair. + :vartype name: str + :ivar in_property: Required. The location of the authentication key/value pair in the request. Possible values include: "Query", "Header". - :type in_property: str or ~azure.mgmt.deploymentmanager.models.RestAuthLocation - :param value: Required. The value of the authentication key/value pair. - :type value: str + :vartype in_property: str or ~azure.mgmt.deploymentmanager.models.RestAuthLocation + :ivar value: Required. The value of the authentication key/value pair. + :vartype value: str """ _validation = { @@ -85,6 +87,15 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The key name of the authentication key/value pair. + :paramtype name: str + :keyword in_property: Required. The location of the authentication key/value pair in the + request. Possible values include: "Query", "Header". + :paramtype in_property: str or ~azure.mgmt.deploymentmanager.models.RestAuthLocation + :keyword value: Required. The value of the authentication key/value pair. + :paramtype value: str + """ super(ApiKeyAuthentication, self).__init__(**kwargs) self.type = 'ApiKey' # type: str self.name = name @@ -123,6 +134,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -144,10 +157,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -172,6 +185,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -192,21 +211,21 @@ class ArtifactSource(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param source_type: The type of artifact source used. - :type source_type: str - :param artifact_root: The path from the location that the 'authentication' property [say, a SAS + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar source_type: The type of artifact source used. + :vartype source_type: str + :ivar artifact_root: The path from the location that the 'authentication' property [say, a SAS URI to the blob container] refers to, to the location of the artifacts. This can be used to differentiate different versions of the artifacts. Or, different types of artifacts like binaries or templates. The location referenced by the authentication property concatenated with this optional artifactRoot path forms the artifact source location where the artifacts are expected to be found. - :type artifact_root: str - :param authentication: The authentication method to use to access the artifact source. - :type authentication: ~azure.mgmt.deploymentmanager.models.Authentication + :vartype artifact_root: str + :ivar authentication: The authentication method to use to access the artifact source. + :vartype authentication: ~azure.mgmt.deploymentmanager.models.Authentication """ _validation = { @@ -237,6 +256,23 @@ def __init__( authentication: Optional["Authentication"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword source_type: The type of artifact source used. + :paramtype source_type: str + :keyword artifact_root: The path from the location that the 'authentication' property [say, a + SAS URI to the blob container] refers to, to the location of the artifacts. This can be used to + differentiate different versions of the artifacts. Or, different types of artifacts like + binaries or templates. The location referenced by the authentication property concatenated with + this optional artifactRoot path forms the artifact source location where the artifacts are + expected to be found. + :paramtype artifact_root: str + :keyword authentication: The authentication method to use to access the artifact source. + :paramtype authentication: ~azure.mgmt.deploymentmanager.models.Authentication + """ super(ArtifactSource, self).__init__(tags=tags, location=location, **kwargs) self.source_type = source_type self.artifact_root = artifact_root @@ -248,18 +284,17 @@ class ArtifactSourceProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_type: Required. The type of artifact source used. - :type source_type: str - :param artifact_root: The path from the location that the 'authentication' property [say, a SAS + :ivar source_type: Required. The type of artifact source used. + :vartype source_type: str + :ivar artifact_root: The path from the location that the 'authentication' property [say, a SAS URI to the blob container] refers to, to the location of the artifacts. This can be used to differentiate different versions of the artifacts. Or, different types of artifacts like binaries or templates. The location referenced by the authentication property concatenated with this optional artifactRoot path forms the artifact source location where the artifacts are expected to be found. - :type artifact_root: str - :param authentication: Required. The authentication method to use to access the artifact - source. - :type authentication: ~azure.mgmt.deploymentmanager.models.Authentication + :vartype artifact_root: str + :ivar authentication: Required. The authentication method to use to access the artifact source. + :vartype authentication: ~azure.mgmt.deploymentmanager.models.Authentication """ _validation = { @@ -281,6 +316,20 @@ def __init__( artifact_root: Optional[str] = None, **kwargs ): + """ + :keyword source_type: Required. The type of artifact source used. + :paramtype source_type: str + :keyword artifact_root: The path from the location that the 'authentication' property [say, a + SAS URI to the blob container] refers to, to the location of the artifacts. This can be used to + differentiate different versions of the artifacts. Or, different types of artifacts like + binaries or templates. The location referenced by the authentication property concatenated with + this optional artifactRoot path forms the artifact source location where the artifacts are + expected to be found. + :paramtype artifact_root: str + :keyword authentication: Required. The authentication method to use to access the artifact + source. + :paramtype authentication: ~azure.mgmt.deploymentmanager.models.Authentication + """ super(ArtifactSourceProperties, self).__init__(**kwargs) self.source_type = source_type self.artifact_root = artifact_root @@ -292,18 +341,17 @@ class ArtifactSourcePropertiesAutoGenerated(ArtifactSourceProperties): All required parameters must be populated in order to send to Azure. - :param source_type: Required. The type of artifact source used. - :type source_type: str - :param artifact_root: The path from the location that the 'authentication' property [say, a SAS + :ivar source_type: Required. The type of artifact source used. + :vartype source_type: str + :ivar artifact_root: The path from the location that the 'authentication' property [say, a SAS URI to the blob container] refers to, to the location of the artifacts. This can be used to differentiate different versions of the artifacts. Or, different types of artifacts like binaries or templates. The location referenced by the authentication property concatenated with this optional artifactRoot path forms the artifact source location where the artifacts are expected to be found. - :type artifact_root: str - :param authentication: Required. The authentication method to use to access the artifact - source. - :type authentication: ~azure.mgmt.deploymentmanager.models.Authentication + :vartype artifact_root: str + :ivar authentication: Required. The authentication method to use to access the artifact source. + :vartype authentication: ~azure.mgmt.deploymentmanager.models.Authentication """ _validation = { @@ -325,6 +373,20 @@ def __init__( artifact_root: Optional[str] = None, **kwargs ): + """ + :keyword source_type: Required. The type of artifact source used. + :paramtype source_type: str + :keyword artifact_root: The path from the location that the 'authentication' property [say, a + SAS URI to the blob container] refers to, to the location of the artifacts. This can be used to + differentiate different versions of the artifacts. Or, different types of artifacts like + binaries or templates. The location referenced by the authentication property concatenated with + this optional artifactRoot path forms the artifact source location where the artifacts are + expected to be found. + :paramtype artifact_root: str + :keyword authentication: Required. The authentication method to use to access the artifact + source. + :paramtype authentication: ~azure.mgmt.deploymentmanager.models.Authentication + """ super(ArtifactSourcePropertiesAutoGenerated, self).__init__(source_type=source_type, artifact_root=artifact_root, authentication=authentication, **kwargs) @@ -336,8 +398,8 @@ class Authentication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The authentication type.Constant filled by server. - :type type: str + :ivar type: Required. The authentication type.Constant filled by server. + :vartype type: str """ _validation = { @@ -356,6 +418,8 @@ def __init__( self, **kwargs ): + """ + """ super(Authentication, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -369,10 +433,10 @@ class CloudErrorBody(msrest.serialization.Model): :vartype code: str :ivar message: Descriptive error information. :vartype message: str - :param target: Error target. - :type target: str - :param details: More detailed error information. - :type details: list[~azure.mgmt.deploymentmanager.models.CloudErrorBody] + :ivar target: Error target. + :vartype target: str + :ivar details: More detailed error information. + :vartype details: list[~azure.mgmt.deploymentmanager.models.CloudErrorBody] """ _validation = { @@ -394,6 +458,12 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword target: Error target. + :paramtype target: str + :keyword details: More detailed error information. + :paramtype details: list[~azure.mgmt.deploymentmanager.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = None self.message = None @@ -409,19 +479,19 @@ class HealthCheckStepAttributes(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of health check.Constant filled by server. - :type type: str - :param wait_duration: The duration in ISO 8601 format for which health check waits idly without + :ivar type: Required. The type of health check.Constant filled by server. + :vartype type: str + :ivar wait_duration: The duration in ISO 8601 format for which health check waits idly without any checks. - :type wait_duration: str - :param max_elastic_duration: The duration in ISO 8601 format for which the health check waits + :vartype wait_duration: str + :ivar max_elastic_duration: The duration in ISO 8601 format for which the health check waits for the resource to become healthy. Health check fails if it doesn't. Health check starts to enforce healthyStateDuration once resource becomes healthy. - :type max_elastic_duration: str - :param healthy_state_duration: Required. The duration in ISO 8601 format for which the resource + :vartype max_elastic_duration: str + :ivar healthy_state_duration: Required. The duration in ISO 8601 format for which the resource is expected to be continuously healthy. If maxElasticDuration is specified, healthy state duration is enforced after the detection of first healthy signal. - :type healthy_state_duration: str + :vartype healthy_state_duration: str """ _validation = { @@ -448,6 +518,19 @@ def __init__( max_elastic_duration: Optional[str] = None, **kwargs ): + """ + :keyword wait_duration: The duration in ISO 8601 format for which health check waits idly + without any checks. + :paramtype wait_duration: str + :keyword max_elastic_duration: The duration in ISO 8601 format for which the health check waits + for the resource to become healthy. Health check fails if it doesn't. Health check starts to + enforce healthyStateDuration once resource becomes healthy. + :paramtype max_elastic_duration: str + :keyword healthy_state_duration: Required. The duration in ISO 8601 format for which the + resource is expected to be continuously healthy. If maxElasticDuration is specified, healthy + state duration is enforced after the detection of first healthy signal. + :paramtype healthy_state_duration: str + """ super(HealthCheckStepAttributes, self).__init__(**kwargs) self.type = None # type: Optional[str] self.wait_duration = wait_duration @@ -463,9 +546,9 @@ class StepProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param step_type: Required. The type of step.Constant filled by server. Possible values - include: "Wait", "HealthCheck". - :type step_type: str or ~azure.mgmt.deploymentmanager.models.StepType + :ivar step_type: Required. The type of step.Constant filled by server. Possible values include: + "Wait", "HealthCheck". + :vartype step_type: str or ~azure.mgmt.deploymentmanager.models.StepType """ _validation = { @@ -484,6 +567,8 @@ def __init__( self, **kwargs ): + """ + """ super(StepProperties, self).__init__(**kwargs) self.step_type = None # type: Optional[str] @@ -493,11 +578,11 @@ class HealthCheckStepProperties(StepProperties): All required parameters must be populated in order to send to Azure. - :param step_type: Required. The type of step.Constant filled by server. Possible values - include: "Wait", "HealthCheck". - :type step_type: str or ~azure.mgmt.deploymentmanager.models.StepType - :param attributes: Required. The health check step attributes. - :type attributes: ~azure.mgmt.deploymentmanager.models.HealthCheckStepAttributes + :ivar step_type: Required. The type of step.Constant filled by server. Possible values include: + "Wait", "HealthCheck". + :vartype step_type: str or ~azure.mgmt.deploymentmanager.models.StepType + :ivar attributes: Required. The health check step attributes. + :vartype attributes: ~azure.mgmt.deploymentmanager.models.HealthCheckStepAttributes """ _validation = { @@ -516,6 +601,10 @@ def __init__( attributes: "HealthCheckStepAttributes", **kwargs ): + """ + :keyword attributes: Required. The health check step attributes. + :paramtype attributes: ~azure.mgmt.deploymentmanager.models.HealthCheckStepAttributes + """ super(HealthCheckStepProperties, self).__init__(**kwargs) self.step_type = 'HealthCheck' # type: str self.attributes = attributes @@ -526,10 +615,10 @@ class Identity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The identity type. - :type type: str - :param identity_ids: Required. The list of identities. - :type identity_ids: list[str] + :ivar type: Required. The identity type. + :vartype type: str + :ivar identity_ids: Required. The list of identities. + :vartype identity_ids: list[str] """ _validation = { @@ -549,6 +638,12 @@ def __init__( identity_ids: List[str], **kwargs ): + """ + :keyword type: Required. The identity type. + :paramtype type: str + :keyword identity_ids: Required. The list of identities. + :paramtype identity_ids: list[str] + """ super(Identity, self).__init__(**kwargs) self.type = type self.identity_ids = identity_ids @@ -579,6 +674,8 @@ def __init__( self, **kwargs ): + """ + """ super(Message, self).__init__(**kwargs) self.time_stamp = None self.message = None @@ -587,14 +684,14 @@ def __init__( class Operation(msrest.serialization.Model): """Represents an operation that can be performed on the service. - :param name: The name of the operation. - :type name: str - :param display: The display name of the operation. - :type display: ~azure.mgmt.deploymentmanager.models.OperationDetail - :param origin: The origin of the operation. - :type origin: str - :param properties: The properties of the operation. - :type properties: any + :ivar name: The name of the operation. + :vartype name: str + :ivar display: The display name of the operation. + :vartype display: ~azure.mgmt.deploymentmanager.models.OperationDetail + :ivar origin: The origin of the operation. + :vartype origin: str + :ivar properties: The properties of the operation. + :vartype properties: any """ _attribute_map = { @@ -613,6 +710,16 @@ def __init__( properties: Optional[Any] = None, **kwargs ): + """ + :keyword name: The name of the operation. + :paramtype name: str + :keyword display: The display name of the operation. + :paramtype display: ~azure.mgmt.deploymentmanager.models.OperationDetail + :keyword origin: The origin of the operation. + :paramtype origin: str + :keyword properties: The properties of the operation. + :paramtype properties: any + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -623,14 +730,14 @@ def __init__( class OperationDetail(msrest.serialization.Model): """The detail about an operation. - :param provider: The name of the provider that supports the operation. - :type provider: str - :param resource: The resource type on which this operation can be performed. - :type resource: str - :param operation: The name of the operation. - :type operation: str - :param description: The description of the operation. - :type description: str + :ivar provider: The name of the provider that supports the operation. + :vartype provider: str + :ivar resource: The resource type on which this operation can be performed. + :vartype resource: str + :ivar operation: The name of the operation. + :vartype operation: str + :ivar description: The description of the operation. + :vartype description: str """ _attribute_map = { @@ -649,6 +756,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The name of the provider that supports the operation. + :paramtype provider: str + :keyword resource: The resource type on which this operation can be performed. + :paramtype resource: str + :keyword operation: The name of the operation. + :paramtype operation: str + :keyword description: The description of the operation. + :paramtype description: str + """ super(OperationDetail, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -659,8 +776,8 @@ def __init__( class OperationsList(msrest.serialization.Model): """The operations response. - :param value: The list of supported operations. - :type value: ~azure.mgmt.deploymentmanager.models.Operation + :ivar value: The list of supported operations. + :vartype value: ~azure.mgmt.deploymentmanager.models.Operation """ _attribute_map = { @@ -673,6 +790,10 @@ def __init__( value: Optional["Operation"] = None, **kwargs ): + """ + :keyword value: The list of supported operations. + :paramtype value: ~azure.mgmt.deploymentmanager.models.Operation + """ super(OperationsList, self).__init__(**kwargs) self.value = value @@ -682,8 +803,8 @@ class PrePostStep(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param step_id: Required. The resource Id of the step to be run. - :type step_id: str + :ivar step_id: Required. The resource Id of the step to be run. + :vartype step_id: str """ _validation = { @@ -700,6 +821,10 @@ def __init__( step_id: str, **kwargs ): + """ + :keyword step_id: Required. The resource Id of the step to be run. + :paramtype step_id: str + """ super(PrePostStep, self).__init__(**kwargs) self.step_id = step_id @@ -709,15 +834,15 @@ class ResourceOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param resource_name: Name of the resource as specified in the artifacts. For ARM resources, + :ivar resource_name: Name of the resource as specified in the artifacts. For ARM resources, this is the name of the resource specified in the template. - :type resource_name: str + :vartype resource_name: str :ivar operation_id: Unique identifier of the operation. For ARM resources, this is the operationId obtained from ARM service. :vartype operation_id: str - :param resource_type: Type of the resource as specified in the artifacts. For ARM resources, + :ivar resource_type: Type of the resource as specified in the artifacts. For ARM resources, this is the type of the resource specified in the template. - :type resource_type: str + :vartype resource_type: str :ivar provisioning_state: State of the resource deployment. For ARM resources, this is the current provisioning state of the resource. :vartype provisioning_state: str @@ -750,6 +875,14 @@ def __init__( resource_type: Optional[str] = None, **kwargs ): + """ + :keyword resource_name: Name of the resource as specified in the artifacts. For ARM resources, + this is the name of the resource specified in the template. + :paramtype resource_name: str + :keyword resource_type: Type of the resource as specified in the artifacts. For ARM resources, + this is the type of the resource specified in the template. + :paramtype resource_type: str + """ super(ResourceOperation, self).__init__(**kwargs) self.resource_name = resource_name self.operation_id = None @@ -764,13 +897,13 @@ class RestHealthCheck(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. A unique name for this check. - :type name: str - :param request: Required. The request to the health provider. - :type request: ~azure.mgmt.deploymentmanager.models.RestRequest - :param response: The expected response from the health provider. If no expected response is + :ivar name: Required. A unique name for this check. + :vartype name: str + :ivar request: Required. The request to the health provider. + :vartype request: ~azure.mgmt.deploymentmanager.models.RestRequest + :ivar response: The expected response from the health provider. If no expected response is provided, the default is to expect the received response to have an HTTP status code of 200 OK. - :type response: ~azure.mgmt.deploymentmanager.models.RestResponse + :vartype response: ~azure.mgmt.deploymentmanager.models.RestResponse """ _validation = { @@ -792,6 +925,15 @@ def __init__( response: Optional["RestResponse"] = None, **kwargs ): + """ + :keyword name: Required. A unique name for this check. + :paramtype name: str + :keyword request: Required. The request to the health provider. + :paramtype request: ~azure.mgmt.deploymentmanager.models.RestRequest + :keyword response: The expected response from the health provider. If no expected response is + provided, the default is to expect the received response to have an HTTP status code of 200 OK. + :paramtype response: ~azure.mgmt.deploymentmanager.models.RestResponse + """ super(RestHealthCheck, self).__init__(**kwargs) self.name = name self.request = request @@ -803,21 +945,21 @@ class RestHealthCheckStepAttributes(HealthCheckStepAttributes): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of health check.Constant filled by server. - :type type: str - :param wait_duration: The duration in ISO 8601 format for which health check waits idly without + :ivar type: Required. The type of health check.Constant filled by server. + :vartype type: str + :ivar wait_duration: The duration in ISO 8601 format for which health check waits idly without any checks. - :type wait_duration: str - :param max_elastic_duration: The duration in ISO 8601 format for which the health check waits + :vartype wait_duration: str + :ivar max_elastic_duration: The duration in ISO 8601 format for which the health check waits for the resource to become healthy. Health check fails if it doesn't. Health check starts to enforce healthyStateDuration once resource becomes healthy. - :type max_elastic_duration: str - :param healthy_state_duration: Required. The duration in ISO 8601 format for which the resource + :vartype max_elastic_duration: str + :ivar healthy_state_duration: Required. The duration in ISO 8601 format for which the resource is expected to be continuously healthy. If maxElasticDuration is specified, healthy state duration is enforced after the detection of first healthy signal. - :type healthy_state_duration: str - :param health_checks: The list of checks that form the health check step. - :type health_checks: list[~azure.mgmt.deploymentmanager.models.RestHealthCheck] + :vartype healthy_state_duration: str + :ivar health_checks: The list of checks that form the health check step. + :vartype health_checks: list[~azure.mgmt.deploymentmanager.models.RestHealthCheck] """ _validation = { @@ -842,6 +984,21 @@ def __init__( health_checks: Optional[List["RestHealthCheck"]] = None, **kwargs ): + """ + :keyword wait_duration: The duration in ISO 8601 format for which health check waits idly + without any checks. + :paramtype wait_duration: str + :keyword max_elastic_duration: The duration in ISO 8601 format for which the health check waits + for the resource to become healthy. Health check fails if it doesn't. Health check starts to + enforce healthyStateDuration once resource becomes healthy. + :paramtype max_elastic_duration: str + :keyword healthy_state_duration: Required. The duration in ISO 8601 format for which the + resource is expected to be continuously healthy. If maxElasticDuration is specified, healthy + state duration is enforced after the detection of first healthy signal. + :paramtype healthy_state_duration: str + :keyword health_checks: The list of checks that form the health check step. + :paramtype health_checks: list[~azure.mgmt.deploymentmanager.models.RestHealthCheck] + """ super(RestHealthCheckStepAttributes, self).__init__(wait_duration=wait_duration, max_elastic_duration=max_elastic_duration, healthy_state_duration=healthy_state_duration, **kwargs) self.type = 'REST' # type: str self.health_checks = health_checks @@ -852,14 +1009,14 @@ class RestRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param method: Required. The HTTP method to use for the request. Possible values include: - "GET", "POST". - :type method: str or ~azure.mgmt.deploymentmanager.models.RestRequestMethod - :param uri: Required. The HTTP URI to use for the request. - :type uri: str - :param authentication: Required. The authentication information required in the request to the + :ivar method: Required. The HTTP method to use for the request. Possible values include: "GET", + "POST". + :vartype method: str or ~azure.mgmt.deploymentmanager.models.RestRequestMethod + :ivar uri: Required. The HTTP URI to use for the request. + :vartype uri: str + :ivar authentication: Required. The authentication information required in the request to the health provider. - :type authentication: ~azure.mgmt.deploymentmanager.models.RestRequestAuthentication + :vartype authentication: ~azure.mgmt.deploymentmanager.models.RestRequestAuthentication """ _validation = { @@ -882,6 +1039,16 @@ def __init__( authentication: "RestRequestAuthentication", **kwargs ): + """ + :keyword method: Required. The HTTP method to use for the request. Possible values include: + "GET", "POST". + :paramtype method: str or ~azure.mgmt.deploymentmanager.models.RestRequestMethod + :keyword uri: Required. The HTTP URI to use for the request. + :paramtype uri: str + :keyword authentication: Required. The authentication information required in the request to + the health provider. + :paramtype authentication: ~azure.mgmt.deploymentmanager.models.RestRequestAuthentication + """ super(RestRequest, self).__init__(**kwargs) self.method = method self.uri = uri @@ -891,12 +1058,12 @@ def __init__( class RestResponse(msrest.serialization.Model): """The properties that make up the expected REST response. - :param success_status_codes: The HTTP status codes expected in a successful health check + :ivar success_status_codes: The HTTP status codes expected in a successful health check response. The response is expected to match one of the given status codes. If no expected status codes are provided, default expected status code is 200 OK. - :type success_status_codes: list[str] - :param regex: The regular expressions to match the response content with. - :type regex: ~azure.mgmt.deploymentmanager.models.RestResponseRegex + :vartype success_status_codes: list[str] + :ivar regex: The regular expressions to match the response content with. + :vartype regex: ~azure.mgmt.deploymentmanager.models.RestResponseRegex """ _attribute_map = { @@ -911,6 +1078,14 @@ def __init__( regex: Optional["RestResponseRegex"] = None, **kwargs ): + """ + :keyword success_status_codes: The HTTP status codes expected in a successful health check + response. The response is expected to match one of the given status codes. If no expected + status codes are provided, default expected status code is 200 OK. + :paramtype success_status_codes: list[str] + :keyword regex: The regular expressions to match the response content with. + :paramtype regex: ~azure.mgmt.deploymentmanager.models.RestResponseRegex + """ super(RestResponse, self).__init__(**kwargs) self.success_status_codes = success_status_codes self.regex = regex @@ -919,11 +1094,11 @@ def __init__( class RestResponseRegex(msrest.serialization.Model): """The regular expressions to match the response content with. - :param matches: The list of regular expressions. - :type matches: list[str] - :param match_quantifier: Indicates whether any or all of the expressions should match with the + :ivar matches: The list of regular expressions. + :vartype matches: list[str] + :ivar match_quantifier: Indicates whether any or all of the expressions should match with the response content. Possible values include: "All", "Any". - :type match_quantifier: str or ~azure.mgmt.deploymentmanager.models.RestMatchQuantifier + :vartype match_quantifier: str or ~azure.mgmt.deploymentmanager.models.RestMatchQuantifier """ _attribute_map = { @@ -938,6 +1113,13 @@ def __init__( match_quantifier: Optional[Union[str, "RestMatchQuantifier"]] = None, **kwargs ): + """ + :keyword matches: The list of regular expressions. + :paramtype matches: list[str] + :keyword match_quantifier: Indicates whether any or all of the expressions should match with + the response content. Possible values include: "All", "Any". + :paramtype match_quantifier: str or ~azure.mgmt.deploymentmanager.models.RestMatchQuantifier + """ super(RestResponseRegex, self).__init__(**kwargs) self.matches = matches self.match_quantifier = match_quantifier @@ -958,22 +1140,22 @@ class Rollout(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.deploymentmanager.models.Identity - :param build_version: The version of the build being deployed. - :type build_version: str - :param artifact_source_id: The reference to the artifact source resource Id where the payload - is located. - :type artifact_source_id: str - :param target_service_topology_id: The resource Id of the service topology from which service + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.deploymentmanager.models.Identity + :ivar build_version: The version of the build being deployed. + :vartype build_version: str + :ivar artifact_source_id: The reference to the artifact source resource Id where the payload is + located. + :vartype artifact_source_id: str + :ivar target_service_topology_id: The resource Id of the service topology from which service units are being referenced in step groups to be deployed. - :type target_service_topology_id: str - :param step_groups: The list of step groups that define the orchestration. - :type step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] + :vartype target_service_topology_id: str + :ivar step_groups: The list of step groups that define the orchestration. + :vartype step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] :ivar status: The current status of the rollout. :vartype status: str :ivar total_retry_attempts: The cardinal count of total number of retries performed on the @@ -1025,6 +1207,24 @@ def __init__( step_groups: Optional[List["StepGroup"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.deploymentmanager.models.Identity + :keyword build_version: The version of the build being deployed. + :paramtype build_version: str + :keyword artifact_source_id: The reference to the artifact source resource Id where the payload + is located. + :paramtype artifact_source_id: str + :keyword target_service_topology_id: The resource Id of the service topology from which service + units are being referenced in step groups to be deployed. + :paramtype target_service_topology_id: str + :keyword step_groups: The list of step groups that define the orchestration. + :paramtype step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] + """ super(Rollout, self).__init__(tags=tags, location=location, **kwargs) self.identity = identity self.build_version = build_version @@ -1042,9 +1242,9 @@ class RolloutIdentityAuthentication(RestRequestAuthentication): All required parameters must be populated in order to send to Azure. - :param type: Required. The authentication type.Constant filled by server. Possible values + :ivar type: Required. The authentication type.Constant filled by server. Possible values include: "ApiKey", "RolloutIdentity". - :type type: str or ~azure.mgmt.deploymentmanager.models.RestAuthType + :vartype type: str or ~azure.mgmt.deploymentmanager.models.RestAuthType """ _validation = { @@ -1059,6 +1259,8 @@ def __init__( self, **kwargs ): + """ + """ super(RolloutIdentityAuthentication, self).__init__(**kwargs) self.type = 'RolloutIdentity' # type: str @@ -1104,6 +1306,8 @@ def __init__( self, **kwargs ): + """ + """ super(RolloutOperationInfo, self).__init__(**kwargs) self.retry_attempt = None self.skip_succeeded_on_retry = None @@ -1146,6 +1350,8 @@ def __init__( self, **kwargs ): + """ + """ super(RolloutProperties, self).__init__(**kwargs) self.status = None self.total_retry_attempts = None @@ -1158,16 +1364,16 @@ class RolloutRequestProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param build_version: Required. The version of the build being deployed. - :type build_version: str - :param artifact_source_id: The reference to the artifact source resource Id where the payload - is located. - :type artifact_source_id: str - :param target_service_topology_id: Required. The resource Id of the service topology from which + :ivar build_version: Required. The version of the build being deployed. + :vartype build_version: str + :ivar artifact_source_id: The reference to the artifact source resource Id where the payload is + located. + :vartype artifact_source_id: str + :ivar target_service_topology_id: Required. The resource Id of the service topology from which service units are being referenced in step groups to be deployed. - :type target_service_topology_id: str - :param step_groups: Required. The list of step groups that define the orchestration. - :type step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] + :vartype target_service_topology_id: str + :ivar step_groups: Required. The list of step groups that define the orchestration. + :vartype step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] """ _validation = { @@ -1192,6 +1398,18 @@ def __init__( artifact_source_id: Optional[str] = None, **kwargs ): + """ + :keyword build_version: Required. The version of the build being deployed. + :paramtype build_version: str + :keyword artifact_source_id: The reference to the artifact source resource Id where the payload + is located. + :paramtype artifact_source_id: str + :keyword target_service_topology_id: Required. The resource Id of the service topology from + which service units are being referenced in step groups to be deployed. + :paramtype target_service_topology_id: str + :keyword step_groups: Required. The list of step groups that define the orchestration. + :paramtype step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] + """ super(RolloutRequestProperties, self).__init__(**kwargs) self.build_version = build_version self.artifact_source_id = artifact_source_id @@ -1215,16 +1433,16 @@ class RolloutPropertiesAutoGenerated(RolloutRequestProperties, RolloutProperties :vartype operation_info: ~azure.mgmt.deploymentmanager.models.RolloutOperationInfo :ivar services: The detailed information on the services being deployed. :vartype services: list[~azure.mgmt.deploymentmanager.models.Service] - :param build_version: Required. The version of the build being deployed. - :type build_version: str - :param artifact_source_id: The reference to the artifact source resource Id where the payload - is located. - :type artifact_source_id: str - :param target_service_topology_id: Required. The resource Id of the service topology from which + :ivar build_version: Required. The version of the build being deployed. + :vartype build_version: str + :ivar artifact_source_id: The reference to the artifact source resource Id where the payload is + located. + :vartype artifact_source_id: str + :ivar target_service_topology_id: Required. The resource Id of the service topology from which service units are being referenced in step groups to be deployed. - :type target_service_topology_id: str - :param step_groups: Required. The list of step groups that define the orchestration. - :type step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] + :vartype target_service_topology_id: str + :ivar step_groups: Required. The list of step groups that define the orchestration. + :vartype step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] """ _validation = { @@ -1257,6 +1475,18 @@ def __init__( artifact_source_id: Optional[str] = None, **kwargs ): + """ + :keyword build_version: Required. The version of the build being deployed. + :paramtype build_version: str + :keyword artifact_source_id: The reference to the artifact source resource Id where the payload + is located. + :paramtype artifact_source_id: str + :keyword target_service_topology_id: Required. The resource Id of the service topology from + which service units are being referenced in step groups to be deployed. + :paramtype target_service_topology_id: str + :keyword step_groups: Required. The list of step groups that define the orchestration. + :paramtype step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] + """ super(RolloutPropertiesAutoGenerated, self).__init__(build_version=build_version, artifact_source_id=artifact_source_id, target_service_topology_id=target_service_topology_id, step_groups=step_groups, **kwargs) self.status = None self.total_retry_attempts = None @@ -1283,22 +1513,22 @@ class RolloutRequest(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param identity: Required. Identity for the resource. - :type identity: ~azure.mgmt.deploymentmanager.models.Identity - :param build_version: Required. The version of the build being deployed. - :type build_version: str - :param artifact_source_id: The reference to the artifact source resource Id where the payload - is located. - :type artifact_source_id: str - :param target_service_topology_id: Required. The resource Id of the service topology from which + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Required. Identity for the resource. + :vartype identity: ~azure.mgmt.deploymentmanager.models.Identity + :ivar build_version: Required. The version of the build being deployed. + :vartype build_version: str + :ivar artifact_source_id: The reference to the artifact source resource Id where the payload is + located. + :vartype artifact_source_id: str + :ivar target_service_topology_id: Required. The resource Id of the service topology from which service units are being referenced in step groups to be deployed. - :type target_service_topology_id: str - :param step_groups: Required. The list of step groups that define the orchestration. - :type step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] + :vartype target_service_topology_id: str + :ivar step_groups: Required. The list of step groups that define the orchestration. + :vartype step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] """ _validation = { @@ -1337,6 +1567,24 @@ def __init__( artifact_source_id: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Required. Identity for the resource. + :paramtype identity: ~azure.mgmt.deploymentmanager.models.Identity + :keyword build_version: Required. The version of the build being deployed. + :paramtype build_version: str + :keyword artifact_source_id: The reference to the artifact source resource Id where the payload + is located. + :paramtype artifact_source_id: str + :keyword target_service_topology_id: Required. The resource Id of the service topology from + which service units are being referenced in step groups to be deployed. + :paramtype target_service_topology_id: str + :keyword step_groups: Required. The list of step groups that define the orchestration. + :paramtype step_groups: list[~azure.mgmt.deploymentmanager.models.StepGroup] + """ super(RolloutRequest, self).__init__(tags=tags, location=location, **kwargs) self.identity = identity self.build_version = build_version @@ -1352,12 +1600,12 @@ class RolloutStep(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the step. - :type name: str + :ivar name: Required. Name of the step. + :vartype name: str :ivar status: Current state of the step. :vartype status: str - :param step_group: The step group the current step is part of. - :type step_group: str + :ivar step_group: The step group the current step is part of. + :vartype step_group: str :ivar operation_info: Detailed information of specific action execution. :vartype operation_info: ~azure.mgmt.deploymentmanager.models.StepOperationInfo :ivar resource_operations: Set of resource operations that were performed, if any, on an Azure @@ -1391,6 +1639,12 @@ def __init__( step_group: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. Name of the step. + :paramtype name: str + :keyword step_group: The step group the current step is part of. + :paramtype step_group: str + """ super(RolloutStep, self).__init__(**kwargs) self.name = name self.status = None @@ -1405,11 +1659,11 @@ class SasAuthentication(Authentication): All required parameters must be populated in order to send to Azure. - :param type: Required. The authentication type.Constant filled by server. - :type type: str - :param sas_uri: The SAS URI to the Azure Storage blob container. Any offset from the root of - the container to where the artifacts are located can be defined in the artifactRoot. - :type sas_uri: str + :ivar type: Required. The authentication type.Constant filled by server. + :vartype type: str + :ivar sas_uri: The SAS URI to the Azure Storage blob container. Any offset from the root of the + container to where the artifacts are located can be defined in the artifactRoot. + :vartype sas_uri: str """ _validation = { @@ -1427,6 +1681,11 @@ def __init__( sas_uri: Optional[str] = None, **kwargs ): + """ + :keyword sas_uri: The SAS URI to the Azure Storage blob container. Any offset from the root of + the container to where the artifacts are located can be defined in the artifactRoot. + :paramtype sas_uri: str + """ super(SasAuthentication, self).__init__(**kwargs) self.type = 'Sas' # type: str self.sas_uri = sas_uri @@ -1437,12 +1696,12 @@ class ServiceProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_location: Required. The Azure location to which the resources in the service + :ivar target_location: Required. The Azure location to which the resources in the service belong to or should be deployed to. - :type target_location: str - :param target_subscription_id: Required. The subscription to which the resources in the service + :vartype target_location: str + :ivar target_subscription_id: Required. The subscription to which the resources in the service belong to or should be deployed to. - :type target_subscription_id: str + :vartype target_subscription_id: str """ _validation = { @@ -1462,6 +1721,14 @@ def __init__( target_subscription_id: str, **kwargs ): + """ + :keyword target_location: Required. The Azure location to which the resources in the service + belong to or should be deployed to. + :paramtype target_location: str + :keyword target_subscription_id: Required. The subscription to which the resources in the + service belong to or should be deployed to. + :paramtype target_subscription_id: str + """ super(ServiceProperties, self).__init__(**kwargs) self.target_location = target_location self.target_subscription_id = target_subscription_id @@ -1472,16 +1739,16 @@ class Service(ServiceProperties): All required parameters must be populated in order to send to Azure. - :param target_location: Required. The Azure location to which the resources in the service + :ivar target_location: Required. The Azure location to which the resources in the service belong to or should be deployed to. - :type target_location: str - :param target_subscription_id: Required. The subscription to which the resources in the service + :vartype target_location: str + :ivar target_subscription_id: Required. The subscription to which the resources in the service belong to or should be deployed to. - :type target_subscription_id: str - :param name: Name of the service. - :type name: str - :param service_units: The detailed information about the units that make up the service. - :type service_units: list[~azure.mgmt.deploymentmanager.models.ServiceUnit] + :vartype target_subscription_id: str + :ivar name: Name of the service. + :vartype name: str + :ivar service_units: The detailed information about the units that make up the service. + :vartype service_units: list[~azure.mgmt.deploymentmanager.models.ServiceUnit] """ _validation = { @@ -1505,6 +1772,18 @@ def __init__( service_units: Optional[List["ServiceUnit"]] = None, **kwargs ): + """ + :keyword target_location: Required. The Azure location to which the resources in the service + belong to or should be deployed to. + :paramtype target_location: str + :keyword target_subscription_id: Required. The subscription to which the resources in the + service belong to or should be deployed to. + :paramtype target_subscription_id: str + :keyword name: Name of the service. + :paramtype name: str + :keyword service_units: The detailed information about the units that make up the service. + :paramtype service_units: list[~azure.mgmt.deploymentmanager.models.ServiceUnit] + """ super(Service, self).__init__(target_location=target_location, target_subscription_id=target_subscription_id, **kwargs) self.name = name self.service_units = service_units @@ -1525,16 +1804,16 @@ class ServiceResource(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param target_location: Required. The Azure location to which the resources in the service + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar target_location: Required. The Azure location to which the resources in the service belong to or should be deployed to. - :type target_location: str - :param target_subscription_id: Required. The subscription to which the resources in the service + :vartype target_location: str + :ivar target_subscription_id: Required. The subscription to which the resources in the service belong to or should be deployed to. - :type target_subscription_id: str + :vartype target_subscription_id: str """ _validation = { @@ -1565,6 +1844,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword target_location: Required. The Azure location to which the resources in the service + belong to or should be deployed to. + :paramtype target_location: str + :keyword target_subscription_id: Required. The subscription to which the resources in the + service belong to or should be deployed to. + :paramtype target_subscription_id: str + """ super(ServiceResource, self).__init__(tags=tags, location=location, **kwargs) self.target_location = target_location self.target_subscription_id = target_subscription_id @@ -1575,12 +1866,12 @@ class ServiceResourceProperties(ServiceProperties): All required parameters must be populated in order to send to Azure. - :param target_location: Required. The Azure location to which the resources in the service + :ivar target_location: Required. The Azure location to which the resources in the service belong to or should be deployed to. - :type target_location: str - :param target_subscription_id: Required. The subscription to which the resources in the service + :vartype target_location: str + :ivar target_subscription_id: Required. The subscription to which the resources in the service belong to or should be deployed to. - :type target_subscription_id: str + :vartype target_subscription_id: str """ _validation = { @@ -1600,15 +1891,23 @@ def __init__( target_subscription_id: str, **kwargs ): + """ + :keyword target_location: Required. The Azure location to which the resources in the service + belong to or should be deployed to. + :paramtype target_location: str + :keyword target_subscription_id: Required. The subscription to which the resources in the + service belong to or should be deployed to. + :paramtype target_subscription_id: str + """ super(ServiceResourceProperties, self).__init__(target_location=target_location, target_subscription_id=target_subscription_id, **kwargs) class ServiceTopologyProperties(msrest.serialization.Model): """The properties of a service topology. - :param artifact_source_id: The resource Id of the artifact source that contains the artifacts + :ivar artifact_source_id: The resource Id of the artifact source that contains the artifacts that can be referenced in the service units. - :type artifact_source_id: str + :vartype artifact_source_id: str """ _attribute_map = { @@ -1621,6 +1920,11 @@ def __init__( artifact_source_id: Optional[str] = None, **kwargs ): + """ + :keyword artifact_source_id: The resource Id of the artifact source that contains the artifacts + that can be referenced in the service units. + :paramtype artifact_source_id: str + """ super(ServiceTopologyProperties, self).__init__(**kwargs) self.artifact_source_id = artifact_source_id @@ -1640,13 +1944,13 @@ class ServiceTopologyResource(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param artifact_source_id: The resource Id of the artifact source that contains the artifacts + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar artifact_source_id: The resource Id of the artifact source that contains the artifacts that can be referenced in the service units. - :type artifact_source_id: str + :vartype artifact_source_id: str """ _validation = { @@ -1673,6 +1977,15 @@ def __init__( artifact_source_id: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword artifact_source_id: The resource Id of the artifact source that contains the artifacts + that can be referenced in the service units. + :paramtype artifact_source_id: str + """ super(ServiceTopologyResource, self).__init__(tags=tags, location=location, **kwargs) self.artifact_source_id = artifact_source_id @@ -1680,9 +1993,9 @@ def __init__( class ServiceTopologyResourceProperties(ServiceTopologyProperties): """The properties that define the service topology. - :param artifact_source_id: The resource Id of the artifact source that contains the artifacts + :ivar artifact_source_id: The resource Id of the artifact source that contains the artifacts that can be referenced in the service units. - :type artifact_source_id: str + :vartype artifact_source_id: str """ _attribute_map = { @@ -1695,6 +2008,11 @@ def __init__( artifact_source_id: Optional[str] = None, **kwargs ): + """ + :keyword artifact_source_id: The resource Id of the artifact source that contains the artifacts + that can be referenced in the service units. + :paramtype artifact_source_id: str + """ super(ServiceTopologyResourceProperties, self).__init__(artifact_source_id=artifact_source_id, **kwargs) @@ -1703,14 +2021,14 @@ class ServiceUnitProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_resource_group: Required. The Azure Resource Group to which the resources in the + :ivar target_resource_group: Required. The Azure Resource Group to which the resources in the service unit belong to or should be deployed to. - :type target_resource_group: str - :param deployment_mode: Required. Describes the type of ARM deployment to be performed on the + :vartype target_resource_group: str + :ivar deployment_mode: Required. Describes the type of ARM deployment to be performed on the resource. Possible values include: "Incremental", "Complete". - :type deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode - :param artifacts: The artifacts for the service unit. - :type artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts + :vartype deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode + :ivar artifacts: The artifacts for the service unit. + :vartype artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts """ _validation = { @@ -1732,6 +2050,16 @@ def __init__( artifacts: Optional["ServiceUnitArtifacts"] = None, **kwargs ): + """ + :keyword target_resource_group: Required. The Azure Resource Group to which the resources in + the service unit belong to or should be deployed to. + :paramtype target_resource_group: str + :keyword deployment_mode: Required. Describes the type of ARM deployment to be performed on the + resource. Possible values include: "Incremental", "Complete". + :paramtype deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode + :keyword artifacts: The artifacts for the service unit. + :paramtype artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts + """ super(ServiceUnitProperties, self).__init__(**kwargs) self.target_resource_group = target_resource_group self.deployment_mode = deployment_mode @@ -1743,18 +2071,18 @@ class ServiceUnit(ServiceUnitProperties): All required parameters must be populated in order to send to Azure. - :param target_resource_group: Required. The Azure Resource Group to which the resources in the + :ivar target_resource_group: Required. The Azure Resource Group to which the resources in the service unit belong to or should be deployed to. - :type target_resource_group: str - :param deployment_mode: Required. Describes the type of ARM deployment to be performed on the + :vartype target_resource_group: str + :ivar deployment_mode: Required. Describes the type of ARM deployment to be performed on the resource. Possible values include: "Incremental", "Complete". - :type deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode - :param artifacts: The artifacts for the service unit. - :type artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts - :param name: Name of the service unit. - :type name: str - :param steps: Detailed step information, if present. - :type steps: list[~azure.mgmt.deploymentmanager.models.RolloutStep] + :vartype deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode + :ivar artifacts: The artifacts for the service unit. + :vartype artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts + :ivar name: Name of the service unit. + :vartype name: str + :ivar steps: Detailed step information, if present. + :vartype steps: list[~azure.mgmt.deploymentmanager.models.RolloutStep] """ _validation = { @@ -1780,6 +2108,20 @@ def __init__( steps: Optional[List["RolloutStep"]] = None, **kwargs ): + """ + :keyword target_resource_group: Required. The Azure Resource Group to which the resources in + the service unit belong to or should be deployed to. + :paramtype target_resource_group: str + :keyword deployment_mode: Required. Describes the type of ARM deployment to be performed on the + resource. Possible values include: "Incremental", "Complete". + :paramtype deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode + :keyword artifacts: The artifacts for the service unit. + :paramtype artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts + :keyword name: Name of the service unit. + :paramtype name: str + :keyword steps: Detailed step information, if present. + :paramtype steps: list[~azure.mgmt.deploymentmanager.models.RolloutStep] + """ super(ServiceUnit, self).__init__(target_resource_group=target_resource_group, deployment_mode=deployment_mode, artifacts=artifacts, **kwargs) self.name = name self.steps = steps @@ -1788,16 +2130,16 @@ def __init__( class ServiceUnitArtifacts(msrest.serialization.Model): """Defines the artifacts of a service unit. - :param template_uri: The full URI of the ARM template file with the SAS token. - :type template_uri: str - :param parameters_uri: The full URI of the ARM parameters file with the SAS token. - :type parameters_uri: str - :param template_artifact_source_relative_path: The path to the ARM template file relative to + :ivar template_uri: The full URI of the ARM template file with the SAS token. + :vartype template_uri: str + :ivar parameters_uri: The full URI of the ARM parameters file with the SAS token. + :vartype parameters_uri: str + :ivar template_artifact_source_relative_path: The path to the ARM template file relative to the + artifact source. + :vartype template_artifact_source_relative_path: str + :ivar parameters_artifact_source_relative_path: The path to the ARM parameters file relative to the artifact source. - :type template_artifact_source_relative_path: str - :param parameters_artifact_source_relative_path: The path to the ARM parameters file relative - to the artifact source. - :type parameters_artifact_source_relative_path: str + :vartype parameters_artifact_source_relative_path: str """ _attribute_map = { @@ -1816,6 +2158,18 @@ def __init__( parameters_artifact_source_relative_path: Optional[str] = None, **kwargs ): + """ + :keyword template_uri: The full URI of the ARM template file with the SAS token. + :paramtype template_uri: str + :keyword parameters_uri: The full URI of the ARM parameters file with the SAS token. + :paramtype parameters_uri: str + :keyword template_artifact_source_relative_path: The path to the ARM template file relative to + the artifact source. + :paramtype template_artifact_source_relative_path: str + :keyword parameters_artifact_source_relative_path: The path to the ARM parameters file relative + to the artifact source. + :paramtype parameters_artifact_source_relative_path: str + """ super(ServiceUnitArtifacts, self).__init__(**kwargs) self.template_uri = template_uri self.parameters_uri = parameters_uri @@ -1838,18 +2192,18 @@ class ServiceUnitResource(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param target_resource_group: Required. The Azure Resource Group to which the resources in the + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar target_resource_group: Required. The Azure Resource Group to which the resources in the service unit belong to or should be deployed to. - :type target_resource_group: str - :param deployment_mode: Required. Describes the type of ARM deployment to be performed on the + :vartype target_resource_group: str + :ivar deployment_mode: Required. Describes the type of ARM deployment to be performed on the resource. Possible values include: "Incremental", "Complete". - :type deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode - :param artifacts: The artifacts for the service unit. - :type artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts + :vartype deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode + :ivar artifacts: The artifacts for the service unit. + :vartype artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts """ _validation = { @@ -1882,6 +2236,20 @@ def __init__( artifacts: Optional["ServiceUnitArtifacts"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword target_resource_group: Required. The Azure Resource Group to which the resources in + the service unit belong to or should be deployed to. + :paramtype target_resource_group: str + :keyword deployment_mode: Required. Describes the type of ARM deployment to be performed on the + resource. Possible values include: "Incremental", "Complete". + :paramtype deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode + :keyword artifacts: The artifacts for the service unit. + :paramtype artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts + """ super(ServiceUnitResource, self).__init__(tags=tags, location=location, **kwargs) self.target_resource_group = target_resource_group self.deployment_mode = deployment_mode @@ -1893,14 +2261,14 @@ class ServiceUnitResourceProperties(ServiceUnitProperties): All required parameters must be populated in order to send to Azure. - :param target_resource_group: Required. The Azure Resource Group to which the resources in the + :ivar target_resource_group: Required. The Azure Resource Group to which the resources in the service unit belong to or should be deployed to. - :type target_resource_group: str - :param deployment_mode: Required. Describes the type of ARM deployment to be performed on the + :vartype target_resource_group: str + :ivar deployment_mode: Required. Describes the type of ARM deployment to be performed on the resource. Possible values include: "Incremental", "Complete". - :type deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode - :param artifacts: The artifacts for the service unit. - :type artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts + :vartype deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode + :ivar artifacts: The artifacts for the service unit. + :vartype artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts """ _validation = { @@ -1922,6 +2290,16 @@ def __init__( artifacts: Optional["ServiceUnitArtifacts"] = None, **kwargs ): + """ + :keyword target_resource_group: Required. The Azure Resource Group to which the resources in + the service unit belong to or should be deployed to. + :paramtype target_resource_group: str + :keyword deployment_mode: Required. Describes the type of ARM deployment to be performed on the + resource. Possible values include: "Incremental", "Complete". + :paramtype deployment_mode: str or ~azure.mgmt.deploymentmanager.models.DeploymentMode + :keyword artifacts: The artifacts for the service unit. + :paramtype artifacts: ~azure.mgmt.deploymentmanager.models.ServiceUnitArtifacts + """ super(ServiceUnitResourceProperties, self).__init__(target_resource_group=target_resource_group, deployment_mode=deployment_mode, artifacts=artifacts, **kwargs) @@ -1930,18 +2308,17 @@ class StepGroup(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the step group. - :type name: str - :param depends_on_step_groups: The list of step group names on which this step group depends - on. - :type depends_on_step_groups: list[str] - :param pre_deployment_steps: The list of steps to be run before deploying the target. - :type pre_deployment_steps: list[~azure.mgmt.deploymentmanager.models.PrePostStep] - :param deployment_target_id: Required. The resource Id of service unit to be deployed. The + :ivar name: Required. The name of the step group. + :vartype name: str + :ivar depends_on_step_groups: The list of step group names on which this step group depends on. + :vartype depends_on_step_groups: list[str] + :ivar pre_deployment_steps: The list of steps to be run before deploying the target. + :vartype pre_deployment_steps: list[~azure.mgmt.deploymentmanager.models.PrePostStep] + :ivar deployment_target_id: Required. The resource Id of service unit to be deployed. The service unit should be from the service topology referenced in targetServiceTopologyId. - :type deployment_target_id: str - :param post_deployment_steps: The list of steps to be run after deploying the target. - :type post_deployment_steps: list[~azure.mgmt.deploymentmanager.models.PrePostStep] + :vartype deployment_target_id: str + :ivar post_deployment_steps: The list of steps to be run after deploying the target. + :vartype post_deployment_steps: list[~azure.mgmt.deploymentmanager.models.PrePostStep] """ _validation = { @@ -1967,6 +2344,20 @@ def __init__( post_deployment_steps: Optional[List["PrePostStep"]] = None, **kwargs ): + """ + :keyword name: Required. The name of the step group. + :paramtype name: str + :keyword depends_on_step_groups: The list of step group names on which this step group depends + on. + :paramtype depends_on_step_groups: list[str] + :keyword pre_deployment_steps: The list of steps to be run before deploying the target. + :paramtype pre_deployment_steps: list[~azure.mgmt.deploymentmanager.models.PrePostStep] + :keyword deployment_target_id: Required. The resource Id of service unit to be deployed. The + service unit should be from the service topology referenced in targetServiceTopologyId. + :paramtype deployment_target_id: str + :keyword post_deployment_steps: The list of steps to be run after deploying the target. + :paramtype post_deployment_steps: list[~azure.mgmt.deploymentmanager.models.PrePostStep] + """ super(StepGroup, self).__init__(**kwargs) self.name = name self.depends_on_step_groups = depends_on_step_groups @@ -1990,8 +2381,8 @@ class StepOperationInfo(msrest.serialization.Model): :vartype end_time: ~datetime.datetime :ivar last_updated_time: Last time in UTC this operation was updated. :vartype last_updated_time: ~datetime.datetime - :param error: The errors, if any, for the action. - :type error: ~azure.mgmt.deploymentmanager.models.CloudErrorBody + :ivar error: The errors, if any, for the action. + :vartype error: ~azure.mgmt.deploymentmanager.models.CloudErrorBody """ _validation = { @@ -2017,6 +2408,10 @@ def __init__( error: Optional["CloudErrorBody"] = None, **kwargs ): + """ + :keyword error: The errors, if any, for the action. + :paramtype error: ~azure.mgmt.deploymentmanager.models.CloudErrorBody + """ super(StepOperationInfo, self).__init__(**kwargs) self.deployment_name = None self.correlation_id = None @@ -2041,12 +2436,12 @@ class StepResource(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param properties: Required. The properties that define the step. - :type properties: ~azure.mgmt.deploymentmanager.models.StepProperties + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar properties: Required. The properties that define the step. + :vartype properties: ~azure.mgmt.deploymentmanager.models.StepProperties """ _validation = { @@ -2074,6 +2469,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword properties: Required. The properties that define the step. + :paramtype properties: ~azure.mgmt.deploymentmanager.models.StepProperties + """ super(StepResource, self).__init__(tags=tags, location=location, **kwargs) self.properties = properties @@ -2083,8 +2486,8 @@ class WaitStepAttributes(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param duration: Required. The duration in ISO 8601 format of how long the wait should be. - :type duration: str + :ivar duration: Required. The duration in ISO 8601 format of how long the wait should be. + :vartype duration: str """ _validation = { @@ -2101,6 +2504,10 @@ def __init__( duration: str, **kwargs ): + """ + :keyword duration: Required. The duration in ISO 8601 format of how long the wait should be. + :paramtype duration: str + """ super(WaitStepAttributes, self).__init__(**kwargs) self.duration = duration @@ -2110,11 +2517,11 @@ class WaitStepProperties(StepProperties): All required parameters must be populated in order to send to Azure. - :param step_type: Required. The type of step.Constant filled by server. Possible values - include: "Wait", "HealthCheck". - :type step_type: str or ~azure.mgmt.deploymentmanager.models.StepType - :param attributes: Required. The Wait attributes. - :type attributes: ~azure.mgmt.deploymentmanager.models.WaitStepAttributes + :ivar step_type: Required. The type of step.Constant filled by server. Possible values include: + "Wait", "HealthCheck". + :vartype step_type: str or ~azure.mgmt.deploymentmanager.models.StepType + :ivar attributes: Required. The Wait attributes. + :vartype attributes: ~azure.mgmt.deploymentmanager.models.WaitStepAttributes """ _validation = { @@ -2133,6 +2540,10 @@ def __init__( attributes: "WaitStepAttributes", **kwargs ): + """ + :keyword attributes: Required. The Wait attributes. + :paramtype attributes: ~azure.mgmt.deploymentmanager.models.WaitStepAttributes + """ super(WaitStepProperties, self).__init__(**kwargs) self.step_type = 'Wait' # type: str self.attributes = attributes diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_artifact_sources_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_artifact_sources_operations.py index 93b9e4b0b1c6..c8c8b8bcadd7 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_artifact_sources_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_artifact_sources_operations.py @@ -5,22 +5,172 @@ # 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, List, 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, List, 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + artifact_source_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "artifactSourceName": _SERIALIZER.url("artifact_source_name", artifact_source_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_get_request( + subscription_id: str, + resource_group_name: str, + artifact_source_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "artifactSourceName": _SERIALIZER.url("artifact_source_name", artifact_source_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_name: str, + artifact_source_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "artifactSourceName": _SERIALIZER.url("artifact_source_name", artifact_source_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_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ArtifactSourcesOperations(object): """ArtifactSourcesOperations operations. @@ -44,14 +194,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - artifact_source_name, # type: str - artifact_source_info=None, # type: Optional["_models.ArtifactSource"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ArtifactSource" + resource_group_name: str, + artifact_source_name: str, + artifact_source_info: Optional["_models.ArtifactSource"] = None, + **kwargs: Any + ) -> "_models.ArtifactSource": """Creates or updates an artifact source. Synchronously creates a new artifact source or updates an existing artifact source. @@ -72,35 +222,25 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'artifactSourceName': self._serialize.url("artifact_source_name", artifact_source_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 artifact_source_info is not None: - body_content = self._serialize.body(artifact_source_info, 'ArtifactSource') + _json = self._serialize.body(artifact_source_info, 'ArtifactSource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + artifact_source_name=artifact_source_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) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,15 +254,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - artifact_source_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ArtifactSource" + resource_group_name: str, + artifact_source_name: str, + **kwargs: Any + ) -> "_models.ArtifactSource": """Gets an artifact source. Gets an artifact source. @@ -141,27 +283,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'artifactSourceName': self._serialize.url("artifact_source_name", artifact_source_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + artifact_source_name=artifact_source_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 @@ -175,15 +307,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - artifact_source_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + artifact_source_name: str, + **kwargs: Any + ) -> None: """Deletes an artifact source. Deletes an artifact source. @@ -202,27 +336,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'artifactSourceName': self._serialize.url("artifact_source_name", artifact_source_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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + artifact_source_name=artifact_source_name, + template_url=self.delete.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.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -235,12 +359,13 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources/{artifactSourceName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.ArtifactSource"] + resource_group_name: str, + **kwargs: Any + ) -> List["_models.ArtifactSource"]: """Lists the artifact sources in a resource group. Lists the artifact sources in a resource group. @@ -257,26 +382,16 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,4 +405,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/artifactSources'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_operations.py index 7ef0d1a4c847..02019954f27b 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_operations.py @@ -5,22 +5,49 @@ # 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 +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 = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.DeploymentManager/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. @@ -44,11 +71,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationsList" + **kwargs: Any + ) -> "_models.OperationsList": """Lists the supported operations. Lists the supported operations. @@ -63,21 +90,14 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 @@ -91,4 +111,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.DeploymentManager/operations'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_rollouts_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_rollouts_operations.py index a3dde6622ea5..dc6a2d3a8c05 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_rollouts_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_rollouts_operations.py @@ -5,24 +5,252 @@ # 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, List, Optional, TypeVar, Union 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.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + rollout_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "rolloutName": _SERIALIZER.url("rollout_name", rollout_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_get_request( + subscription_id: str, + resource_group_name: str, + rollout_name: str, + *, + retry_attempt: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "rolloutName": _SERIALIZER.url("rollout_name", rollout_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if retry_attempt is not None: + query_parameters['retryAttempt'] = _SERIALIZER.query("retry_attempt", retry_attempt, 'int') + + # 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_name: str, + rollout_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "rolloutName": _SERIALIZER.url("rollout_name", rollout_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_cancel_request( + subscription_id: str, + resource_group_name: str, + rollout_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}/cancel') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "rolloutName": _SERIALIZER.url("rollout_name", rollout_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_restart_request( + subscription_id: str, + resource_group_name: str, + rollout_name: str, + *, + skip_succeeded: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}/restart') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "rolloutName": _SERIALIZER.url("rollout_name", rollout_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if skip_succeeded is not None: + query_parameters['skipSucceeded'] = _SERIALIZER.query("skip_succeeded", skip_succeeded, 'bool') + 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_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RolloutsOperations(object): """RolloutsOperations operations. @@ -48,46 +276,35 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - rollout_name, # type: str - rollout_request=None, # type: Optional["_models.RolloutRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.RolloutRequest" + resource_group_name: str, + rollout_name: str, + rollout_request: Optional["_models.RolloutRequest"] = None, + **kwargs: Any + ) -> "_models.RolloutRequest": cls = kwargs.pop('cls', None) # type: ClsType["_models.RolloutRequest"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_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 rollout_request is not None: - body_content = self._serialize.body(rollout_request, 'RolloutRequest') + _json = self._serialize.body(rollout_request, 'RolloutRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + rollout_name=rollout_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -97,22 +314,25 @@ def _create_or_update_initial( response_headers = {} response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('RolloutRequest', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - rollout_name, # type: str - rollout_request=None, # type: Optional["_models.RolloutRequest"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RolloutRequest"] + resource_group_name: str, + rollout_name: str, + rollout_request: Optional["_models.RolloutRequest"] = None, + **kwargs: Any + ) -> LROPoller["_models.RolloutRequest"]: """Creates or updates a rollout. This is an asynchronous operation and can be polled to completion using the location header @@ -126,15 +346,19 @@ def begin_create_or_update( :type rollout_request: ~azure.mgmt.deploymentmanager.models.RolloutRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RolloutRequest or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RolloutRequest or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deploymentmanager.models.RolloutRequest] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RolloutRequest"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,30 +370,24 @@ def begin_create_or_update( resource_group_name=resource_group_name, rollout_name=rollout_name, rollout_request=rollout_request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('RolloutRequest', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -181,16 +399,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - rollout_name, # type: str - retry_attempt=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> "_models.Rollout" + resource_group_name: str, + rollout_name: str, + retry_attempt: Optional[int] = None, + **kwargs: Any + ) -> "_models.Rollout": """Gets detailed information of a rollout. Gets detailed information of a rollout. @@ -212,29 +431,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_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') - if retry_attempt is not None: - query_parameters['retryAttempt'] = self._serialize.query("retry_attempt", retry_attempt, 'int') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + rollout_name=rollout_name, + retry_attempt=retry_attempt, + 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 @@ -248,15 +456,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - rollout_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + rollout_name: str, + **kwargs: Any + ) -> None: """Deletes a rollout resource. Only rollouts in terminal state can be deleted. @@ -275,27 +485,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_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_name=resource_group_name, + rollout_name=rollout_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 @@ -308,13 +508,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}'} # type: ignore + + @distributed_trace def cancel( self, - resource_group_name, # type: str - rollout_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Rollout" + resource_group_name: str, + rollout_name: str, + **kwargs: Any + ) -> "_models.Rollout": """Stops a running rollout. Only running rollouts can be canceled. @@ -333,27 +534,17 @@ def cancel( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.cancel.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_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_cancel_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + rollout_name=rollout_name, + template_url=self.cancel.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 @@ -367,16 +558,18 @@ def cancel( return cls(pipeline_response, deserialized, {}) return deserialized + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}/cancel'} # type: ignore + + @distributed_trace def restart( self, - resource_group_name, # type: str - rollout_name, # type: str - skip_succeeded=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> "_models.Rollout" + resource_group_name: str, + rollout_name: str, + skip_succeeded: Optional[bool] = None, + **kwargs: Any + ) -> "_models.Rollout": """Restarts a failed rollout and optionally skips all succeeded steps. Only failed rollouts can be restarted. @@ -399,29 +592,18 @@ def restart( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.restart.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'rolloutName': self._serialize.url("rollout_name", rollout_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if skip_succeeded is not None: - query_parameters['skipSucceeded'] = self._serialize.query("skip_succeeded", skip_succeeded, 'bool') - 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_restart_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + rollout_name=rollout_name, + skip_succeeded=skip_succeeded, + template_url=self.restart.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 @@ -435,14 +617,16 @@ def restart( return cls(pipeline_response, deserialized, {}) return deserialized + restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts/{rolloutName}/restart'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.Rollout"] + resource_group_name: str, + **kwargs: Any + ) -> List["_models.Rollout"]: """Lists the rollouts in a resource group. Lists the rollouts in a resource group. @@ -459,26 +643,16 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -492,4 +666,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/rollouts'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_service_topologies_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_service_topologies_operations.py index 6074a252adf0..321147430ad0 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_service_topologies_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_service_topologies_operations.py @@ -5,22 +5,172 @@ # 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, List, 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, List, 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + service_topology_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_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_get_request( + subscription_id: str, + resource_group_name: str, + service_topology_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_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_name: str, + service_topology_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_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_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ServiceTopologiesOperations(object): """ServiceTopologiesOperations operations. @@ -44,14 +194,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - service_topology_name, # type: str - service_topology_info, # type: "_models.ServiceTopologyResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceTopologyResource" + resource_group_name: str, + service_topology_name: str, + service_topology_info: "_models.ServiceTopologyResource", + **kwargs: Any + ) -> "_models.ServiceTopologyResource": """Creates or updates a service topology. Synchronously creates a new service topology or updates an existing service topology. @@ -72,32 +222,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_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(service_topology_info, 'ServiceTopologyResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_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(service_topology_info, 'ServiceTopologyResource') - 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 @@ -111,15 +251,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - service_topology_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceTopologyResource" + resource_group_name: str, + service_topology_name: str, + **kwargs: Any + ) -> "_models.ServiceTopologyResource": """Gets the service topology. Gets the service topology. @@ -138,27 +280,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + template_url=self.get.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 @@ -172,15 +304,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - service_topology_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_topology_name: str, + **kwargs: Any + ) -> None: """Deletes the service topology. Deletes the service topology. @@ -199,27 +333,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + template_url=self.delete.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.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -232,12 +356,13 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.ServiceTopologyResource"] + resource_group_name: str, + **kwargs: Any + ) -> List["_models.ServiceTopologyResource"]: """Lists the service topologies in the resource group. Lists the service topologies in the resource group. @@ -254,26 +379,16 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -287,4 +402,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_service_units_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_service_units_operations.py index 46cfaa316390..9a9bfa4bf845 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_service_units_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_service_units_operations.py @@ -5,24 +5,190 @@ # 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, List, Optional, TypeVar, Union 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.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_topology_name: str, + service_name: str, + service_unit_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceUnitName": _SERIALIZER.url("service_unit_name", service_unit_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_get_request( + subscription_id: str, + resource_group_name: str, + service_topology_name: str, + service_name: str, + service_unit_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceUnitName": _SERIALIZER.url("service_unit_name", service_unit_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_name: str, + service_topology_name: str, + service_name: str, + service_unit_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceUnitName": _SERIALIZER.url("service_unit_name", service_unit_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_list_request( + subscription_id: str, + resource_group_name: str, + service_topology_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ServiceUnitsOperations(object): """ServiceUnitsOperations operations. @@ -48,47 +214,36 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - service_topology_name, # type: str - service_name, # type: str - service_unit_name, # type: str - service_unit_info, # type: "_models.ServiceUnitResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceUnitResource" + resource_group_name: str, + service_topology_name: str, + service_name: str, + service_unit_name: str, + service_unit_info: "_models.ServiceUnitResource", + **kwargs: Any + ) -> "_models.ServiceUnitResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceUnitResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceUnitName': self._serialize.url("service_unit_name", service_unit_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(service_unit_info, 'ServiceUnitResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + service_unit_name=service_unit_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(service_unit_info, 'ServiceUnitResource') - 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 @@ -98,24 +253,27 @@ def _create_or_update_initial( response_headers = {} response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('ServiceUnitResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_topology_name, # type: str - service_name, # type: str - service_unit_name, # type: str - service_unit_info, # type: "_models.ServiceUnitResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceUnitResource"] + resource_group_name: str, + service_topology_name: str, + service_name: str, + service_unit_name: str, + service_unit_info: "_models.ServiceUnitResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceUnitResource"]: """Creates or updates a service unit under the service in the service topology. This is an asynchronous operation and can be polled to completion using the operation resource @@ -133,15 +291,19 @@ def begin_create_or_update( :type service_unit_info: ~azure.mgmt.deploymentmanager.models.ServiceUnitResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceUnitResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceUnitResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deploymentmanager.models.ServiceUnitResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceUnitResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -155,32 +317,24 @@ def begin_create_or_update( service_name=service_name, service_unit_name=service_unit_name, service_unit_info=service_unit_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('ServiceUnitResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceUnitName': self._serialize.url("service_unit_name", service_unit_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -192,17 +346,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - service_topology_name, # type: str - service_name, # type: str - service_unit_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceUnitResource" + resource_group_name: str, + service_topology_name: str, + service_name: str, + service_unit_name: str, + **kwargs: Any + ) -> "_models.ServiceUnitResource": """Gets the service unit. Gets the service unit. @@ -225,29 +380,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceUnitName': self._serialize.url("service_unit_name", service_unit_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + service_unit_name=service_unit_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 @@ -261,17 +406,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - service_topology_name, # type: str - service_name, # type: str - service_unit_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_topology_name: str, + service_name: str, + service_unit_name: str, + **kwargs: Any + ) -> None: """Deletes the service unit. Deletes the service unit. @@ -294,29 +441,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceUnitName': self._serialize.url("service_unit_name", service_unit_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_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + service_unit_name=service_unit_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 @@ -329,14 +466,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - service_topology_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.ServiceUnitResource"] + resource_group_name: str, + service_topology_name: str, + service_name: str, + **kwargs: Any + ) -> List["_models.ServiceUnitResource"]: """Lists the service units under a service in the service topology. Lists the service units under a service in the service topology. @@ -357,28 +495,18 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -392,4 +520,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_services_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_services_operations.py index 16744352b738..71e6cddeb8d3 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_services_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_services_operations.py @@ -5,22 +5,180 @@ # 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, List, 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, List, 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + service_topology_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_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_get_request( + subscription_id: str, + resource_group_name: str, + service_topology_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_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_name: str, + service_topology_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_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_list_request( + subscription_id: str, + resource_group_name: str, + service_topology_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "serviceTopologyName": _SERIALIZER.url("service_topology_name", service_topology_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ServicesOperations(object): """ServicesOperations operations. @@ -44,15 +202,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - service_topology_name, # type: str - service_name, # type: str - service_info, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_topology_name: str, + service_name: str, + service_info: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": """Creates or updates a service in the service topology. Synchronously creates a new service or updates an existing service. @@ -75,33 +233,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_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(service_info, 'ServiceResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_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(service_info, 'ServiceResource') - 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 @@ -115,16 +263,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - service_topology_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_topology_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": """Gets the service. Gets the service. @@ -145,28 +295,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + template_url=self.get.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 @@ -180,16 +320,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - service_topology_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_topology_name: str, + service_name: str, + **kwargs: Any + ) -> None: """Deletes the service. Deletes the service. @@ -210,28 +352,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + service_name=service_name, + template_url=self.delete.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.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,13 +376,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - service_topology_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.ServiceResource"] + resource_group_name: str, + service_topology_name: str, + **kwargs: Any + ) -> List["_models.ServiceResource"]: """Lists the services in the service topology. Lists the services in the service topology. @@ -269,27 +402,17 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serviceTopologyName': self._serialize.url("service_topology_name", service_topology_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_topology_name=service_topology_name, + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -303,4 +426,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services'} # type: ignore + diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_steps_operations.py b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_steps_operations.py index 2ca21406f97c..db9730aee515 100644 --- a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_steps_operations.py +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/azure/mgmt/deploymentmanager/operations/_steps_operations.py @@ -5,22 +5,172 @@ # 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, List, 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, List, 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + step_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "stepName": _SERIALIZER.url("step_name", step_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_get_request( + subscription_id: str, + resource_group_name: str, + step_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "stepName": _SERIALIZER.url("step_name", step_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_name: str, + step_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "stepName": _SERIALIZER.url("step_name", step_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_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StepsOperations(object): """StepsOperations operations. @@ -44,14 +194,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - step_name, # type: str - step_info=None, # type: Optional["_models.StepResource"] - **kwargs # type: Any - ): - # type: (...) -> "_models.StepResource" + resource_group_name: str, + step_name: str, + step_info: Optional["_models.StepResource"] = None, + **kwargs: Any + ) -> "_models.StepResource": """Creates or updates a rollout step with the given step properties. Synchronously creates a new step or updates an existing step. @@ -72,35 +222,25 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'stepName': self._serialize.url("step_name", step_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 step_info is not None: - body_content = self._serialize.body(step_info, 'StepResource') + _json = self._serialize.body(step_info, 'StepResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + step_name=step_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) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,15 +254,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - step_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StepResource" + resource_group_name: str, + step_name: str, + **kwargs: Any + ) -> "_models.StepResource": """Gets the step. Gets the step. @@ -141,27 +283,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'stepName': self._serialize.url("step_name", step_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + step_name=step_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 @@ -175,15 +307,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - step_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + step_name: str, + **kwargs: Any + ) -> None: """Deletes the step. Deletes the step. @@ -202,27 +336,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'stepName': self._serialize.url("step_name", step_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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + step_name=step_name, + template_url=self.delete.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.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -235,12 +359,13 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.StepResource"] + resource_group_name: str, + **kwargs: Any + ) -> List["_models.StepResource"]: """Lists the steps in a resource group. Lists the steps in a resource group. @@ -257,26 +382,16 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01-preview" - accept = "application/json" - - # 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -290,4 +405,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps'} # type: ignore +