From 2bf3198d2c40cb3c990000ebe41c9fd84a87fff6 Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Thu, 20 Jan 2022 09:41:42 +0800 Subject: [PATCH] [AutoRelease] t2-trafficmanager-2022-01-19-84135 (#22554) * CodeGen from PR 16472 in Azure/azure-rest-api-specs trafficmanager: adding the missing enum values for traffic manager endpoint (#16472) * trafficmanager: adding the missing enum values for traffic manager endpoint These are required in the API but undocumented - so pulling these out explicitly * trafficmanager: casing to TitleCase * version,CHANGELOG Co-authored-by: SDKAuto Co-authored-by: PythonSdkPipelines Co-authored-by: Yuchao Yan --- .../azure-mgmt-trafficmanager/CHANGELOG.md | 6 + .../azure-mgmt-trafficmanager/_meta.json | 11 +- .../azure/mgmt/trafficmanager/__init__.py | 9 +- .../mgmt/trafficmanager/_configuration.py | 19 +- .../azure/mgmt/trafficmanager/_metadata.json | 21 +- .../azure/mgmt/trafficmanager/_patch.py | 31 + .../_traffic_manager_management_client.py | 102 ++- .../azure/mgmt/trafficmanager/_vendor.py | 27 + .../azure/mgmt/trafficmanager/_version.py | 2 +- .../azure/mgmt/trafficmanager/aio/__init__.py | 5 + .../mgmt/trafficmanager/aio/_configuration.py | 6 +- .../azure/mgmt/trafficmanager/aio/_patch.py | 31 + .../aio/_traffic_manager_management_client.py | 90 +- .../aio/operations/_endpoints_operations.py | 188 ++-- .../_geographic_hierarchies_operations.py | 32 +- .../aio/operations/_heat_map_operations.py | 49 +- .../aio/operations/_profiles_operations.py | 293 +++---- ...ic_manager_user_metrics_keys_operations.py | 95 +-- .../mgmt/trafficmanager/models/__init__.py | 74 +- .../mgmt/trafficmanager/models/_models.py | 807 ------------------ .../mgmt/trafficmanager/models/_models_py3.py | 720 +++++++++++----- ...traffic_manager_management_client_enums.py | 41 +- .../operations/_endpoints_operations.py | 415 ++++++--- .../_geographic_hierarchies_operations.py | 72 +- .../operations/_heat_map_operations.py | 116 ++- .../operations/_profiles_operations.py | 600 ++++++++----- ...ic_manager_user_metrics_keys_operations.py | 209 +++-- .../azure-mgmt-trafficmanager/setup.py | 2 +- shared_requirements.txt | 2 + 29 files changed, 2024 insertions(+), 2051 deletions(-) create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_patch.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_vendor.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_patch.py delete mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models.py diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/CHANGELOG.md b/sdk/trafficmanager/azure-mgmt-trafficmanager/CHANGELOG.md index 7200131f3ae4..4e3e58bafb0c 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/CHANGELOG.md +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.0.0 (2022-01-19) + +**Features** + + - Added model EndpointType + ## 1.0.0b1 (2021-05-13) This is beta preview version. diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/_meta.json b/sdk/trafficmanager/azure-mgmt-trafficmanager/_meta.json index 8bec0a2c24b1..311921bec638 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/_meta.json +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/_meta.json @@ -1,8 +1,11 @@ { - "autorest": "3.3.0", - "use": "@autorest/python@5.6.6", - "commit": "6e765382bb72623e7f5d9a11b53954c586ab8663", + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "d72b193573bb076d190e410adfd2bb95b569fbb6", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/trafficmanager/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.6 --version=3.3.0", + "autorest_command": "autorest specification/trafficmanager/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/trafficmanager/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/__init__.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/__init__.py index c01656b6fa6a..2b47f1508ed6 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/__init__.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['TrafficManagerManagementClient'] -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/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_configuration.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_configuration.py index 31fa8405de34..cf24a6be1a94 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_configuration.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_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 TrafficManagerManagementClientConfiguration(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(TrafficManagerManagementClientConfiguration, 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(TrafficManagerManagementClientConfiguration, 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/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_metadata.json b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_metadata.json index 2466c30ef35a..a1b0830e9a40 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_metadata.json +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_metadata.json @@ -5,13 +5,13 @@ "name": "TrafficManagerManagementClient", "filename": "_traffic_manager_management_client", "description": "TrafficManagerManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"TrafficManagerManagementClientConfiguration\"]}}, \"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\": [\"TrafficManagerManagementClientConfiguration\"]}}, \"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\": [\"TrafficManagerManagementClientConfiguration\"]}}, \"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\": [\"TrafficManagerManagementClientConfiguration\"]}}, \"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": { "endpoints": "EndpointsOperations", diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_patch.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_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/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_traffic_manager_management_client.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_traffic_manager_management_client.py index a6d4a30406a2..d11587583989 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_traffic_manager_management_client.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_traffic_manager_management_client.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import TrafficManagerManagementClientConfiguration +from .operations import EndpointsOperations, GeographicHierarchiesOperations, HeatMapOperations, ProfilesOperations, TrafficManagerUserMetricsKeysOperations + 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 TrafficManagerManagementClientConfiguration -from .operations import EndpointsOperations -from .operations import ProfilesOperations -from .operations import GeographicHierarchiesOperations -from .operations import HeatMapOperations -from .operations import TrafficManagerUserMetricsKeysOperations -from . import models - -class TrafficManagerManagementClient(object): +class TrafficManagerManagementClient: """TrafficManagerManagementClient. :ivar endpoints: EndpointsOperations operations @@ -35,64 +29,68 @@ class TrafficManagerManagementClient(object): :ivar profiles: ProfilesOperations operations :vartype profiles: azure.mgmt.trafficmanager.operations.ProfilesOperations :ivar geographic_hierarchies: GeographicHierarchiesOperations operations - :vartype geographic_hierarchies: azure.mgmt.trafficmanager.operations.GeographicHierarchiesOperations + :vartype geographic_hierarchies: + azure.mgmt.trafficmanager.operations.GeographicHierarchiesOperations :ivar heat_map: HeatMapOperations operations :vartype heat_map: azure.mgmt.trafficmanager.operations.HeatMapOperations :ivar traffic_manager_user_metrics_keys: TrafficManagerUserMetricsKeysOperations operations - :vartype traffic_manager_user_metrics_keys: azure.mgmt.trafficmanager.operations.TrafficManagerUserMetricsKeysOperations + :vartype traffic_manager_user_metrics_keys: + azure.mgmt.trafficmanager.operations.TrafficManagerUserMetricsKeysOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets 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 + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = TrafficManagerManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = TrafficManagerManagementClientConfiguration(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.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.profiles = ProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.geographic_hierarchies = GeographicHierarchiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.heat_map = HeatMapOperations(self._client, self._config, self._serialize, self._deserialize) + self.traffic_manager_user_metrics_keys = TrafficManagerUserMetricsKeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.endpoints = EndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.profiles = ProfilesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.geographic_hierarchies = GeographicHierarchiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.heat_map = HeatMapOperations( - self._client, self._config, self._serialize, self._deserialize) - self.traffic_manager_user_metrics_keys = TrafficManagerUserMetricsKeysOperations( - 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/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_vendor.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_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/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_version.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_version.py index e5754a47ce68..c47f66669f1b 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_version.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "1.0.0" diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/__init__.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/__init__.py index 994270b5084d..b48878c326cf 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/__init__.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/__init__.py @@ -8,3 +8,8 @@ from ._traffic_manager_management_client import TrafficManagerManagementClient __all__ = ['TrafficManagerManagementClient'] + +# `._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/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_configuration.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_configuration.py index a08c23136acf..9a5b9ddb6ad8 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_configuration.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/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(TrafficManagerManagementClientConfiguration, 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(TrafficManagerManagementClientConfiguration, 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/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_patch.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/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/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_traffic_manager_management_client.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_traffic_manager_management_client.py index 414fda36d754..83514b3712fe 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_traffic_manager_management_client.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_traffic_manager_management_client.py @@ -6,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.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 TrafficManagerManagementClientConfiguration +from .operations import EndpointsOperations, GeographicHierarchiesOperations, HeatMapOperations, ProfilesOperations, TrafficManagerUserMetricsKeysOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import TrafficManagerManagementClientConfiguration -from .operations import EndpointsOperations -from .operations import ProfilesOperations -from .operations import GeographicHierarchiesOperations -from .operations import HeatMapOperations -from .operations import TrafficManagerUserMetricsKeysOperations -from .. import models - - -class TrafficManagerManagementClient(object): +class TrafficManagerManagementClient: """TrafficManagerManagementClient. :ivar endpoints: EndpointsOperations operations @@ -33,62 +29,68 @@ class TrafficManagerManagementClient(object): :ivar profiles: ProfilesOperations operations :vartype profiles: azure.mgmt.trafficmanager.aio.operations.ProfilesOperations :ivar geographic_hierarchies: GeographicHierarchiesOperations operations - :vartype geographic_hierarchies: azure.mgmt.trafficmanager.aio.operations.GeographicHierarchiesOperations + :vartype geographic_hierarchies: + azure.mgmt.trafficmanager.aio.operations.GeographicHierarchiesOperations :ivar heat_map: HeatMapOperations operations :vartype heat_map: azure.mgmt.trafficmanager.aio.operations.HeatMapOperations :ivar traffic_manager_user_metrics_keys: TrafficManagerUserMetricsKeysOperations operations - :vartype traffic_manager_user_metrics_keys: azure.mgmt.trafficmanager.aio.operations.TrafficManagerUserMetricsKeysOperations + :vartype traffic_manager_user_metrics_keys: + azure.mgmt.trafficmanager.aio.operations.TrafficManagerUserMetricsKeysOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets 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 + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = TrafficManagerManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = TrafficManagerManagementClientConfiguration(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.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.profiles = ProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.geographic_hierarchies = GeographicHierarchiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.heat_map = HeatMapOperations(self._client, self._config, self._serialize, self._deserialize) + self.traffic_manager_user_metrics_keys = TrafficManagerUserMetricsKeysOperations(self._client, self._config, self._serialize, self._deserialize) + - self.endpoints = EndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.profiles = ProfilesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.geographic_hierarchies = GeographicHierarchiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.heat_map = HeatMapOperations( - self._client, self._config, self._serialize, self._deserialize) - self.traffic_manager_user_metrics_keys = TrafficManagerUserMetricsKeysOperations( - 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/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_endpoints_operations.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_endpoints_operations.py index 4c8df8bf6fa7..da69d640a928 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_endpoints_operations.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_endpoints_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, 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.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._endpoints_operations import build_create_or_update_request, build_delete_request, build_get_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,14 +44,15 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def update( self, resource_group_name: str, profile_name: str, - endpoint_type: str, + endpoint_type: Union[str, "_models.EndpointType"], endpoint_name: str, parameters: "_models.Endpoint", - **kwargs + **kwargs: Any ) -> "_models.Endpoint": """Update a Traffic Manager endpoint. @@ -57,7 +62,7 @@ async def update( :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manager endpoint to be updated. - :type endpoint_type: str + :type endpoint_type: str or ~azure.mgmt.trafficmanager.models.EndpointType :param endpoint_name: The name of the Traffic Manager endpoint to be updated. :type endpoint_name: str :param parameters: The Traffic Manager endpoint parameters supplied to the Update operation. @@ -72,34 +77,24 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointType': self._serialize.url("endpoint_type", endpoint_type, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Endpoint') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_type=endpoint_type, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Endpoint') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,15 +108,18 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, - endpoint_type: str, + endpoint_type: Union[str, "_models.EndpointType"], endpoint_name: str, - **kwargs + **kwargs: Any ) -> "_models.Endpoint": """Gets a Traffic Manager endpoint. @@ -131,7 +129,7 @@ async def get( :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manager endpoint. - :type endpoint_type: str + :type endpoint_type: str or ~azure.mgmt.trafficmanager.models.EndpointType :param endpoint_name: The name of the Traffic Manager endpoint. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,29 +142,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointType': self._serialize.url("endpoint_type", endpoint_type, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_type=endpoint_type, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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 @@ -180,16 +168,19 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, profile_name: str, - endpoint_type: str, + endpoint_type: Union[str, "_models.EndpointType"], endpoint_name: str, parameters: "_models.Endpoint", - **kwargs + **kwargs: Any ) -> "_models.Endpoint": """Create or update a Traffic Manager endpoint. @@ -199,7 +190,7 @@ async def create_or_update( :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manager endpoint to be created or updated. - :type endpoint_type: str + :type endpoint_type: str or ~azure.mgmt.trafficmanager.models.EndpointType :param endpoint_name: The name of the Traffic Manager endpoint to be created or updated. :type endpoint_name: str :param parameters: The Traffic Manager endpoint parameters supplied to the CreateOrUpdate @@ -215,34 +206,24 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointType': self._serialize.url("endpoint_type", endpoint_type, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Endpoint') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_type=endpoint_type, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'Endpoint') - 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 @@ -260,15 +241,18 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, profile_name: str, - endpoint_type: str, + endpoint_type: Union[str, "_models.EndpointType"], endpoint_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.DeleteOperationResult"]: """Deletes a Traffic Manager endpoint. @@ -278,7 +262,7 @@ async def delete( :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manager endpoint to be deleted. - :type endpoint_type: str + :type endpoint_type: str or ~azure.mgmt.trafficmanager.models.EndpointType :param endpoint_name: The name of the Traffic Manager endpoint to be deleted. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -291,29 +275,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointType': self._serialize.url("endpoint_type", endpoint_type, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_type=endpoint_type, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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 @@ -329,4 +303,6 @@ async def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_geographic_hierarchies_operations.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_geographic_hierarchies_operations.py index 6974af574959..abaaff11be56 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_geographic_hierarchies_operations.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_geographic_hierarchies_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._geographic_hierarchies_operations import build_get_default_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,9 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_default( self, - **kwargs + **kwargs: Any ) -> "_models.TrafficManagerGeographicHierarchy": """Gets the default Geographic Hierarchy used by the Geographic traffic routing method. @@ -56,21 +61,14 @@ async def get_default( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - - # Construct URL - url = self.get_default.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_get_default_request( + template_url=self.get_default.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 @@ -84,4 +82,6 @@ async def get_default( return cls(pipeline_response, deserialized, {}) return deserialized + get_default.metadata = {'url': '/providers/Microsoft.Network/trafficManagerGeographicHierarchies/default'} # type: ignore + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_heat_map_operations.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_heat_map_operations.py index a6d9c40e94fe..8d12f3c52707 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_heat_map_operations.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_heat_map_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._heat_map_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,13 +44,14 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, top_left: Optional[List[float]] = None, bot_right: Optional[List[float]] = None, - **kwargs + **kwargs: Any ) -> "_models.HeatMapModel": """Gets latest heatmap for Traffic Manager profile. @@ -70,33 +75,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - heat_map_type = "default" - api_version = "2018-08-01" - 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'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'heatMapType': self._serialize.url("heat_map_type", heat_map_type, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top_left is not None: - query_parameters['topLeft'] = self._serialize.query("top_left", top_left, '[float]', div=',') - if bot_right is not None: - query_parameters['botRight'] = self._serialize.query("bot_right", bot_right, '[float]', div=',') - 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, + profile_name=profile_name, + top_left=top_left, + bot_right=bot_right, + 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 @@ -110,4 +101,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/heatMaps/{heatMapType}'} # type: ignore + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_profiles_operations.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_profiles_operations.py index b52ed9126e8e..931fab5c8dec 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_profiles_operations.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_profiles_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._profiles_operations import build_check_traffic_manager_relative_dns_name_availability_request, build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,16 +46,18 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_traffic_manager_relative_dns_name_availability( self, parameters: "_models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters", - **kwargs + **kwargs: Any ) -> "_models.TrafficManagerNameAvailability": """Checks the availability of a Traffic Manager Relative DNS name. :param parameters: The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. - :type parameters: ~azure.mgmt.trafficmanager.models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters + :type parameters: + ~azure.mgmt.trafficmanager.models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: TrafficManagerNameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.trafficmanager.models.TrafficManagerNameAvailability @@ -61,26 +68,19 @@ async def check_traffic_manager_relative_dns_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_traffic_manager_relative_dns_name_availability.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckTrafficManagerRelativeDnsNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckTrafficManagerRelativeDnsNameAvailabilityParameters') + + request = build_check_traffic_manager_relative_dns_name_availability_request( + content_type=content_type, + json=_json, + template_url=self.check_traffic_manager_relative_dns_name_availability.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 @@ -94,12 +94,15 @@ async def check_traffic_manager_relative_dns_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_traffic_manager_relative_dns_name_availability.metadata = {'url': '/providers/Microsoft.Network/checkTrafficManagerNameAvailability'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ProfileListResult"]: """Lists all Traffic Manager profiles within a resource group. @@ -108,7 +111,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProfileListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.trafficmanager.models.ProfileListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.trafficmanager.models.ProfileListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProfileListResult"] @@ -116,35 +120,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProfileListResult', pipeline_response) + deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -162,20 +162,23 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles'} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ProfileListResult"]: """Lists all Traffic Manager profiles within a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProfileListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.trafficmanager.models.ProfileListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.trafficmanager.models.ProfileListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProfileListResult"] @@ -183,34 +186,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProfileListResult', pipeline_response) + deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -228,16 +226,18 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> "_models.Profile": """Gets a Traffic Manager profile. @@ -256,27 +256,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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 @@ -290,14 +280,17 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, profile_name: str, parameters: "_models.Profile", - **kwargs + **kwargs: Any ) -> "_models.Profile": """Create or update a Traffic Manager profile. @@ -319,32 +312,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Profile') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'Profile') - 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 @@ -362,13 +345,16 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.DeleteOperationResult"]: """Deletes a Traffic Manager profile. @@ -387,27 +373,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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 @@ -423,14 +399,17 @@ async def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, profile_name: str, parameters: "_models.Profile", - **kwargs + **kwargs: Any ) -> "_models.Profile": """Update a Traffic Manager profile. @@ -451,32 +430,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Profile') + + request = build_update_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Profile') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -490,4 +459,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_traffic_manager_user_metrics_keys_operations.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_traffic_manager_user_metrics_keys_operations.py index aaaa09f3447d..d1fa783ec420 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_traffic_manager_user_metrics_keys_operations.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_traffic_manager_user_metrics_keys_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._traffic_manager_user_metrics_keys_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,9 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, - **kwargs + **kwargs: Any ) -> "_models.UserMetricsModel": """Get the subscription-level key used for Real User Metrics collection. @@ -56,25 +61,15 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - 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'), - } - 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, + 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 @@ -88,11 +83,14 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default'} # type: ignore + + @distributed_trace_async async def create_or_update( self, - **kwargs + **kwargs: Any ) -> "_models.UserMetricsModel": """Create or update a subscription-level key used for Real User Metrics collection. @@ -106,25 +104,15 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - 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'), - } - 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_create_or_update_request( + subscription_id=self._config.subscription_id, + template_url=self.create_or_update.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.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -138,11 +126,14 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default'} # type: ignore + + @distributed_trace_async async def delete( self, - **kwargs + **kwargs: Any ) -> "_models.DeleteOperationResult": """Delete a subscription-level key used for Real User Metrics collection. @@ -156,25 +147,15 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - 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'), - } - 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, + 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 @@ -188,4 +169,6 @@ async def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default'} # type: ignore + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/__init__.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/__init__.py index b900b7bca82f..74c8478fffd5 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/__init__.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/__init__.py @@ -6,59 +6,36 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import CheckTrafficManagerRelativeDnsNameAvailabilityParameters - from ._models_py3 import CloudErrorBody - from ._models_py3 import DeleteOperationResult - from ._models_py3 import DnsConfig - from ._models_py3 import Endpoint - from ._models_py3 import EndpointPropertiesCustomHeadersItem - from ._models_py3 import EndpointPropertiesSubnetsItem - from ._models_py3 import HeatMapEndpoint - from ._models_py3 import HeatMapModel - from ._models_py3 import MonitorConfig - from ._models_py3 import MonitorConfigCustomHeadersItem - from ._models_py3 import MonitorConfigExpectedStatusCodeRangesItem - from ._models_py3 import Profile - from ._models_py3 import ProfileListResult - from ._models_py3 import ProxyResource - from ._models_py3 import QueryExperience - from ._models_py3 import Region - from ._models_py3 import Resource - from ._models_py3 import TrackedResource - from ._models_py3 import TrafficFlow - from ._models_py3 import TrafficManagerGeographicHierarchy - from ._models_py3 import TrafficManagerNameAvailability - from ._models_py3 import UserMetricsModel -except (SyntaxError, ImportError): - from ._models import CheckTrafficManagerRelativeDnsNameAvailabilityParameters # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import DeleteOperationResult # type: ignore - from ._models import DnsConfig # type: ignore - from ._models import Endpoint # type: ignore - from ._models import EndpointPropertiesCustomHeadersItem # type: ignore - from ._models import EndpointPropertiesSubnetsItem # type: ignore - from ._models import HeatMapEndpoint # type: ignore - from ._models import HeatMapModel # type: ignore - from ._models import MonitorConfig # type: ignore - from ._models import MonitorConfigCustomHeadersItem # type: ignore - from ._models import MonitorConfigExpectedStatusCodeRangesItem # type: ignore - from ._models import Profile # type: ignore - from ._models import ProfileListResult # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QueryExperience # type: ignore - from ._models import Region # type: ignore - from ._models import Resource # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import TrafficFlow # type: ignore - from ._models import TrafficManagerGeographicHierarchy # type: ignore - from ._models import TrafficManagerNameAvailability # type: ignore - from ._models import UserMetricsModel # type: ignore +from ._models_py3 import CheckTrafficManagerRelativeDnsNameAvailabilityParameters +from ._models_py3 import CloudErrorBody +from ._models_py3 import DeleteOperationResult +from ._models_py3 import DnsConfig +from ._models_py3 import Endpoint +from ._models_py3 import EndpointPropertiesCustomHeadersItem +from ._models_py3 import EndpointPropertiesSubnetsItem +from ._models_py3 import HeatMapEndpoint +from ._models_py3 import HeatMapModel +from ._models_py3 import MonitorConfig +from ._models_py3 import MonitorConfigCustomHeadersItem +from ._models_py3 import MonitorConfigExpectedStatusCodeRangesItem +from ._models_py3 import Profile +from ._models_py3 import ProfileListResult +from ._models_py3 import ProxyResource +from ._models_py3 import QueryExperience +from ._models_py3 import Region +from ._models_py3 import Resource +from ._models_py3 import TrackedResource +from ._models_py3 import TrafficFlow +from ._models_py3 import TrafficManagerGeographicHierarchy +from ._models_py3 import TrafficManagerNameAvailability +from ._models_py3 import UserMetricsModel + from ._traffic_manager_management_client_enums import ( AllowedEndpointRecordType, EndpointMonitorStatus, EndpointStatus, + EndpointType, MonitorProtocol, ProfileMonitorStatus, ProfileStatus, @@ -93,6 +70,7 @@ 'AllowedEndpointRecordType', 'EndpointMonitorStatus', 'EndpointStatus', + 'EndpointType', 'MonitorProtocol', 'ProfileMonitorStatus', 'ProfileStatus', diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models.py deleted file mode 100644 index c48521a4592c..000000000000 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models.py +++ /dev/null @@ -1,807 +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 CheckTrafficManagerRelativeDnsNameAvailabilityParameters(msrest.serialization.Model): - """Parameters supplied to check Traffic Manager name operation. - - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. - :type type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckTrafficManagerRelativeDnsNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class CloudErrorBody(msrest.serialization.Model): - """The content of an error returned by the Azure Resource Manager. - - :param code: Error code. - :type code: str - :param message: Error message. - :type message: str - :param target: Error target. - :type target: str - :param details: Error details. - :type details: list[~azure.mgmt.trafficmanager.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class DeleteOperationResult(msrest.serialization.Model): - """The result of the request or operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation_result: The result of the operation or request. - :vartype operation_result: bool - """ - - _validation = { - 'operation_result': {'readonly': True}, - } - - _attribute_map = { - 'operation_result': {'key': 'boolean', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DeleteOperationResult, self).__init__(**kwargs) - self.operation_result = None - - -class DnsConfig(msrest.serialization.Model): - """Class containing DNS settings in a Traffic Manager profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param relative_name: The relative DNS name provided by this Traffic Manager profile. This - value is combined with the DNS domain name used by Azure Traffic Manager to form the - fully-qualified domain name (FQDN) of the profile. - :type relative_name: str - :ivar fqdn: The fully-qualified domain name (FQDN) of the Traffic Manager profile. This is - formed from the concatenation of the RelativeName with the DNS domain used by Azure Traffic - Manager. - :vartype fqdn: str - :param ttl: The DNS Time-To-Live (TTL), in seconds. This informs the local DNS resolvers and - DNS clients how long to cache DNS responses provided by this Traffic Manager profile. - :type ttl: long - """ - - _validation = { - 'fqdn': {'readonly': True}, - } - - _attribute_map = { - 'relative_name': {'key': 'relativeName', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'ttl': {'key': 'ttl', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(DnsConfig, self).__init__(**kwargs) - self.relative_name = kwargs.get('relative_name', None) - self.fqdn = None - self.ttl = kwargs.get('ttl', None) - - -class Resource(msrest.serialization.Model): - """The core properties of ARM resources. - - :param id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - """ - - _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 = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - :param id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class Endpoint(ProxyResource): - """Class representing a Traffic Manager endpoint. - - :param id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param target_resource_id: The Azure Resource URI of the of the endpoint. Not applicable to - endpoints of type 'ExternalEndpoints'. - :type target_resource_id: str - :param target: The fully-qualified DNS name or IP address of the endpoint. Traffic Manager - returns this value in DNS responses to direct traffic to this endpoint. - :type target: str - :param endpoint_status: The status of the endpoint. If the endpoint is Enabled, it is probed - for endpoint health and is included in the traffic routing method. Possible values include: - "Enabled", "Disabled". - :type endpoint_status: str or ~azure.mgmt.trafficmanager.models.EndpointStatus - :param weight: The weight of this endpoint when using the 'Weighted' traffic routing method. - Possible values are from 1 to 1000. - :type weight: long - :param priority: The priority of this endpoint when using the 'Priority' traffic routing - method. Possible values are from 1 to 1000, lower values represent higher priority. This is an - optional parameter. If specified, it must be specified on all endpoints, and no two endpoints - can share the same priority value. - :type priority: long - :param endpoint_location: Specifies the location of the external or nested endpoints when using - the 'Performance' traffic routing method. - :type endpoint_location: str - :param endpoint_monitor_status: The monitoring status of the endpoint. Possible values include: - "CheckingEndpoint", "Online", "Degraded", "Disabled", "Inactive", "Stopped". - :type endpoint_monitor_status: str or ~azure.mgmt.trafficmanager.models.EndpointMonitorStatus - :param min_child_endpoints: The minimum number of endpoints that must be available in the child - profile in order for the parent profile to be considered available. Only applicable to endpoint - of type 'NestedEndpoints'. - :type min_child_endpoints: long - :param min_child_endpoints_i_pv4: The minimum number of IPv4 (DNS record type A) endpoints that - must be available in the child profile in order for the parent profile to be considered - available. Only applicable to endpoint of type 'NestedEndpoints'. - :type min_child_endpoints_i_pv4: long - :param min_child_endpoints_i_pv6: The minimum number of IPv6 (DNS record type AAAA) endpoints - that must be available in the child profile in order for the parent profile to be considered - available. Only applicable to endpoint of type 'NestedEndpoints'. - :type min_child_endpoints_i_pv6: long - :param geo_mapping: The list of countries/regions mapped to this endpoint when using the - 'Geographic' traffic routing method. Please consult Traffic Manager Geographic documentation - for a full list of accepted values. - :type geo_mapping: list[str] - :param subnets: The list of subnets, IP addresses, and/or address ranges mapped to this - endpoint when using the 'Subnet' traffic routing method. An empty list will match all ranges - not covered by other endpoints. - :type subnets: list[~azure.mgmt.trafficmanager.models.EndpointPropertiesSubnetsItem] - :param custom_headers: List of custom headers. - :type custom_headers: - list[~azure.mgmt.trafficmanager.models.EndpointPropertiesCustomHeadersItem] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'target_resource_id': {'key': 'properties.targetResourceId', 'type': 'str'}, - 'target': {'key': 'properties.target', 'type': 'str'}, - 'endpoint_status': {'key': 'properties.endpointStatus', 'type': 'str'}, - 'weight': {'key': 'properties.weight', 'type': 'long'}, - 'priority': {'key': 'properties.priority', 'type': 'long'}, - 'endpoint_location': {'key': 'properties.endpointLocation', 'type': 'str'}, - 'endpoint_monitor_status': {'key': 'properties.endpointMonitorStatus', 'type': 'str'}, - 'min_child_endpoints': {'key': 'properties.minChildEndpoints', 'type': 'long'}, - 'min_child_endpoints_i_pv4': {'key': 'properties.minChildEndpointsIPv4', 'type': 'long'}, - 'min_child_endpoints_i_pv6': {'key': 'properties.minChildEndpointsIPv6', 'type': 'long'}, - 'geo_mapping': {'key': 'properties.geoMapping', 'type': '[str]'}, - 'subnets': {'key': 'properties.subnets', 'type': '[EndpointPropertiesSubnetsItem]'}, - 'custom_headers': {'key': 'properties.customHeaders', 'type': '[EndpointPropertiesCustomHeadersItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoint, self).__init__(**kwargs) - self.target_resource_id = kwargs.get('target_resource_id', None) - self.target = kwargs.get('target', None) - self.endpoint_status = kwargs.get('endpoint_status', None) - self.weight = kwargs.get('weight', None) - self.priority = kwargs.get('priority', None) - self.endpoint_location = kwargs.get('endpoint_location', None) - self.endpoint_monitor_status = kwargs.get('endpoint_monitor_status', None) - self.min_child_endpoints = kwargs.get('min_child_endpoints', None) - self.min_child_endpoints_i_pv4 = kwargs.get('min_child_endpoints_i_pv4', None) - self.min_child_endpoints_i_pv6 = kwargs.get('min_child_endpoints_i_pv6', None) - self.geo_mapping = kwargs.get('geo_mapping', None) - self.subnets = kwargs.get('subnets', None) - self.custom_headers = kwargs.get('custom_headers', None) - - -class EndpointPropertiesCustomHeadersItem(msrest.serialization.Model): - """Custom header name and value. - - :param name: Header name. - :type name: str - :param value: Header value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointPropertiesCustomHeadersItem, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class EndpointPropertiesSubnetsItem(msrest.serialization.Model): - """Subnet first address, scope, and/or last address. - - :param first: First address in the subnet. - :type first: str - :param last: Last address in the subnet. - :type last: str - :param scope: Block size (number of leading bits in the subnet mask). - :type scope: int - """ - - _attribute_map = { - 'first': {'key': 'first', 'type': 'str'}, - 'last': {'key': 'last', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointPropertiesSubnetsItem, self).__init__(**kwargs) - self.first = kwargs.get('first', None) - self.last = kwargs.get('last', None) - self.scope = kwargs.get('scope', None) - - -class HeatMapEndpoint(msrest.serialization.Model): - """Class which is a sparse representation of a Traffic Manager endpoint. - - :param resource_id: The ARM Resource ID of this Traffic Manager endpoint. - :type resource_id: str - :param endpoint_id: A number uniquely identifying this endpoint in query experiences. - :type endpoint_id: int - """ - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'endpoint_id': {'key': 'endpointId', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(HeatMapEndpoint, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.endpoint_id = kwargs.get('endpoint_id', None) - - -class HeatMapModel(ProxyResource): - """Class representing a Traffic Manager HeatMap. - - :param id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param start_time: The beginning of the time window for this HeatMap, inclusive. - :type start_time: ~datetime.datetime - :param end_time: The ending of the time window for this HeatMap, exclusive. - :type end_time: ~datetime.datetime - :param endpoints: The endpoints used in this HeatMap calculation. - :type endpoints: list[~azure.mgmt.trafficmanager.models.HeatMapEndpoint] - :param traffic_flows: The traffic flows produced in this HeatMap calculation. - :type traffic_flows: list[~azure.mgmt.trafficmanager.models.TrafficFlow] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, - 'endpoints': {'key': 'properties.endpoints', 'type': '[HeatMapEndpoint]'}, - 'traffic_flows': {'key': 'properties.trafficFlows', 'type': '[TrafficFlow]'}, - } - - def __init__( - self, - **kwargs - ): - super(HeatMapModel, self).__init__(**kwargs) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.endpoints = kwargs.get('endpoints', None) - self.traffic_flows = kwargs.get('traffic_flows', None) - - -class MonitorConfig(msrest.serialization.Model): - """Class containing endpoint monitoring settings in a Traffic Manager profile. - - :param profile_monitor_status: The profile-level monitoring status of the Traffic Manager - profile. Possible values include: "CheckingEndpoints", "Online", "Degraded", "Disabled", - "Inactive". - :type profile_monitor_status: str or ~azure.mgmt.trafficmanager.models.ProfileMonitorStatus - :param protocol: The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. Possible - values include: "HTTP", "HTTPS", "TCP". - :type protocol: str or ~azure.mgmt.trafficmanager.models.MonitorProtocol - :param port: The TCP port used to probe for endpoint health. - :type port: long - :param path: The path relative to the endpoint domain name used to probe for endpoint health. - :type path: str - :param interval_in_seconds: The monitor interval for endpoints in this profile. This is the - interval at which Traffic Manager will check the health of each endpoint in this profile. - :type interval_in_seconds: long - :param timeout_in_seconds: The monitor timeout for endpoints in this profile. This is the time - that Traffic Manager allows endpoints in this profile to response to the health check. - :type timeout_in_seconds: long - :param tolerated_number_of_failures: The number of consecutive failed health check that Traffic - Manager tolerates before declaring an endpoint in this profile Degraded after the next failed - health check. - :type tolerated_number_of_failures: long - :param custom_headers: List of custom headers. - :type custom_headers: list[~azure.mgmt.trafficmanager.models.MonitorConfigCustomHeadersItem] - :param expected_status_code_ranges: List of expected status code ranges. - :type expected_status_code_ranges: - list[~azure.mgmt.trafficmanager.models.MonitorConfigExpectedStatusCodeRangesItem] - """ - - _attribute_map = { - 'profile_monitor_status': {'key': 'profileMonitorStatus', 'type': 'str'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'long'}, - 'path': {'key': 'path', 'type': 'str'}, - 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'long'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'tolerated_number_of_failures': {'key': 'toleratedNumberOfFailures', 'type': 'long'}, - 'custom_headers': {'key': 'customHeaders', 'type': '[MonitorConfigCustomHeadersItem]'}, - 'expected_status_code_ranges': {'key': 'expectedStatusCodeRanges', 'type': '[MonitorConfigExpectedStatusCodeRangesItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitorConfig, self).__init__(**kwargs) - self.profile_monitor_status = kwargs.get('profile_monitor_status', None) - self.protocol = kwargs.get('protocol', None) - self.port = kwargs.get('port', None) - self.path = kwargs.get('path', None) - self.interval_in_seconds = kwargs.get('interval_in_seconds', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) - self.tolerated_number_of_failures = kwargs.get('tolerated_number_of_failures', None) - self.custom_headers = kwargs.get('custom_headers', None) - self.expected_status_code_ranges = kwargs.get('expected_status_code_ranges', None) - - -class MonitorConfigCustomHeadersItem(msrest.serialization.Model): - """Custom header name and value. - - :param name: Header name. - :type name: str - :param value: Header value. - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitorConfigCustomHeadersItem, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class MonitorConfigExpectedStatusCodeRangesItem(msrest.serialization.Model): - """Min and max value of a status code range. - - :param min: Min status code. - :type min: int - :param max: Max status code. - :type max: int - """ - - _attribute_map = { - 'min': {'key': 'min', 'type': 'int'}, - 'max': {'key': 'max', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitorConfigExpectedStatusCodeRangesItem, self).__init__(**kwargs) - self.min = kwargs.get('min', None) - self.max = kwargs.get('max', None) - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - :param id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region where the resource lives. - :type location: str - """ - - _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.get('location', None) - - -class Profile(TrackedResource): - """Class representing a Traffic Manager profile. - - :param id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region where the resource lives. - :type location: str - :param profile_status: The status of the Traffic Manager profile. Possible values include: - "Enabled", "Disabled". - :type profile_status: str or ~azure.mgmt.trafficmanager.models.ProfileStatus - :param traffic_routing_method: The traffic routing method of the Traffic Manager profile. - Possible values include: "Performance", "Priority", "Weighted", "Geographic", "MultiValue", - "Subnet". - :type traffic_routing_method: str or ~azure.mgmt.trafficmanager.models.TrafficRoutingMethod - :param dns_config: The DNS settings of the Traffic Manager profile. - :type dns_config: ~azure.mgmt.trafficmanager.models.DnsConfig - :param monitor_config: The endpoint monitoring settings of the Traffic Manager profile. - :type monitor_config: ~azure.mgmt.trafficmanager.models.MonitorConfig - :param endpoints: The list of endpoints in the Traffic Manager profile. - :type endpoints: list[~azure.mgmt.trafficmanager.models.Endpoint] - :param traffic_view_enrollment_status: Indicates whether Traffic View is 'Enabled' or - 'Disabled' for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature - will increase the cost of the Traffic Manage profile. Possible values include: "Enabled", - "Disabled". - :type traffic_view_enrollment_status: str or - ~azure.mgmt.trafficmanager.models.TrafficViewEnrollmentStatus - :param allowed_endpoint_record_types: The list of allowed endpoint record types. - :type allowed_endpoint_record_types: list[str or - ~azure.mgmt.trafficmanager.models.AllowedEndpointRecordType] - :param max_return: Maximum number of endpoints to be returned for MultiValue routing type. - :type max_return: long - """ - - _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'}, - 'profile_status': {'key': 'properties.profileStatus', 'type': 'str'}, - 'traffic_routing_method': {'key': 'properties.trafficRoutingMethod', 'type': 'str'}, - 'dns_config': {'key': 'properties.dnsConfig', 'type': 'DnsConfig'}, - 'monitor_config': {'key': 'properties.monitorConfig', 'type': 'MonitorConfig'}, - 'endpoints': {'key': 'properties.endpoints', 'type': '[Endpoint]'}, - 'traffic_view_enrollment_status': {'key': 'properties.trafficViewEnrollmentStatus', 'type': 'str'}, - 'allowed_endpoint_record_types': {'key': 'properties.allowedEndpointRecordTypes', 'type': '[str]'}, - 'max_return': {'key': 'properties.maxReturn', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(Profile, self).__init__(**kwargs) - self.profile_status = kwargs.get('profile_status', None) - self.traffic_routing_method = kwargs.get('traffic_routing_method', None) - self.dns_config = kwargs.get('dns_config', None) - self.monitor_config = kwargs.get('monitor_config', None) - self.endpoints = kwargs.get('endpoints', None) - self.traffic_view_enrollment_status = kwargs.get('traffic_view_enrollment_status', None) - self.allowed_endpoint_record_types = kwargs.get('allowed_endpoint_record_types', None) - self.max_return = kwargs.get('max_return', None) - - -class ProfileListResult(msrest.serialization.Model): - """The list Traffic Manager profiles operation response. - - :param value: Gets the list of Traffic manager profiles. - :type value: list[~azure.mgmt.trafficmanager.models.Profile] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Profile]'}, - } - - def __init__( - self, - **kwargs - ): - super(ProfileListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class QueryExperience(msrest.serialization.Model): - """Class representing a Traffic Manager HeatMap query experience properties. - - All required parameters must be populated in order to send to Azure. - - :param endpoint_id: Required. The id of the endpoint from the 'endpoints' array which these - queries were routed to. - :type endpoint_id: int - :param query_count: Required. The number of queries originating from this location. - :type query_count: int - :param latency: The latency experienced by queries originating from this location. - :type latency: float - """ - - _validation = { - 'endpoint_id': {'required': True}, - 'query_count': {'required': True}, - } - - _attribute_map = { - 'endpoint_id': {'key': 'endpointId', 'type': 'int'}, - 'query_count': {'key': 'queryCount', 'type': 'int'}, - 'latency': {'key': 'latency', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(QueryExperience, self).__init__(**kwargs) - self.endpoint_id = kwargs['endpoint_id'] - self.query_count = kwargs['query_count'] - self.latency = kwargs.get('latency', None) - - -class Region(msrest.serialization.Model): - """Class representing a region in the Geographic hierarchy used with the Geographic traffic routing method. - - :param code: The code of the region. - :type code: str - :param name: The name of the region. - :type name: str - :param regions: The list of Regions grouped under this Region in the Geographic Hierarchy. - :type regions: list[~azure.mgmt.trafficmanager.models.Region] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'regions': {'key': 'regions', 'type': '[Region]'}, - } - - def __init__( - self, - **kwargs - ): - super(Region, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.name = kwargs.get('name', None) - self.regions = kwargs.get('regions', None) - - -class TrafficFlow(msrest.serialization.Model): - """Class representing a Traffic Manager HeatMap traffic flow properties. - - :param source_ip: The IP address that this query experience originated from. - :type source_ip: str - :param latitude: The approximate latitude that these queries originated from. - :type latitude: float - :param longitude: The approximate longitude that these queries originated from. - :type longitude: float - :param query_experiences: The query experiences produced in this HeatMap calculation. - :type query_experiences: list[~azure.mgmt.trafficmanager.models.QueryExperience] - """ - - _attribute_map = { - 'source_ip': {'key': 'sourceIp', 'type': 'str'}, - 'latitude': {'key': 'latitude', 'type': 'float'}, - 'longitude': {'key': 'longitude', 'type': 'float'}, - 'query_experiences': {'key': 'queryExperiences', 'type': '[QueryExperience]'}, - } - - def __init__( - self, - **kwargs - ): - super(TrafficFlow, self).__init__(**kwargs) - self.source_ip = kwargs.get('source_ip', None) - self.latitude = kwargs.get('latitude', None) - self.longitude = kwargs.get('longitude', None) - self.query_experiences = kwargs.get('query_experiences', None) - - -class TrafficManagerGeographicHierarchy(ProxyResource): - """Class representing the Geographic hierarchy used with the Geographic traffic routing method. - - :param id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param geographic_hierarchy: The region at the root of the hierarchy from all the regions in - the hierarchy can be retrieved. - :type geographic_hierarchy: ~azure.mgmt.trafficmanager.models.Region - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'geographic_hierarchy': {'key': 'properties.geographicHierarchy', 'type': 'Region'}, - } - - def __init__( - self, - **kwargs - ): - super(TrafficManagerGeographicHierarchy, self).__init__(**kwargs) - self.geographic_hierarchy = kwargs.get('geographic_hierarchy', None) - - -class TrafficManagerNameAvailability(msrest.serialization.Model): - """Class representing a Traffic Manager Name Availability response. - - :param name: The relative name. - :type name: str - :param type: Traffic Manager profile resource type. - :type type: str - :param name_available: Describes whether the relative name is available or not. - :type name_available: bool - :param reason: The reason why the name is not available, when applicable. - :type reason: str - :param message: Descriptive message that explains why the name is not available, when - applicable. - :type message: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrafficManagerNameAvailability, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class UserMetricsModel(ProxyResource): - """Class representing Traffic Manager User Metrics. - - :param id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param key: The key returned by the User Metrics operation. - :type key: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'key': {'key': 'properties.key', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserMetricsModel, self).__init__(**kwargs) - self.key = kwargs.get('key', None) diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models_py3.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models_py3.py index 1b276d9e5533..4238f37a1335 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models_py3.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models_py3.py @@ -17,10 +17,10 @@ class CheckTrafficManagerRelativeDnsNameAvailabilityParameters(msrest.serialization.Model): """Parameters supplied to check Traffic Manager name operation. - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. - :type type: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str """ _attribute_map = { @@ -35,6 +35,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the resource. + :paramtype name: str + :keyword type: The type of the resource. + :paramtype type: str + """ super(CheckTrafficManagerRelativeDnsNameAvailabilityParameters, self).__init__(**kwargs) self.name = name self.type = type @@ -43,14 +49,14 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """The content of an error returned by the Azure Resource Manager. - :param code: Error code. - :type code: str - :param message: Error message. - :type message: str - :param target: Error target. - :type target: str - :param details: Error details. - :type details: list[~azure.mgmt.trafficmanager.models.CloudErrorBody] + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar target: Error target. + :vartype target: str + :ivar details: Error details. + :vartype details: list[~azure.mgmt.trafficmanager.models.CloudErrorBody] """ _attribute_map = { @@ -69,6 +75,16 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message. + :paramtype message: str + :keyword target: Error target. + :paramtype target: str + :keyword details: Error details. + :paramtype details: list[~azure.mgmt.trafficmanager.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -97,6 +113,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeleteOperationResult, self).__init__(**kwargs) self.operation_result = None @@ -106,17 +124,17 @@ class DnsConfig(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param relative_name: The relative DNS name provided by this Traffic Manager profile. This - value is combined with the DNS domain name used by Azure Traffic Manager to form the - fully-qualified domain name (FQDN) of the profile. - :type relative_name: str + :ivar relative_name: The relative DNS name provided by this Traffic Manager profile. This value + is combined with the DNS domain name used by Azure Traffic Manager to form the fully-qualified + domain name (FQDN) of the profile. + :vartype relative_name: str :ivar fqdn: The fully-qualified domain name (FQDN) of the Traffic Manager profile. This is formed from the concatenation of the RelativeName with the DNS domain used by Azure Traffic Manager. :vartype fqdn: str - :param ttl: The DNS Time-To-Live (TTL), in seconds. This informs the local DNS resolvers and - DNS clients how long to cache DNS responses provided by this Traffic Manager profile. - :type ttl: long + :ivar ttl: The DNS Time-To-Live (TTL), in seconds. This informs the local DNS resolvers and DNS + clients how long to cache DNS responses provided by this Traffic Manager profile. + :vartype ttl: long """ _validation = { @@ -136,6 +154,15 @@ def __init__( ttl: Optional[int] = None, **kwargs ): + """ + :keyword relative_name: The relative DNS name provided by this Traffic Manager profile. This + value is combined with the DNS domain name used by Azure Traffic Manager to form the + fully-qualified domain name (FQDN) of the profile. + :paramtype relative_name: str + :keyword ttl: The DNS Time-To-Live (TTL), in seconds. This informs the local DNS resolvers and + DNS clients how long to cache DNS responses provided by this Traffic Manager profile. + :paramtype ttl: long + """ super(DnsConfig, self).__init__(**kwargs) self.relative_name = relative_name self.fqdn = None @@ -145,13 +172,13 @@ def __init__( class Resource(msrest.serialization.Model): """The core properties of ARM resources. - :param id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :vartype type: str """ _attribute_map = { @@ -168,6 +195,15 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :paramtype type: str + """ super(Resource, self).__init__(**kwargs) self.id = id self.name = name @@ -177,13 +213,13 @@ def __init__( class ProxyResource(Resource): """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - :param id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :vartype type: str """ _attribute_map = { @@ -200,65 +236,75 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :paramtype type: str + """ super(ProxyResource, self).__init__(id=id, name=name, type=type, **kwargs) class Endpoint(ProxyResource): """Class representing a Traffic Manager endpoint. - :param id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param target_resource_id: The Azure Resource URI of the of the endpoint. Not applicable to + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :vartype type: str + :ivar target_resource_id: The Azure Resource URI of the of the endpoint. Not applicable to endpoints of type 'ExternalEndpoints'. - :type target_resource_id: str - :param target: The fully-qualified DNS name or IP address of the endpoint. Traffic Manager + :vartype target_resource_id: str + :ivar target: The fully-qualified DNS name or IP address of the endpoint. Traffic Manager returns this value in DNS responses to direct traffic to this endpoint. - :type target: str - :param endpoint_status: The status of the endpoint. If the endpoint is Enabled, it is probed - for endpoint health and is included in the traffic routing method. Possible values include: + :vartype target: str + :ivar endpoint_status: The status of the endpoint. If the endpoint is Enabled, it is probed for + endpoint health and is included in the traffic routing method. Possible values include: "Enabled", "Disabled". - :type endpoint_status: str or ~azure.mgmt.trafficmanager.models.EndpointStatus - :param weight: The weight of this endpoint when using the 'Weighted' traffic routing method. + :vartype endpoint_status: str or ~azure.mgmt.trafficmanager.models.EndpointStatus + :ivar weight: The weight of this endpoint when using the 'Weighted' traffic routing method. Possible values are from 1 to 1000. - :type weight: long - :param priority: The priority of this endpoint when using the 'Priority' traffic routing - method. Possible values are from 1 to 1000, lower values represent higher priority. This is an - optional parameter. If specified, it must be specified on all endpoints, and no two endpoints - can share the same priority value. - :type priority: long - :param endpoint_location: Specifies the location of the external or nested endpoints when using + :vartype weight: long + :ivar priority: The priority of this endpoint when using the 'Priority' traffic routing method. + Possible values are from 1 to 1000, lower values represent higher priority. This is an optional + parameter. If specified, it must be specified on all endpoints, and no two endpoints can share + the same priority value. + :vartype priority: long + :ivar endpoint_location: Specifies the location of the external or nested endpoints when using the 'Performance' traffic routing method. - :type endpoint_location: str - :param endpoint_monitor_status: The monitoring status of the endpoint. Possible values include: + :vartype endpoint_location: str + :ivar endpoint_monitor_status: The monitoring status of the endpoint. Possible values include: "CheckingEndpoint", "Online", "Degraded", "Disabled", "Inactive", "Stopped". - :type endpoint_monitor_status: str or ~azure.mgmt.trafficmanager.models.EndpointMonitorStatus - :param min_child_endpoints: The minimum number of endpoints that must be available in the child + :vartype endpoint_monitor_status: str or + ~azure.mgmt.trafficmanager.models.EndpointMonitorStatus + :ivar min_child_endpoints: The minimum number of endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'. - :type min_child_endpoints: long - :param min_child_endpoints_i_pv4: The minimum number of IPv4 (DNS record type A) endpoints that + :vartype min_child_endpoints: long + :ivar min_child_endpoints_i_pv4: The minimum number of IPv4 (DNS record type A) endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'. - :type min_child_endpoints_i_pv4: long - :param min_child_endpoints_i_pv6: The minimum number of IPv6 (DNS record type AAAA) endpoints + :vartype min_child_endpoints_i_pv4: long + :ivar min_child_endpoints_i_pv6: The minimum number of IPv6 (DNS record type AAAA) endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'. - :type min_child_endpoints_i_pv6: long - :param geo_mapping: The list of countries/regions mapped to this endpoint when using the + :vartype min_child_endpoints_i_pv6: long + :ivar geo_mapping: The list of countries/regions mapped to this endpoint when using the 'Geographic' traffic routing method. Please consult Traffic Manager Geographic documentation for a full list of accepted values. - :type geo_mapping: list[str] - :param subnets: The list of subnets, IP addresses, and/or address ranges mapped to this - endpoint when using the 'Subnet' traffic routing method. An empty list will match all ranges - not covered by other endpoints. - :type subnets: list[~azure.mgmt.trafficmanager.models.EndpointPropertiesSubnetsItem] - :param custom_headers: List of custom headers. - :type custom_headers: + :vartype geo_mapping: list[str] + :ivar subnets: The list of subnets, IP addresses, and/or address ranges mapped to this endpoint + when using the 'Subnet' traffic routing method. An empty list will match all ranges not covered + by other endpoints. + :vartype subnets: list[~azure.mgmt.trafficmanager.models.EndpointPropertiesSubnetsItem] + :ivar custom_headers: List of custom headers. + :vartype custom_headers: list[~azure.mgmt.trafficmanager.models.EndpointPropertiesCustomHeadersItem] """ @@ -302,6 +348,63 @@ def __init__( custom_headers: Optional[List["EndpointPropertiesCustomHeadersItem"]] = None, **kwargs ): + """ + :keyword id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :paramtype type: str + :keyword target_resource_id: The Azure Resource URI of the of the endpoint. Not applicable to + endpoints of type 'ExternalEndpoints'. + :paramtype target_resource_id: str + :keyword target: The fully-qualified DNS name or IP address of the endpoint. Traffic Manager + returns this value in DNS responses to direct traffic to this endpoint. + :paramtype target: str + :keyword endpoint_status: The status of the endpoint. If the endpoint is Enabled, it is probed + for endpoint health and is included in the traffic routing method. Possible values include: + "Enabled", "Disabled". + :paramtype endpoint_status: str or ~azure.mgmt.trafficmanager.models.EndpointStatus + :keyword weight: The weight of this endpoint when using the 'Weighted' traffic routing method. + Possible values are from 1 to 1000. + :paramtype weight: long + :keyword priority: The priority of this endpoint when using the 'Priority' traffic routing + method. Possible values are from 1 to 1000, lower values represent higher priority. This is an + optional parameter. If specified, it must be specified on all endpoints, and no two endpoints + can share the same priority value. + :paramtype priority: long + :keyword endpoint_location: Specifies the location of the external or nested endpoints when + using the 'Performance' traffic routing method. + :paramtype endpoint_location: str + :keyword endpoint_monitor_status: The monitoring status of the endpoint. Possible values + include: "CheckingEndpoint", "Online", "Degraded", "Disabled", "Inactive", "Stopped". + :paramtype endpoint_monitor_status: str or + ~azure.mgmt.trafficmanager.models.EndpointMonitorStatus + :keyword min_child_endpoints: The minimum number of endpoints that must be available in the + child profile in order for the parent profile to be considered available. Only applicable to + endpoint of type 'NestedEndpoints'. + :paramtype min_child_endpoints: long + :keyword min_child_endpoints_i_pv4: The minimum number of IPv4 (DNS record type A) endpoints + that must be available in the child profile in order for the parent profile to be considered + available. Only applicable to endpoint of type 'NestedEndpoints'. + :paramtype min_child_endpoints_i_pv4: long + :keyword min_child_endpoints_i_pv6: The minimum number of IPv6 (DNS record type AAAA) endpoints + that must be available in the child profile in order for the parent profile to be considered + available. Only applicable to endpoint of type 'NestedEndpoints'. + :paramtype min_child_endpoints_i_pv6: long + :keyword geo_mapping: The list of countries/regions mapped to this endpoint when using the + 'Geographic' traffic routing method. Please consult Traffic Manager Geographic documentation + for a full list of accepted values. + :paramtype geo_mapping: list[str] + :keyword subnets: The list of subnets, IP addresses, and/or address ranges mapped to this + endpoint when using the 'Subnet' traffic routing method. An empty list will match all ranges + not covered by other endpoints. + :paramtype subnets: list[~azure.mgmt.trafficmanager.models.EndpointPropertiesSubnetsItem] + :keyword custom_headers: List of custom headers. + :paramtype custom_headers: + list[~azure.mgmt.trafficmanager.models.EndpointPropertiesCustomHeadersItem] + """ super(Endpoint, self).__init__(id=id, name=name, type=type, **kwargs) self.target_resource_id = target_resource_id self.target = target @@ -321,10 +424,10 @@ def __init__( class EndpointPropertiesCustomHeadersItem(msrest.serialization.Model): """Custom header name and value. - :param name: Header name. - :type name: str - :param value: Header value. - :type value: str + :ivar name: Header name. + :vartype name: str + :ivar value: Header value. + :vartype value: str """ _attribute_map = { @@ -339,6 +442,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Header name. + :paramtype name: str + :keyword value: Header value. + :paramtype value: str + """ super(EndpointPropertiesCustomHeadersItem, self).__init__(**kwargs) self.name = name self.value = value @@ -347,12 +456,12 @@ def __init__( class EndpointPropertiesSubnetsItem(msrest.serialization.Model): """Subnet first address, scope, and/or last address. - :param first: First address in the subnet. - :type first: str - :param last: Last address in the subnet. - :type last: str - :param scope: Block size (number of leading bits in the subnet mask). - :type scope: int + :ivar first: First address in the subnet. + :vartype first: str + :ivar last: Last address in the subnet. + :vartype last: str + :ivar scope: Block size (number of leading bits in the subnet mask). + :vartype scope: int """ _attribute_map = { @@ -369,6 +478,14 @@ def __init__( scope: Optional[int] = None, **kwargs ): + """ + :keyword first: First address in the subnet. + :paramtype first: str + :keyword last: Last address in the subnet. + :paramtype last: str + :keyword scope: Block size (number of leading bits in the subnet mask). + :paramtype scope: int + """ super(EndpointPropertiesSubnetsItem, self).__init__(**kwargs) self.first = first self.last = last @@ -378,10 +495,10 @@ def __init__( class HeatMapEndpoint(msrest.serialization.Model): """Class which is a sparse representation of a Traffic Manager endpoint. - :param resource_id: The ARM Resource ID of this Traffic Manager endpoint. - :type resource_id: str - :param endpoint_id: A number uniquely identifying this endpoint in query experiences. - :type endpoint_id: int + :ivar resource_id: The ARM Resource ID of this Traffic Manager endpoint. + :vartype resource_id: str + :ivar endpoint_id: A number uniquely identifying this endpoint in query experiences. + :vartype endpoint_id: int """ _attribute_map = { @@ -396,6 +513,12 @@ def __init__( endpoint_id: Optional[int] = None, **kwargs ): + """ + :keyword resource_id: The ARM Resource ID of this Traffic Manager endpoint. + :paramtype resource_id: str + :keyword endpoint_id: A number uniquely identifying this endpoint in query experiences. + :paramtype endpoint_id: int + """ super(HeatMapEndpoint, self).__init__(**kwargs) self.resource_id = resource_id self.endpoint_id = endpoint_id @@ -404,21 +527,21 @@ def __init__( class HeatMapModel(ProxyResource): """Class representing a Traffic Manager HeatMap. - :param id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param start_time: The beginning of the time window for this HeatMap, inclusive. - :type start_time: ~datetime.datetime - :param end_time: The ending of the time window for this HeatMap, exclusive. - :type end_time: ~datetime.datetime - :param endpoints: The endpoints used in this HeatMap calculation. - :type endpoints: list[~azure.mgmt.trafficmanager.models.HeatMapEndpoint] - :param traffic_flows: The traffic flows produced in this HeatMap calculation. - :type traffic_flows: list[~azure.mgmt.trafficmanager.models.TrafficFlow] + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :vartype type: str + :ivar start_time: The beginning of the time window for this HeatMap, inclusive. + :vartype start_time: ~datetime.datetime + :ivar end_time: The ending of the time window for this HeatMap, exclusive. + :vartype end_time: ~datetime.datetime + :ivar endpoints: The endpoints used in this HeatMap calculation. + :vartype endpoints: list[~azure.mgmt.trafficmanager.models.HeatMapEndpoint] + :ivar traffic_flows: The traffic flows produced in this HeatMap calculation. + :vartype traffic_flows: list[~azure.mgmt.trafficmanager.models.TrafficFlow] """ _attribute_map = { @@ -443,6 +566,23 @@ def __init__( traffic_flows: Optional[List["TrafficFlow"]] = None, **kwargs ): + """ + :keyword id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :paramtype type: str + :keyword start_time: The beginning of the time window for this HeatMap, inclusive. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The ending of the time window for this HeatMap, exclusive. + :paramtype end_time: ~datetime.datetime + :keyword endpoints: The endpoints used in this HeatMap calculation. + :paramtype endpoints: list[~azure.mgmt.trafficmanager.models.HeatMapEndpoint] + :keyword traffic_flows: The traffic flows produced in this HeatMap calculation. + :paramtype traffic_flows: list[~azure.mgmt.trafficmanager.models.TrafficFlow] + """ super(HeatMapModel, self).__init__(id=id, name=name, type=type, **kwargs) self.start_time = start_time self.end_time = end_time @@ -453,31 +593,31 @@ def __init__( class MonitorConfig(msrest.serialization.Model): """Class containing endpoint monitoring settings in a Traffic Manager profile. - :param profile_monitor_status: The profile-level monitoring status of the Traffic Manager + :ivar profile_monitor_status: The profile-level monitoring status of the Traffic Manager profile. Possible values include: "CheckingEndpoints", "Online", "Degraded", "Disabled", "Inactive". - :type profile_monitor_status: str or ~azure.mgmt.trafficmanager.models.ProfileMonitorStatus - :param protocol: The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. Possible + :vartype profile_monitor_status: str or ~azure.mgmt.trafficmanager.models.ProfileMonitorStatus + :ivar protocol: The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. Possible values include: "HTTP", "HTTPS", "TCP". - :type protocol: str or ~azure.mgmt.trafficmanager.models.MonitorProtocol - :param port: The TCP port used to probe for endpoint health. - :type port: long - :param path: The path relative to the endpoint domain name used to probe for endpoint health. - :type path: str - :param interval_in_seconds: The monitor interval for endpoints in this profile. This is the + :vartype protocol: str or ~azure.mgmt.trafficmanager.models.MonitorProtocol + :ivar port: The TCP port used to probe for endpoint health. + :vartype port: long + :ivar path: The path relative to the endpoint domain name used to probe for endpoint health. + :vartype path: str + :ivar interval_in_seconds: The monitor interval for endpoints in this profile. This is the interval at which Traffic Manager will check the health of each endpoint in this profile. - :type interval_in_seconds: long - :param timeout_in_seconds: The monitor timeout for endpoints in this profile. This is the time + :vartype interval_in_seconds: long + :ivar timeout_in_seconds: The monitor timeout for endpoints in this profile. This is the time that Traffic Manager allows endpoints in this profile to response to the health check. - :type timeout_in_seconds: long - :param tolerated_number_of_failures: The number of consecutive failed health check that Traffic + :vartype timeout_in_seconds: long + :ivar tolerated_number_of_failures: The number of consecutive failed health check that Traffic Manager tolerates before declaring an endpoint in this profile Degraded after the next failed health check. - :type tolerated_number_of_failures: long - :param custom_headers: List of custom headers. - :type custom_headers: list[~azure.mgmt.trafficmanager.models.MonitorConfigCustomHeadersItem] - :param expected_status_code_ranges: List of expected status code ranges. - :type expected_status_code_ranges: + :vartype tolerated_number_of_failures: long + :ivar custom_headers: List of custom headers. + :vartype custom_headers: list[~azure.mgmt.trafficmanager.models.MonitorConfigCustomHeadersItem] + :ivar expected_status_code_ranges: List of expected status code ranges. + :vartype expected_status_code_ranges: list[~azure.mgmt.trafficmanager.models.MonitorConfigExpectedStatusCodeRangesItem] """ @@ -507,6 +647,36 @@ def __init__( expected_status_code_ranges: Optional[List["MonitorConfigExpectedStatusCodeRangesItem"]] = None, **kwargs ): + """ + :keyword profile_monitor_status: The profile-level monitoring status of the Traffic Manager + profile. Possible values include: "CheckingEndpoints", "Online", "Degraded", "Disabled", + "Inactive". + :paramtype profile_monitor_status: str or + ~azure.mgmt.trafficmanager.models.ProfileMonitorStatus + :keyword protocol: The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. + Possible values include: "HTTP", "HTTPS", "TCP". + :paramtype protocol: str or ~azure.mgmt.trafficmanager.models.MonitorProtocol + :keyword port: The TCP port used to probe for endpoint health. + :paramtype port: long + :keyword path: The path relative to the endpoint domain name used to probe for endpoint health. + :paramtype path: str + :keyword interval_in_seconds: The monitor interval for endpoints in this profile. This is the + interval at which Traffic Manager will check the health of each endpoint in this profile. + :paramtype interval_in_seconds: long + :keyword timeout_in_seconds: The monitor timeout for endpoints in this profile. This is the + time that Traffic Manager allows endpoints in this profile to response to the health check. + :paramtype timeout_in_seconds: long + :keyword tolerated_number_of_failures: The number of consecutive failed health check that + Traffic Manager tolerates before declaring an endpoint in this profile Degraded after the next + failed health check. + :paramtype tolerated_number_of_failures: long + :keyword custom_headers: List of custom headers. + :paramtype custom_headers: + list[~azure.mgmt.trafficmanager.models.MonitorConfigCustomHeadersItem] + :keyword expected_status_code_ranges: List of expected status code ranges. + :paramtype expected_status_code_ranges: + list[~azure.mgmt.trafficmanager.models.MonitorConfigExpectedStatusCodeRangesItem] + """ super(MonitorConfig, self).__init__(**kwargs) self.profile_monitor_status = profile_monitor_status self.protocol = protocol @@ -522,10 +692,10 @@ def __init__( class MonitorConfigCustomHeadersItem(msrest.serialization.Model): """Custom header name and value. - :param name: Header name. - :type name: str - :param value: Header value. - :type value: str + :ivar name: Header name. + :vartype name: str + :ivar value: Header value. + :vartype value: str """ _attribute_map = { @@ -540,6 +710,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Header name. + :paramtype name: str + :keyword value: Header value. + :paramtype value: str + """ super(MonitorConfigCustomHeadersItem, self).__init__(**kwargs) self.name = name self.value = value @@ -548,10 +724,10 @@ def __init__( class MonitorConfigExpectedStatusCodeRangesItem(msrest.serialization.Model): """Min and max value of a status code range. - :param min: Min status code. - :type min: int - :param max: Max status code. - :type max: int + :ivar min: Min status code. + :vartype min: int + :ivar max: Max status code. + :vartype max: int """ _attribute_map = { @@ -566,6 +742,12 @@ def __init__( max: Optional[int] = None, **kwargs ): + """ + :keyword min: Min status code. + :paramtype min: int + :keyword max: Max status code. + :paramtype max: int + """ super(MonitorConfigExpectedStatusCodeRangesItem, self).__init__(**kwargs) self.min = min self.max = max @@ -574,17 +756,17 @@ def __init__( class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - :param id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region where the resource lives. - :type location: str + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: The Azure Region where the resource lives. + :vartype location: str """ _attribute_map = { @@ -605,6 +787,19 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :paramtype type: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The Azure Region where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(id=id, name=name, type=type, **kwargs) self.tags = tags self.location = location @@ -613,41 +808,41 @@ def __init__( class Profile(TrackedResource): """Class representing a Traffic Manager profile. - :param id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region where the resource lives. - :type location: str - :param profile_status: The status of the Traffic Manager profile. Possible values include: + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: The Azure Region where the resource lives. + :vartype location: str + :ivar profile_status: The status of the Traffic Manager profile. Possible values include: "Enabled", "Disabled". - :type profile_status: str or ~azure.mgmt.trafficmanager.models.ProfileStatus - :param traffic_routing_method: The traffic routing method of the Traffic Manager profile. + :vartype profile_status: str or ~azure.mgmt.trafficmanager.models.ProfileStatus + :ivar traffic_routing_method: The traffic routing method of the Traffic Manager profile. Possible values include: "Performance", "Priority", "Weighted", "Geographic", "MultiValue", "Subnet". - :type traffic_routing_method: str or ~azure.mgmt.trafficmanager.models.TrafficRoutingMethod - :param dns_config: The DNS settings of the Traffic Manager profile. - :type dns_config: ~azure.mgmt.trafficmanager.models.DnsConfig - :param monitor_config: The endpoint monitoring settings of the Traffic Manager profile. - :type monitor_config: ~azure.mgmt.trafficmanager.models.MonitorConfig - :param endpoints: The list of endpoints in the Traffic Manager profile. - :type endpoints: list[~azure.mgmt.trafficmanager.models.Endpoint] - :param traffic_view_enrollment_status: Indicates whether Traffic View is 'Enabled' or - 'Disabled' for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature - will increase the cost of the Traffic Manage profile. Possible values include: "Enabled", + :vartype traffic_routing_method: str or ~azure.mgmt.trafficmanager.models.TrafficRoutingMethod + :ivar dns_config: The DNS settings of the Traffic Manager profile. + :vartype dns_config: ~azure.mgmt.trafficmanager.models.DnsConfig + :ivar monitor_config: The endpoint monitoring settings of the Traffic Manager profile. + :vartype monitor_config: ~azure.mgmt.trafficmanager.models.MonitorConfig + :ivar endpoints: The list of endpoints in the Traffic Manager profile. + :vartype endpoints: list[~azure.mgmt.trafficmanager.models.Endpoint] + :ivar traffic_view_enrollment_status: Indicates whether Traffic View is 'Enabled' or 'Disabled' + for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature will + increase the cost of the Traffic Manage profile. Possible values include: "Enabled", "Disabled". - :type traffic_view_enrollment_status: str or + :vartype traffic_view_enrollment_status: str or ~azure.mgmt.trafficmanager.models.TrafficViewEnrollmentStatus - :param allowed_endpoint_record_types: The list of allowed endpoint record types. - :type allowed_endpoint_record_types: list[str or + :ivar allowed_endpoint_record_types: The list of allowed endpoint record types. + :vartype allowed_endpoint_record_types: list[str or ~azure.mgmt.trafficmanager.models.AllowedEndpointRecordType] - :param max_return: Maximum number of endpoints to be returned for MultiValue routing type. - :type max_return: long + :ivar max_return: Maximum number of endpoints to be returned for MultiValue routing type. + :vartype max_return: long """ _attribute_map = { @@ -684,6 +879,44 @@ def __init__( max_return: Optional[int] = None, **kwargs ): + """ + :keyword id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :paramtype type: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The Azure Region where the resource lives. + :paramtype location: str + :keyword profile_status: The status of the Traffic Manager profile. Possible values include: + "Enabled", "Disabled". + :paramtype profile_status: str or ~azure.mgmt.trafficmanager.models.ProfileStatus + :keyword traffic_routing_method: The traffic routing method of the Traffic Manager profile. + Possible values include: "Performance", "Priority", "Weighted", "Geographic", "MultiValue", + "Subnet". + :paramtype traffic_routing_method: str or + ~azure.mgmt.trafficmanager.models.TrafficRoutingMethod + :keyword dns_config: The DNS settings of the Traffic Manager profile. + :paramtype dns_config: ~azure.mgmt.trafficmanager.models.DnsConfig + :keyword monitor_config: The endpoint monitoring settings of the Traffic Manager profile. + :paramtype monitor_config: ~azure.mgmt.trafficmanager.models.MonitorConfig + :keyword endpoints: The list of endpoints in the Traffic Manager profile. + :paramtype endpoints: list[~azure.mgmt.trafficmanager.models.Endpoint] + :keyword traffic_view_enrollment_status: Indicates whether Traffic View is 'Enabled' or + 'Disabled' for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature + will increase the cost of the Traffic Manage profile. Possible values include: "Enabled", + "Disabled". + :paramtype traffic_view_enrollment_status: str or + ~azure.mgmt.trafficmanager.models.TrafficViewEnrollmentStatus + :keyword allowed_endpoint_record_types: The list of allowed endpoint record types. + :paramtype allowed_endpoint_record_types: list[str or + ~azure.mgmt.trafficmanager.models.AllowedEndpointRecordType] + :keyword max_return: Maximum number of endpoints to be returned for MultiValue routing type. + :paramtype max_return: long + """ super(Profile, self).__init__(id=id, name=name, type=type, tags=tags, location=location, **kwargs) self.profile_status = profile_status self.traffic_routing_method = traffic_routing_method @@ -698,8 +931,8 @@ def __init__( class ProfileListResult(msrest.serialization.Model): """The list Traffic Manager profiles operation response. - :param value: Gets the list of Traffic manager profiles. - :type value: list[~azure.mgmt.trafficmanager.models.Profile] + :ivar value: Gets the list of Traffic manager profiles. + :vartype value: list[~azure.mgmt.trafficmanager.models.Profile] """ _attribute_map = { @@ -712,6 +945,10 @@ def __init__( value: Optional[List["Profile"]] = None, **kwargs ): + """ + :keyword value: Gets the list of Traffic manager profiles. + :paramtype value: list[~azure.mgmt.trafficmanager.models.Profile] + """ super(ProfileListResult, self).__init__(**kwargs) self.value = value @@ -721,13 +958,13 @@ class QueryExperience(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param endpoint_id: Required. The id of the endpoint from the 'endpoints' array which these + :ivar endpoint_id: Required. The id of the endpoint from the 'endpoints' array which these queries were routed to. - :type endpoint_id: int - :param query_count: Required. The number of queries originating from this location. - :type query_count: int - :param latency: The latency experienced by queries originating from this location. - :type latency: float + :vartype endpoint_id: int + :ivar query_count: Required. The number of queries originating from this location. + :vartype query_count: int + :ivar latency: The latency experienced by queries originating from this location. + :vartype latency: float """ _validation = { @@ -749,6 +986,15 @@ def __init__( latency: Optional[float] = None, **kwargs ): + """ + :keyword endpoint_id: Required. The id of the endpoint from the 'endpoints' array which these + queries were routed to. + :paramtype endpoint_id: int + :keyword query_count: Required. The number of queries originating from this location. + :paramtype query_count: int + :keyword latency: The latency experienced by queries originating from this location. + :paramtype latency: float + """ super(QueryExperience, self).__init__(**kwargs) self.endpoint_id = endpoint_id self.query_count = query_count @@ -758,12 +1004,12 @@ def __init__( class Region(msrest.serialization.Model): """Class representing a region in the Geographic hierarchy used with the Geographic traffic routing method. - :param code: The code of the region. - :type code: str - :param name: The name of the region. - :type name: str - :param regions: The list of Regions grouped under this Region in the Geographic Hierarchy. - :type regions: list[~azure.mgmt.trafficmanager.models.Region] + :ivar code: The code of the region. + :vartype code: str + :ivar name: The name of the region. + :vartype name: str + :ivar regions: The list of Regions grouped under this Region in the Geographic Hierarchy. + :vartype regions: list[~azure.mgmt.trafficmanager.models.Region] """ _attribute_map = { @@ -780,6 +1026,14 @@ def __init__( regions: Optional[List["Region"]] = None, **kwargs ): + """ + :keyword code: The code of the region. + :paramtype code: str + :keyword name: The name of the region. + :paramtype name: str + :keyword regions: The list of Regions grouped under this Region in the Geographic Hierarchy. + :paramtype regions: list[~azure.mgmt.trafficmanager.models.Region] + """ super(Region, self).__init__(**kwargs) self.code = code self.name = name @@ -789,14 +1043,14 @@ def __init__( class TrafficFlow(msrest.serialization.Model): """Class representing a Traffic Manager HeatMap traffic flow properties. - :param source_ip: The IP address that this query experience originated from. - :type source_ip: str - :param latitude: The approximate latitude that these queries originated from. - :type latitude: float - :param longitude: The approximate longitude that these queries originated from. - :type longitude: float - :param query_experiences: The query experiences produced in this HeatMap calculation. - :type query_experiences: list[~azure.mgmt.trafficmanager.models.QueryExperience] + :ivar source_ip: The IP address that this query experience originated from. + :vartype source_ip: str + :ivar latitude: The approximate latitude that these queries originated from. + :vartype latitude: float + :ivar longitude: The approximate longitude that these queries originated from. + :vartype longitude: float + :ivar query_experiences: The query experiences produced in this HeatMap calculation. + :vartype query_experiences: list[~azure.mgmt.trafficmanager.models.QueryExperience] """ _attribute_map = { @@ -815,6 +1069,16 @@ def __init__( query_experiences: Optional[List["QueryExperience"]] = None, **kwargs ): + """ + :keyword source_ip: The IP address that this query experience originated from. + :paramtype source_ip: str + :keyword latitude: The approximate latitude that these queries originated from. + :paramtype latitude: float + :keyword longitude: The approximate longitude that these queries originated from. + :paramtype longitude: float + :keyword query_experiences: The query experiences produced in this HeatMap calculation. + :paramtype query_experiences: list[~azure.mgmt.trafficmanager.models.QueryExperience] + """ super(TrafficFlow, self).__init__(**kwargs) self.source_ip = source_ip self.latitude = latitude @@ -825,16 +1089,16 @@ def __init__( class TrafficManagerGeographicHierarchy(ProxyResource): """Class representing the Geographic hierarchy used with the Geographic traffic routing method. - :param id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param geographic_hierarchy: The region at the root of the hierarchy from all the regions in - the hierarchy can be retrieved. - :type geographic_hierarchy: ~azure.mgmt.trafficmanager.models.Region + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :vartype type: str + :ivar geographic_hierarchy: The region at the root of the hierarchy from all the regions in the + hierarchy can be retrieved. + :vartype geographic_hierarchy: ~azure.mgmt.trafficmanager.models.Region """ _attribute_map = { @@ -853,6 +1117,18 @@ def __init__( geographic_hierarchy: Optional["Region"] = None, **kwargs ): + """ + :keyword id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :paramtype type: str + :keyword geographic_hierarchy: The region at the root of the hierarchy from all the regions in + the hierarchy can be retrieved. + :paramtype geographic_hierarchy: ~azure.mgmt.trafficmanager.models.Region + """ super(TrafficManagerGeographicHierarchy, self).__init__(id=id, name=name, type=type, **kwargs) self.geographic_hierarchy = geographic_hierarchy @@ -860,17 +1136,17 @@ def __init__( class TrafficManagerNameAvailability(msrest.serialization.Model): """Class representing a Traffic Manager Name Availability response. - :param name: The relative name. - :type name: str - :param type: Traffic Manager profile resource type. - :type type: str - :param name_available: Describes whether the relative name is available or not. - :type name_available: bool - :param reason: The reason why the name is not available, when applicable. - :type reason: str - :param message: Descriptive message that explains why the name is not available, when + :ivar name: The relative name. + :vartype name: str + :ivar type: Traffic Manager profile resource type. + :vartype type: str + :ivar name_available: Describes whether the relative name is available or not. + :vartype name_available: bool + :ivar reason: The reason why the name is not available, when applicable. + :vartype reason: str + :ivar message: Descriptive message that explains why the name is not available, when applicable. - :type message: str + :vartype message: str """ _attribute_map = { @@ -891,6 +1167,19 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name: The relative name. + :paramtype name: str + :keyword type: Traffic Manager profile resource type. + :paramtype type: str + :keyword name_available: Describes whether the relative name is available or not. + :paramtype name_available: bool + :keyword reason: The reason why the name is not available, when applicable. + :paramtype reason: str + :keyword message: Descriptive message that explains why the name is not available, when + applicable. + :paramtype message: str + """ super(TrafficManagerNameAvailability, self).__init__(**kwargs) self.name = name self.type = type @@ -902,15 +1191,15 @@ def __init__( class UserMetricsModel(ProxyResource): """Class representing Traffic Manager User Metrics. - :param id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. - :type id: str - :param name: The name of the resource. - :type name: str - :param type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. - :type type: str - :param key: The key returned by the User Metrics operation. - :type key: str + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :vartype type: str + :ivar key: The key returned by the User Metrics operation. + :vartype key: str """ _attribute_map = { @@ -929,5 +1218,16 @@ def __init__( key: Optional[str] = None, **kwargs ): + """ + :keyword id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}. + :paramtype id: str + :keyword name: The name of the resource. + :paramtype name: str + :keyword type: The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + :paramtype type: str + :keyword key: The key returned by the User Metrics operation. + :paramtype key: str + """ super(UserMetricsModel, self).__init__(id=id, name=name, type=type, **kwargs) self.key = key diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_traffic_manager_management_client_enums.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_traffic_manager_management_client_enums.py index 735f719a9e1c..fc36d75babe2 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_traffic_manager_management_client_enums.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_traffic_manager_management_client_enums.py @@ -6,27 +6,12 @@ # 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 AllowedEndpointRecordType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AllowedEndpointRecordType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The allowed type DNS record types for this profile. """ @@ -35,7 +20,7 @@ class AllowedEndpointRecordType(with_metaclass(_CaseInsensitiveEnumMeta, str, En I_PV6_ADDRESS = "IPv6Address" ANY = "Any" -class EndpointMonitorStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EndpointMonitorStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The monitoring status of the endpoint. """ @@ -46,7 +31,7 @@ class EndpointMonitorStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) INACTIVE = "Inactive" STOPPED = "Stopped" -class EndpointStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EndpointStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the endpoint. If the endpoint is Enabled, it is probed for endpoint health and is included in the traffic routing method. """ @@ -54,7 +39,13 @@ class EndpointStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class MonitorProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EndpointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + AZURE_ENDPOINTS = "AzureEndpoints" + EXTERNAL_ENDPOINTS = "ExternalEndpoints" + NESTED_ENDPOINTS = "NestedEndpoints" + +class MonitorProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. """ @@ -62,7 +53,7 @@ class MonitorProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTPS = "HTTPS" TCP = "TCP" -class ProfileMonitorStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProfileMonitorStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The profile-level monitoring status of the Traffic Manager profile. """ @@ -72,14 +63,14 @@ class ProfileMonitorStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DISABLED = "Disabled" INACTIVE = "Inactive" -class ProfileStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProfileStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the Traffic Manager profile. """ ENABLED = "Enabled" DISABLED = "Disabled" -class TrafficRoutingMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficRoutingMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The traffic routing method of the Traffic Manager profile. """ @@ -90,7 +81,7 @@ class TrafficRoutingMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MULTI_VALUE = "MultiValue" SUBNET = "Subnet" -class TrafficViewEnrollmentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficViewEnrollmentStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether Traffic View is 'Enabled' or 'Disabled' for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature will increase the cost of the Traffic Manage profile. diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_endpoints_operations.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_endpoints_operations.py index 8e71713be9d4..8e726f2f39dc 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_endpoints_operations.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_endpoints_operations.py @@ -5,22 +5,199 @@ # 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, 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.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, 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_update_request( + resource_group_name: str, + profile_name: str, + endpoint_type: Union[str, "_models.EndpointType"], + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointType": _SERIALIZER.url("endpoint_type", endpoint_type, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + endpoint_type: Union[str, "_models.EndpointType"], + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointType": _SERIALIZER.url("endpoint_type", endpoint_type, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name: str, + profile_name: str, + endpoint_type: Union[str, "_models.EndpointType"], + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointType": _SERIALIZER.url("endpoint_type", endpoint_type, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + profile_name: str, + endpoint_type: Union[str, "_models.EndpointType"], + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointType": _SERIALIZER.url("endpoint_type", endpoint_type, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class EndpointsOperations(object): """EndpointsOperations operations. @@ -44,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def update( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_type, # type: str - endpoint_name, # type: str - parameters, # type: "_models.Endpoint" - **kwargs # type: Any - ): - # type: (...) -> "_models.Endpoint" + resource_group_name: str, + profile_name: str, + endpoint_type: Union[str, "_models.EndpointType"], + endpoint_name: str, + parameters: "_models.Endpoint", + **kwargs: Any + ) -> "_models.Endpoint": """Update a Traffic Manager endpoint. :param resource_group_name: The name of the resource group containing the Traffic Manager @@ -62,7 +239,7 @@ def update( :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manager endpoint to be updated. - :type endpoint_type: str + :type endpoint_type: str or ~azure.mgmt.trafficmanager.models.EndpointType :param endpoint_name: The name of the Traffic Manager endpoint to be updated. :type endpoint_name: str :param parameters: The Traffic Manager endpoint parameters supplied to the Update operation. @@ -77,34 +254,24 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointType': self._serialize.url("endpoint_type", endpoint_type, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Endpoint') + + request = build_update_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_type=endpoint_type, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Endpoint') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -118,17 +285,19 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_type, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Endpoint" + resource_group_name: str, + profile_name: str, + endpoint_type: Union[str, "_models.EndpointType"], + endpoint_name: str, + **kwargs: Any + ) -> "_models.Endpoint": """Gets a Traffic Manager endpoint. :param resource_group_name: The name of the resource group containing the Traffic Manager @@ -137,7 +306,7 @@ def get( :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manager endpoint. - :type endpoint_type: str + :type endpoint_type: str or ~azure.mgmt.trafficmanager.models.EndpointType :param endpoint_name: The name of the Traffic Manager endpoint. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -150,29 +319,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointType': self._serialize.url("endpoint_type", endpoint_type, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_type=endpoint_type, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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 @@ -186,18 +345,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_type, # type: str - endpoint_name, # type: str - parameters, # type: "_models.Endpoint" - **kwargs # type: Any - ): - # type: (...) -> "_models.Endpoint" + resource_group_name: str, + profile_name: str, + endpoint_type: Union[str, "_models.EndpointType"], + endpoint_name: str, + parameters: "_models.Endpoint", + **kwargs: Any + ) -> "_models.Endpoint": """Create or update a Traffic Manager endpoint. :param resource_group_name: The name of the resource group containing the Traffic Manager @@ -206,7 +367,7 @@ def create_or_update( :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manager endpoint to be created or updated. - :type endpoint_type: str + :type endpoint_type: str or ~azure.mgmt.trafficmanager.models.EndpointType :param endpoint_name: The name of the Traffic Manager endpoint to be created or updated. :type endpoint_name: str :param parameters: The Traffic Manager endpoint parameters supplied to the CreateOrUpdate @@ -222,34 +383,24 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointType': self._serialize.url("endpoint_type", endpoint_type, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Endpoint') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_type=endpoint_type, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'Endpoint') - 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 @@ -267,17 +418,19 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_type, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.DeleteOperationResult"] + resource_group_name: str, + profile_name: str, + endpoint_type: Union[str, "_models.EndpointType"], + endpoint_name: str, + **kwargs: Any + ) -> Optional["_models.DeleteOperationResult"]: """Deletes a Traffic Manager endpoint. :param resource_group_name: The name of the resource group containing the Traffic Manager @@ -286,7 +439,7 @@ def delete( :param profile_name: The name of the Traffic Manager profile. :type profile_name: str :param endpoint_type: The type of the Traffic Manager endpoint to be deleted. - :type endpoint_type: str + :type endpoint_type: str or ~azure.mgmt.trafficmanager.models.EndpointType :param endpoint_name: The name of the Traffic Manager endpoint to be deleted. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -299,29 +452,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointType': self._serialize.url("endpoint_type", endpoint_type, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_type=endpoint_type, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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 @@ -337,4 +480,6 @@ def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_geographic_hierarchies_operations.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_geographic_hierarchies_operations.py index 37b7cbbcf5bd..67526c316c4c 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_geographic_hierarchies_operations.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_geographic_hierarchies_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_get_default_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Network/trafficManagerGeographicHierarchies/default') + + # 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 GeographicHierarchiesOperations(object): """GeographicHierarchiesOperations operations. @@ -44,11 +71,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_default( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.TrafficManagerGeographicHierarchy" + **kwargs: Any + ) -> "_models.TrafficManagerGeographicHierarchy": """Gets the default Geographic Hierarchy used by the Geographic traffic routing method. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,21 +88,14 @@ def get_default( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - - # Construct URL - url = self.get_default.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_get_default_request( + template_url=self.get_default.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 @@ -89,4 +109,6 @@ def get_default( return cls(pipeline_response, deserialized, {}) return deserialized + get_default.metadata = {'url': '/providers/Microsoft.Network/trafficManagerGeographicHierarchies/default'} # type: ignore + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_heat_map_operations.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_heat_map_operations.py index a5c25e49468b..85da607d77b0 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_heat_map_operations.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_heat_map_operations.py @@ -5,22 +5,68 @@ # 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + *, + top_left: Optional[List[float]] = None, + bot_right: Optional[List[float]] = None, + **kwargs: Any +) -> HttpRequest: + heat_map_type = "default" + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/heatMaps/{heatMapType}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "heatMapType": _SERIALIZER.url("heat_map_type", heat_map_type, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top_left is not None: + query_parameters['topLeft'] = _SERIALIZER.query("top_left", top_left, '[float]', div=',') + if bot_right is not None: + query_parameters['botRight'] = _SERIALIZER.query("bot_right", bot_right, '[float]', div=',') + 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 HeatMapOperations(object): """HeatMapOperations operations. @@ -44,15 +90,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - top_left=None, # type: Optional[List[float]] - bot_right=None, # type: Optional[List[float]] - **kwargs # type: Any - ): - # type: (...) -> "_models.HeatMapModel" + resource_group_name: str, + profile_name: str, + top_left: Optional[List[float]] = None, + bot_right: Optional[List[float]] = None, + **kwargs: Any + ) -> "_models.HeatMapModel": """Gets latest heatmap for Traffic Manager profile. :param resource_group_name: The name of the resource group containing the Traffic Manager @@ -75,33 +121,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - heat_map_type = "default" - api_version = "2018-08-01" - 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'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'heatMapType': self._serialize.url("heat_map_type", heat_map_type, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top_left is not None: - query_parameters['topLeft'] = self._serialize.query("top_left", top_left, '[float]', div=',') - if bot_right is not None: - query_parameters['botRight'] = self._serialize.query("bot_right", bot_right, '[float]', div=',') - 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, + profile_name=profile_name, + top_left=top_left, + bot_right=bot_right, + 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 @@ -115,4 +147,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/heatMaps/{heatMapType}'} # type: ignore + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_profiles_operations.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_profiles_operations.py index 67a169e4cfc3..fa3345f13872 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_profiles_operations.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_profiles_operations.py @@ -5,23 +5,282 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_traffic_manager_relative_dns_name_availability_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Network/checkTrafficManagerNameAvailability') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ProfilesOperations(object): """ProfilesOperations operations. @@ -45,17 +304,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_traffic_manager_relative_dns_name_availability( self, - parameters, # type: "_models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.TrafficManagerNameAvailability" + parameters: "_models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.TrafficManagerNameAvailability": """Checks the availability of a Traffic Manager Relative DNS name. :param parameters: The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. - :type parameters: ~azure.mgmt.trafficmanager.models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters + :type parameters: + ~azure.mgmt.trafficmanager.models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: TrafficManagerNameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.trafficmanager.models.TrafficManagerNameAvailability @@ -66,26 +326,19 @@ def check_traffic_manager_relative_dns_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_traffic_manager_relative_dns_name_availability.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckTrafficManagerRelativeDnsNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckTrafficManagerRelativeDnsNameAvailabilityParameters') + + request = build_check_traffic_manager_relative_dns_name_availability_request( + content_type=content_type, + json=_json, + template_url=self.check_traffic_manager_relative_dns_name_availability.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 @@ -99,14 +352,16 @@ def check_traffic_manager_relative_dns_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_traffic_manager_relative_dns_name_availability.metadata = {'url': '/providers/Microsoft.Network/checkTrafficManagerNameAvailability'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProfileListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ProfileListResult"]: """Lists all Traffic Manager profiles within a resource group. :param resource_group_name: The name of the resource group containing the Traffic Manager @@ -122,35 +377,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProfileListResult', pipeline_response) + deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -168,16 +419,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles'} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProfileListResult"] + **kwargs: Any + ) -> Iterable["_models.ProfileListResult"]: """Lists all Traffic Manager profiles within a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -190,34 +442,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProfileListResult', pipeline_response) + deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -235,18 +482,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Profile" + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> "_models.Profile": """Gets a Traffic Manager profile. :param resource_group_name: The name of the resource group containing the Traffic Manager @@ -264,27 +512,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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 @@ -298,16 +536,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - profile_name, # type: str - parameters, # type: "_models.Profile" - **kwargs # type: Any - ): - # type: (...) -> "_models.Profile" + resource_group_name: str, + profile_name: str, + parameters: "_models.Profile", + **kwargs: Any + ) -> "_models.Profile": """Create or update a Traffic Manager profile. :param resource_group_name: The name of the resource group containing the Traffic Manager @@ -328,32 +568,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Profile') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'Profile') - 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 @@ -371,15 +601,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.DeleteOperationResult"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Optional["_models.DeleteOperationResult"]: """Deletes a Traffic Manager profile. :param resource_group_name: The name of the resource group containing the Traffic Manager @@ -397,27 +629,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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 @@ -433,16 +655,18 @@ def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - profile_name, # type: str - parameters, # type: "_models.Profile" - **kwargs # type: Any - ): - # type: (...) -> "_models.Profile" + resource_group_name: str, + profile_name: str, + parameters: "_models.Profile", + **kwargs: Any + ) -> "_models.Profile": """Update a Traffic Manager profile. :param resource_group_name: The name of the resource group containing the Traffic Manager @@ -462,32 +686,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Profile') + + request = build_update_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Profile') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -501,4 +715,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_traffic_manager_user_metrics_keys_operations.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_traffic_manager_user_metrics_keys_operations.py index e65055d42cb2..4d176c695b48 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_traffic_manager_user_metrics_keys_operations.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_traffic_manager_user_metrics_keys_operations.py @@ -5,22 +5,117 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class TrafficManagerUserMetricsKeysOperations(object): """TrafficManagerUserMetricsKeysOperations operations. @@ -44,11 +139,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.UserMetricsModel" + **kwargs: Any + ) -> "_models.UserMetricsModel": """Get the subscription-level key used for Real User Metrics collection. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,25 +156,15 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - 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'), - } - 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, + 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 @@ -93,13 +178,15 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default'} # type: ignore + + @distributed_trace def create_or_update( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.UserMetricsModel" + **kwargs: Any + ) -> "_models.UserMetricsModel": """Create or update a subscription-level key used for Real User Metrics collection. :keyword callable cls: A custom type or function that will be passed the direct response @@ -112,25 +199,15 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - 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'), - } - 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_create_or_update_request( + subscription_id=self._config.subscription_id, + template_url=self.create_or_update.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.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -144,13 +221,15 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default'} # type: ignore + + @distributed_trace def delete( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.DeleteOperationResult" + **kwargs: Any + ) -> "_models.DeleteOperationResult": """Delete a subscription-level key used for Real User Metrics collection. :keyword callable cls: A custom type or function that will be passed the direct response @@ -163,25 +242,15 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-08-01" - 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'), - } - 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, + 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 @@ -195,4 +264,6 @@ def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default'} # type: ignore + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/setup.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/setup.py index f7667683129c..d7b8e228744b 100644 --- a/sdk/trafficmanager/azure-mgmt-trafficmanager/setup.py +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/setup.py @@ -68,7 +68,7 @@ install_requires=[ 'msrest>=0.6.21', 'azure-common~=1.1', - 'azure-mgmt-core>=1.2.0,<2.0.0', + 'azure-mgmt-core>=1.3.0,<2.0.0', ], python_requires=">=3.6", ) diff --git a/shared_requirements.txt b/shared_requirements.txt index 12414d348c65..25dd9c5001ab 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -260,5 +260,7 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-botservice azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-web msrest>=0.6.21 #override azure-mgmt-web azure-mgmt-core>=1.3.0,<2.0.0 +#override azure-mgmt-trafficmanager msrest>=0.6.21 +#override azure-mgmt-trafficmanager azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-containerregistry msrest>=0.6.21 #override azure-mgmt-containerregistry azure-mgmt-core>=1.3.0,<2.0.0