From 63094693ef7b637346bcfed40e1c4833d9167e74 Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Fri, 14 May 2021 20:51:20 +0800 Subject: [PATCH] [AutoRelease] t2-trafficmanager-2021-05-13-40514(wave4) (#18700) * CodeGen from PR 14166 in Azure/azure-rest-api-specs trafficmanager wave4 (#14166) * trafficmanager wave4 * Update readme.python.md Co-authored-by: Yan Zhang (WICRESOFT NORTH AMERICA LTD) Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * version,CHANGELOG * changelog config Co-authored-by: SDKAuto Co-authored-by: Yan Zhang (WICRESOFT NORTH AMERICA LTD) Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: PythonSdkPipelines Co-authored-by: Zed <601306339@qq.com> Co-authored-by: Zed Lei <59104634+RAY-316@users.noreply.github.com> --- .../azure-mgmt-trafficmanager/CHANGELOG.md | 114 +++ .../azure-mgmt-trafficmanager/MANIFEST.in | 6 + .../azure-mgmt-trafficmanager/README.md | 27 + .../azure-mgmt-trafficmanager/_meta.json | 8 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/trafficmanager/__init__.py | 19 + .../mgmt/trafficmanager/_configuration.py | 71 ++ .../azure/mgmt/trafficmanager/_metadata.json | 107 ++ .../_traffic_manager_management_client.py | 108 ++ .../azure/mgmt/trafficmanager/_version.py | 9 + .../azure/mgmt/trafficmanager/aio/__init__.py | 10 + .../mgmt/trafficmanager/aio/_configuration.py | 67 ++ .../aio/_traffic_manager_management_client.py | 101 ++ .../trafficmanager/aio/operations/__init__.py | 21 + .../aio/operations/_endpoints_operations.py | 332 +++++++ .../_geographic_hierarchies_operations.py | 87 ++ .../aio/operations/_heat_map_operations.py | 113 +++ .../aio/operations/_profiles_operations.py | 493 +++++++++ ...ic_manager_user_metrics_keys_operations.py | 191 ++++ .../mgmt/trafficmanager/models/__init__.py | 101 ++ .../mgmt/trafficmanager/models/_models.py | 807 +++++++++++++++ .../mgmt/trafficmanager/models/_models_py3.py | 933 ++++++++++++++++++ ...traffic_manager_management_client_enums.py | 100 ++ .../trafficmanager/operations/__init__.py | 21 + .../operations/_endpoints_operations.py | 340 +++++++ .../_geographic_hierarchies_operations.py | 92 ++ .../operations/_heat_map_operations.py | 118 +++ .../operations/_profiles_operations.py | 504 ++++++++++ ...ic_manager_user_metrics_keys_operations.py | 198 ++++ .../azure/mgmt/trafficmanager/py.typed | 1 + .../sdk_packaging.toml | 9 + .../azure-mgmt-trafficmanager/setup.cfg | 2 + .../azure-mgmt-trafficmanager/setup.py | 91 ++ sdk/trafficmanager/ci.yml | 35 + shared_requirements.txt | 1 + 36 files changed, 5239 insertions(+) create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/CHANGELOG.md create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/MANIFEST.in create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/README.md create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/_meta.json create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/__init__.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/__init__.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/__init__.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_configuration.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_metadata.json create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_traffic_manager_management_client.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_version.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/__init__.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_configuration.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_traffic_manager_management_client.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/__init__.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_endpoints_operations.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_geographic_hierarchies_operations.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_heat_map_operations.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_profiles_operations.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_traffic_manager_user_metrics_keys_operations.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/__init__.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models_py3.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_traffic_manager_management_client_enums.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/__init__.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_endpoints_operations.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_geographic_hierarchies_operations.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_heat_map_operations.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_profiles_operations.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_traffic_manager_user_metrics_keys_operations.py create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/py.typed create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/sdk_packaging.toml create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/setup.cfg create mode 100644 sdk/trafficmanager/azure-mgmt-trafficmanager/setup.py create mode 100644 sdk/trafficmanager/ci.yml diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/CHANGELOG.md b/sdk/trafficmanager/azure-mgmt-trafficmanager/CHANGELOG.md new file mode 100644 index 000000000000..6448b7ac5f17 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/CHANGELOG.md @@ -0,0 +1,114 @@ +# Release History + +## 1.0.0b1 (2021-05-13) + +This is beta preview version. + +This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). + +**General breaking changes** + +- Credential system has been completly revamped: + + - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ + - `credentials` parameter has been renamed `credential` + +- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of + supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +- You can't import a `version` module anymore, use `__version__` instead +- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. +- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). +- Most of the operation kwarg have changed. Some of the most noticeable: + + - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user + - For a complete set of + supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) + +**General new features** + +- Type annotations support using `typing`. SDKs are mypy ready. +- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. +- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. + +## 0.51.0 (2019-01-08) + +**Features** + + - Model Endpoint has a new parameter subnets + - Model Profile has a new parameter max_return + - Added operation group TrafficManagerUserMetricsKeysOperations + +## 0.50.0 (2018-05-25) + +**Features** + + - Model Endpoint has a new parameter custom_headers + - Model MonitorConfig has a new parameter custom_headers + - Model MonitorConfig has a new parameter + expected_status_code_ranges + - Model Profile has a new parameter traffic_view_enrollment_status + - Added operation group HeatMapOperations + - Client class can be used as a context manager to keep the underlying + HTTP session open for performance + +**General Breaking changes** + +This version uses a next-generation code generator that *might* +introduce breaking changes. + + - Model signatures now use only keyword-argument syntax. All + positional arguments must be re-written as keyword-arguments. To + keep auto-completion in most cases, models are now generated for + Python 2 and Python 3. Python 3 uses the "\*" syntax for + keyword-only arguments. + - Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to + improve the behavior when unrecognized enum values are encountered. + While this is not a breaking change, the distinctions are important, + and are documented here: + At a glance: + - "is" should not be used at all. + - "format" will return the string value, where "%s" string + formatting will return `NameOfEnum.stringvalue`. Format syntax + should be prefered. + - New Long Running Operation: + - Return type changes from + `msrestazure.azure_operation.AzureOperationPoller` to + `msrest.polling.LROPoller`. External API is the same. + - Return type is now **always** a `msrest.polling.LROPoller`, + regardless of the optional parameters used. + - The behavior has changed when using `raw=True`. Instead of + returning the initial call result as `ClientRawResponse`, + without polling, now this returns an LROPoller. After polling, + the final resource will be returned as a `ClientRawResponse`. + - New `polling` parameter. The default behavior is + `Polling=True` which will poll using ARM algorithm. When + `Polling=False`, the response of the initial call will be + returned without polling. + - `polling` parameter accepts instances of subclasses of + `msrest.polling.PollingMethod`. + - `add_done_callback` will no longer raise if called after + polling is finished, but will instead execute the callback right + away. + +**Bugfixes** + + - Compatibility of the sdist with wheel 0.31.0 + +## 0.40.0 (2017-07-03) + +**Features** + + - New MonitorConfig settings + - New Api Version 2017-05-01 + +**Breaking changes** + + - Rename "list_by_in_resource_group" to + "list_by_resource_group" + - Rename "list_all" to "list_by_subscription" + +## 0.30.0 (2017-04-20) + + - Initial Release (ApiVersion 2017-03-01) + +This wheel package is built with the azure wheel extension diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/MANIFEST.in b/sdk/trafficmanager/azure-mgmt-trafficmanager/MANIFEST.in new file mode 100644 index 000000000000..3a9b6517412b --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/README.md b/sdk/trafficmanager/azure-mgmt-trafficmanager/README.md new file mode 100644 index 000000000000..1e758b897593 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Trafficmanager Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Trafficmanager Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-trafficmanager%2FREADME.png) diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/_meta.json b/sdk/trafficmanager/azure-mgmt-trafficmanager/_meta.json new file mode 100644 index 000000000000..8bec0a2c24b1 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.3.0", + "use": "@autorest/python@5.6.6", + "commit": "6e765382bb72623e7f5d9a11b53954c586ab8663", + "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", + "readme": "specification/trafficmanager/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/__init__.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/__init__.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ 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 new file mode 100644 index 000000000000..c01656b6fa6a --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._traffic_manager_management_client import TrafficManagerManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['TrafficManagerManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_configuration.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_configuration.py new file mode 100644 index 000000000000..31fa8405de34 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class TrafficManagerManagementClientConfiguration(Configuration): + """Configuration for TrafficManagerManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: 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 + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(TrafficManagerManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-trafficmanager/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_metadata.json b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_metadata.json new file mode 100644 index 000000000000..2466c30ef35a --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_metadata.json @@ -0,0 +1,107 @@ +{ + "chosen_version": "2018-08-01", + "total_api_version_list": ["2018-08-01"], + "client": { + "name": "TrafficManagerManagementClient", + "filename": "_traffic_manager_management_client", + "description": "TrafficManagerManagementClient.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": 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\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "endpoints": "EndpointsOperations", + "profiles": "ProfilesOperations", + "geographic_hierarchies": "GeographicHierarchiesOperations", + "heat_map": "HeatMapOperations", + "traffic_manager_user_metrics_keys": "TrafficManagerUserMetricsKeysOperations" + } +} \ 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 new file mode 100644 index 000000000000..a6d4a30406a2 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_traffic_manager_management_client.py @@ -0,0 +1,108 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import 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): + """TrafficManagerManagementClient. + + :ivar endpoints: EndpointsOperations operations + :vartype endpoints: azure.mgmt.trafficmanager.operations.EndpointsOperations + :ivar profiles: ProfilesOperations operations + :vartype profiles: azure.mgmt.trafficmanager.operations.ProfilesOperations + :ivar geographic_hierarchies: GeographicHierarchiesOperations operations + :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 + :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. + :type subscription_id: str + :param str base_url: Service URL + """ + + 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) + 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.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 + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> TrafficManagerManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_version.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/__init__.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/__init__.py new file mode 100644 index 000000000000..994270b5084d --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._traffic_manager_management_client import TrafficManagerManagementClient +__all__ = ['TrafficManagerManagementClient'] 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 new file mode 100644 index 000000000000..a08c23136acf --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class TrafficManagerManagementClientConfiguration(Configuration): + """Configuration for TrafficManagerManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: 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 + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(TrafficManagerManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-trafficmanager/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/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 new file mode 100644 index 000000000000..414fda36d754 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/_traffic_manager_management_client.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import 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): + """TrafficManagerManagementClient. + + :ivar endpoints: EndpointsOperations operations + :vartype endpoints: azure.mgmt.trafficmanager.aio.operations.EndpointsOperations + :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 + :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 + :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. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = TrafficManagerManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "TrafficManagerManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/__init__.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/__init__.py new file mode 100644 index 000000000000..adda3e0be5d0 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._endpoints_operations import EndpointsOperations +from ._profiles_operations import ProfilesOperations +from ._geographic_hierarchies_operations import GeographicHierarchiesOperations +from ._heat_map_operations import HeatMapOperations +from ._traffic_manager_user_metrics_keys_operations import TrafficManagerUserMetricsKeysOperations + +__all__ = [ + 'EndpointsOperations', + 'ProfilesOperations', + 'GeographicHierarchiesOperations', + 'HeatMapOperations', + 'TrafficManagerUserMetricsKeysOperations', +] 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 new file mode 100644 index 000000000000..4c8df8bf6fa7 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_endpoints_operations.py @@ -0,0 +1,332 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EndpointsOperations: + """EndpointsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.trafficmanager.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def update( + self, + resource_group_name: str, + profile_name: str, + endpoint_type: str, + endpoint_name: str, + parameters: "_models.Endpoint", + **kwargs + ) -> "_models.Endpoint": + """Update a Traffic Manager endpoint. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + endpoint to be updated. + :type resource_group_name: str + :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 + :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. + :type parameters: ~azure.mgmt.trafficmanager.models.Endpoint + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Endpoint, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Endpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + error_map = { + 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') + + # 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, '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 + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Endpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + profile_name: str, + endpoint_type: str, + endpoint_name: str, + **kwargs + ) -> "_models.Endpoint": + """Gets a Traffic Manager endpoint. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + endpoint. + :type resource_group_name: str + :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 + :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 + :return: Endpoint, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Endpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Endpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_type: str, + endpoint_name: str, + parameters: "_models.Endpoint", + **kwargs + ) -> "_models.Endpoint": + """Create or update a Traffic Manager endpoint. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + endpoint to be created or updated. + :type resource_group_name: str + :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 + :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 + operation. + :type parameters: ~azure.mgmt.trafficmanager.models.Endpoint + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Endpoint, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Endpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + error_map = { + 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') + + # 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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Endpoint', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Endpoint', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + profile_name: str, + endpoint_type: str, + endpoint_name: str, + **kwargs + ) -> Optional["_models.DeleteOperationResult"]: + """Deletes a Traffic Manager endpoint. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + endpoint to be deleted. + :type resource_group_name: str + :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 + :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 + :return: DeleteOperationResult, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.DeleteOperationResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeleteOperationResult"]] + error_map = { + 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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeleteOperationResult', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..6974af574959 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_geographic_hierarchies_operations.py @@ -0,0 +1,87 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GeographicHierarchiesOperations: + """GeographicHierarchiesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.trafficmanager.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_default( + self, + **kwargs + ) -> "_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 + :return: TrafficManagerGeographicHierarchy, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.TrafficManagerGeographicHierarchy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficManagerGeographicHierarchy"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrafficManagerGeographicHierarchy', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..a6d9c40e94fe --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_heat_map_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class HeatMapOperations: + """HeatMapOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.trafficmanager.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + profile_name: str, + top_left: Optional[List[float]] = None, + bot_right: Optional[List[float]] = None, + **kwargs + ) -> "_models.HeatMapModel": + """Gets latest heatmap for Traffic Manager profile. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + endpoint. + :type resource_group_name: str + :param profile_name: The name of the Traffic Manager profile. + :type profile_name: str + :param top_left: The top left latitude,longitude pair of the rectangular viewport to query for. + :type top_left: list[float] + :param bot_right: The bottom right latitude,longitude pair of the rectangular viewport to query + for. + :type bot_right: list[float] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HeatMapModel, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.HeatMapModel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HeatMapModel"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HeatMapModel', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..b52ed9126e8e --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_profiles_operations.py @@ -0,0 +1,493 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProfilesOperations: + """ProfilesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.trafficmanager.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_traffic_manager_relative_dns_name_availability( + self, + parameters: "_models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters", + **kwargs + ) -> "_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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficManagerNameAvailability"] + error_map = { + 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) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrafficManagerNameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_traffic_manager_relative_dns_name_availability.metadata = {'url': '/providers/Microsoft.Network/checkTrafficManagerNameAvailability'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_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 + profiles to be listed. + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProfileListResult"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ProfileListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProfileListResult"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ProfileListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles'} # type: ignore + + async def get( + self, + resource_group_name: str, + profile_name: str, + **kwargs + ) -> "_models.Profile": + """Gets a Traffic Manager profile. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + profile. + :type resource_group_name: str + :param profile_name: The name of the Traffic Manager profile. + :type profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Profile, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Profile + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Profile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + profile_name: str, + parameters: "_models.Profile", + **kwargs + ) -> "_models.Profile": + """Create or update a Traffic Manager profile. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + profile. + :type resource_group_name: str + :param profile_name: The name of the Traffic Manager profile. + :type profile_name: str + :param parameters: The Traffic Manager profile parameters supplied to the CreateOrUpdate + operation. + :type parameters: ~azure.mgmt.trafficmanager.models.Profile + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Profile, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Profile + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] + error_map = { + 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') + + # 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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Profile', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Profile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + profile_name: str, + **kwargs + ) -> Optional["_models.DeleteOperationResult"]: + """Deletes a Traffic Manager profile. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + profile to be deleted. + :type resource_group_name: str + :param profile_name: The name of the Traffic Manager profile to be deleted. + :type profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeleteOperationResult, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.DeleteOperationResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeleteOperationResult"]] + error_map = { + 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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeleteOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + profile_name: str, + parameters: "_models.Profile", + **kwargs + ) -> "_models.Profile": + """Update a Traffic Manager profile. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + profile. + :type resource_group_name: str + :param profile_name: The name of the Traffic Manager profile. + :type profile_name: str + :param parameters: The Traffic Manager profile parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.trafficmanager.models.Profile + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Profile, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Profile + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] + error_map = { + 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') + + # 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, '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 + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Profile', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..aaaa09f3447d --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/aio/operations/_traffic_manager_user_metrics_keys_operations.py @@ -0,0 +1,191 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TrafficManagerUserMetricsKeysOperations: + """TrafficManagerUserMetricsKeysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.trafficmanager.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + **kwargs + ) -> "_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 + :return: UserMetricsModel, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.UserMetricsModel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserMetricsModel"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserMetricsModel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default'} # type: ignore + + async def create_or_update( + self, + **kwargs + ) -> "_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 + :return: UserMetricsModel, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.UserMetricsModel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserMetricsModel"] + error_map = { + 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') + + # 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 + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserMetricsModel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default'} # type: ignore + + async def delete( + self, + **kwargs + ) -> "_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 + :return: DeleteOperationResult, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.DeleteOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeleteOperationResult"] + error_map = { + 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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeleteOperationResult', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..b900b7bca82f --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/__init__.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import 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 ._traffic_manager_management_client_enums import ( + AllowedEndpointRecordType, + EndpointMonitorStatus, + EndpointStatus, + MonitorProtocol, + ProfileMonitorStatus, + ProfileStatus, + TrafficRoutingMethod, + TrafficViewEnrollmentStatus, +) + +__all__ = [ + 'CheckTrafficManagerRelativeDnsNameAvailabilityParameters', + 'CloudErrorBody', + 'DeleteOperationResult', + 'DnsConfig', + 'Endpoint', + 'EndpointPropertiesCustomHeadersItem', + 'EndpointPropertiesSubnetsItem', + 'HeatMapEndpoint', + 'HeatMapModel', + 'MonitorConfig', + 'MonitorConfigCustomHeadersItem', + 'MonitorConfigExpectedStatusCodeRangesItem', + 'Profile', + 'ProfileListResult', + 'ProxyResource', + 'QueryExperience', + 'Region', + 'Resource', + 'TrackedResource', + 'TrafficFlow', + 'TrafficManagerGeographicHierarchy', + 'TrafficManagerNameAvailability', + 'UserMetricsModel', + 'AllowedEndpointRecordType', + 'EndpointMonitorStatus', + 'EndpointStatus', + 'MonitorProtocol', + 'ProfileMonitorStatus', + 'ProfileStatus', + 'TrafficRoutingMethod', + 'TrafficViewEnrollmentStatus', +] 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 new file mode 100644 index 000000000000..c48521a4592c --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models.py @@ -0,0 +1,807 @@ +# 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 new file mode 100644 index 000000000000..1b276d9e5533 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_models_py3.py @@ -0,0 +1,933 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._traffic_manager_management_client_enums import * + + +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, + *, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + super(CheckTrafficManagerRelativeDnsNameAvailabilityParameters, self).__init__(**kwargs) + self.name = name + self.type = type + + +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, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class 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, + *, + relative_name: Optional[str] = None, + ttl: Optional[int] = None, + **kwargs + ): + super(DnsConfig, self).__init__(**kwargs) + self.relative_name = relative_name + self.fqdn = None + self.ttl = ttl + + +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, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + + +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, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + 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 - + /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, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + target_resource_id: Optional[str] = None, + target: Optional[str] = None, + endpoint_status: Optional[Union[str, "EndpointStatus"]] = None, + weight: Optional[int] = None, + priority: Optional[int] = None, + endpoint_location: Optional[str] = None, + endpoint_monitor_status: Optional[Union[str, "EndpointMonitorStatus"]] = None, + min_child_endpoints: Optional[int] = None, + min_child_endpoints_i_pv4: Optional[int] = None, + min_child_endpoints_i_pv6: Optional[int] = None, + geo_mapping: Optional[List[str]] = None, + subnets: Optional[List["EndpointPropertiesSubnetsItem"]] = None, + custom_headers: Optional[List["EndpointPropertiesCustomHeadersItem"]] = None, + **kwargs + ): + super(Endpoint, self).__init__(id=id, name=name, type=type, **kwargs) + self.target_resource_id = target_resource_id + self.target = target + self.endpoint_status = endpoint_status + self.weight = weight + self.priority = priority + self.endpoint_location = endpoint_location + self.endpoint_monitor_status = endpoint_monitor_status + self.min_child_endpoints = min_child_endpoints + self.min_child_endpoints_i_pv4 = min_child_endpoints_i_pv4 + self.min_child_endpoints_i_pv6 = min_child_endpoints_i_pv6 + self.geo_mapping = geo_mapping + self.subnets = subnets + self.custom_headers = custom_headers + + +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, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + super(EndpointPropertiesCustomHeadersItem, self).__init__(**kwargs) + self.name = name + self.value = value + + +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, + *, + first: Optional[str] = None, + last: Optional[str] = None, + scope: Optional[int] = None, + **kwargs + ): + super(EndpointPropertiesSubnetsItem, self).__init__(**kwargs) + self.first = first + self.last = last + self.scope = scope + + +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, + *, + resource_id: Optional[str] = None, + endpoint_id: Optional[int] = None, + **kwargs + ): + super(HeatMapEndpoint, self).__init__(**kwargs) + self.resource_id = resource_id + self.endpoint_id = endpoint_id + + +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, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + endpoints: Optional[List["HeatMapEndpoint"]] = None, + traffic_flows: Optional[List["TrafficFlow"]] = None, + **kwargs + ): + super(HeatMapModel, self).__init__(id=id, name=name, type=type, **kwargs) + self.start_time = start_time + self.end_time = end_time + self.endpoints = endpoints + self.traffic_flows = traffic_flows + + +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, + *, + profile_monitor_status: Optional[Union[str, "ProfileMonitorStatus"]] = None, + protocol: Optional[Union[str, "MonitorProtocol"]] = None, + port: Optional[int] = None, + path: Optional[str] = None, + interval_in_seconds: Optional[int] = None, + timeout_in_seconds: Optional[int] = None, + tolerated_number_of_failures: Optional[int] = None, + custom_headers: Optional[List["MonitorConfigCustomHeadersItem"]] = None, + expected_status_code_ranges: Optional[List["MonitorConfigExpectedStatusCodeRangesItem"]] = None, + **kwargs + ): + super(MonitorConfig, self).__init__(**kwargs) + self.profile_monitor_status = profile_monitor_status + self.protocol = protocol + self.port = port + self.path = path + self.interval_in_seconds = interval_in_seconds + self.timeout_in_seconds = timeout_in_seconds + self.tolerated_number_of_failures = tolerated_number_of_failures + self.custom_headers = custom_headers + self.expected_status_code_ranges = expected_status_code_ranges + + +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, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + super(MonitorConfigCustomHeadersItem, self).__init__(**kwargs) + self.name = name + self.value = value + + +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, + *, + min: Optional[int] = None, + max: Optional[int] = None, + **kwargs + ): + super(MonitorConfigExpectedStatusCodeRangesItem, self).__init__(**kwargs) + self.min = min + self.max = max + + +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, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + **kwargs + ): + super(TrackedResource, self).__init__(id=id, name=name, type=type, **kwargs) + self.tags = tags + self.location = location + + +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, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + profile_status: Optional[Union[str, "ProfileStatus"]] = None, + traffic_routing_method: Optional[Union[str, "TrafficRoutingMethod"]] = None, + dns_config: Optional["DnsConfig"] = None, + monitor_config: Optional["MonitorConfig"] = None, + endpoints: Optional[List["Endpoint"]] = None, + traffic_view_enrollment_status: Optional[Union[str, "TrafficViewEnrollmentStatus"]] = None, + allowed_endpoint_record_types: Optional[List[Union[str, "AllowedEndpointRecordType"]]] = None, + max_return: Optional[int] = None, + **kwargs + ): + 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 + self.dns_config = dns_config + self.monitor_config = monitor_config + self.endpoints = endpoints + self.traffic_view_enrollment_status = traffic_view_enrollment_status + self.allowed_endpoint_record_types = allowed_endpoint_record_types + self.max_return = max_return + + +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, + *, + value: Optional[List["Profile"]] = None, + **kwargs + ): + super(ProfileListResult, self).__init__(**kwargs) + self.value = value + + +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, + *, + endpoint_id: int, + query_count: int, + latency: Optional[float] = None, + **kwargs + ): + super(QueryExperience, self).__init__(**kwargs) + self.endpoint_id = endpoint_id + self.query_count = query_count + self.latency = latency + + +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, + *, + code: Optional[str] = None, + name: Optional[str] = None, + regions: Optional[List["Region"]] = None, + **kwargs + ): + super(Region, self).__init__(**kwargs) + self.code = code + self.name = name + self.regions = regions + + +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, + *, + source_ip: Optional[str] = None, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + query_experiences: Optional[List["QueryExperience"]] = None, + **kwargs + ): + super(TrafficFlow, self).__init__(**kwargs) + self.source_ip = source_ip + self.latitude = latitude + self.longitude = longitude + self.query_experiences = query_experiences + + +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, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + geographic_hierarchy: Optional["Region"] = None, + **kwargs + ): + super(TrafficManagerGeographicHierarchy, self).__init__(id=id, name=name, type=type, **kwargs) + self.geographic_hierarchy = geographic_hierarchy + + +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, + *, + name: Optional[str] = None, + type: Optional[str] = None, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(TrafficManagerNameAvailability, self).__init__(**kwargs) + self.name = name + self.type = type + self.name_available = name_available + self.reason = reason + self.message = message + + +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, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + key: Optional[str] = None, + **kwargs + ): + 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 new file mode 100644 index 000000000000..735f719a9e1c --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/_traffic_manager_management_client_enums.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AllowedEndpointRecordType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The allowed type DNS record types for this profile. + """ + + DOMAIN_NAME = "DomainName" + I_PV4_ADDRESS = "IPv4Address" + I_PV6_ADDRESS = "IPv6Address" + ANY = "Any" + +class EndpointMonitorStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The monitoring status of the endpoint. + """ + + CHECKING_ENDPOINT = "CheckingEndpoint" + ONLINE = "Online" + DEGRADED = "Degraded" + DISABLED = "Disabled" + INACTIVE = "Inactive" + STOPPED = "Stopped" + +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. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class MonitorProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. + """ + + HTTP = "HTTP" + HTTPS = "HTTPS" + TCP = "TCP" + +class ProfileMonitorStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The profile-level monitoring status of the Traffic Manager profile. + """ + + CHECKING_ENDPOINTS = "CheckingEndpoints" + ONLINE = "Online" + DEGRADED = "Degraded" + DISABLED = "Disabled" + INACTIVE = "Inactive" + +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)): + """The traffic routing method of the Traffic Manager profile. + """ + + PERFORMANCE = "Performance" + PRIORITY = "Priority" + WEIGHTED = "Weighted" + GEOGRAPHIC = "Geographic" + MULTI_VALUE = "MultiValue" + SUBNET = "Subnet" + +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. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/__init__.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/__init__.py new file mode 100644 index 000000000000..adda3e0be5d0 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._endpoints_operations import EndpointsOperations +from ._profiles_operations import ProfilesOperations +from ._geographic_hierarchies_operations import GeographicHierarchiesOperations +from ._heat_map_operations import HeatMapOperations +from ._traffic_manager_user_metrics_keys_operations import TrafficManagerUserMetricsKeysOperations + +__all__ = [ + 'EndpointsOperations', + 'ProfilesOperations', + 'GeographicHierarchiesOperations', + 'HeatMapOperations', + 'TrafficManagerUserMetricsKeysOperations', +] 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 new file mode 100644 index 000000000000..8e71713be9d4 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_endpoints_operations.py @@ -0,0 +1,340 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class EndpointsOperations(object): + """EndpointsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.trafficmanager.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def 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" + """Update a Traffic Manager endpoint. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + endpoint to be updated. + :type resource_group_name: str + :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 + :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. + :type parameters: ~azure.mgmt.trafficmanager.models.Endpoint + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Endpoint, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Endpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + error_map = { + 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') + + # 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, '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 + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Endpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + + 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" + """Gets a Traffic Manager endpoint. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + endpoint. + :type resource_group_name: str + :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 + :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 + :return: Endpoint, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Endpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Endpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'} # type: ignore + + 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" + """Create or update a Traffic Manager endpoint. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + endpoint to be created or updated. + :type resource_group_name: str + :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 + :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 + operation. + :type parameters: ~azure.mgmt.trafficmanager.models.Endpoint + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Endpoint, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Endpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + error_map = { + 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') + + # 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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Endpoint', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Endpoint', pipeline_response) + + if cls: + 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 + + 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"] + """Deletes a Traffic Manager endpoint. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + endpoint to be deleted. + :type resource_group_name: str + :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 + :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 + :return: DeleteOperationResult, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.DeleteOperationResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeleteOperationResult"]] + error_map = { + 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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeleteOperationResult', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..37b7cbbcf5bd --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_geographic_hierarchies_operations.py @@ -0,0 +1,92 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class GeographicHierarchiesOperations(object): + """GeographicHierarchiesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.trafficmanager.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_default( + self, + **kwargs # type: Any + ): + # type: (...) -> "_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 + :return: TrafficManagerGeographicHierarchy, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.TrafficManagerGeographicHierarchy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficManagerGeographicHierarchy"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrafficManagerGeographicHierarchy', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..a5c25e49468b --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_heat_map_operations.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class HeatMapOperations(object): + """HeatMapOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.trafficmanager.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + profile_name, # type: str + top_left=None, # type: Optional[List[float]] + bot_right=None, # type: Optional[List[float]] + **kwargs # type: Any + ): + # type: (...) -> "_models.HeatMapModel" + """Gets latest heatmap for Traffic Manager profile. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + endpoint. + :type resource_group_name: str + :param profile_name: The name of the Traffic Manager profile. + :type profile_name: str + :param top_left: The top left latitude,longitude pair of the rectangular viewport to query for. + :type top_left: list[float] + :param bot_right: The bottom right latitude,longitude pair of the rectangular viewport to query + for. + :type bot_right: list[float] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HeatMapModel, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.HeatMapModel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HeatMapModel"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HeatMapModel', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..67a169e4cfc3 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_profiles_operations.py @@ -0,0 +1,504 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ProfilesOperations(object): + """ProfilesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.trafficmanager.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_traffic_manager_relative_dns_name_availability( + self, + parameters, # type: "_models.CheckTrafficManagerRelativeDnsNameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficManagerNameAvailability"] + error_map = { + 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) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrafficManagerNameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_traffic_manager_relative_dns_name_availability.metadata = {'url': '/providers/Microsoft.Network/checkTrafficManagerNameAvailability'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 + profiles to be listed. + :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.paging.ItemPaged[~azure.mgmt.trafficmanager.models.ProfileListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProfileListResult"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProfileListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> 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 + :return: An iterator like instance of either ProfileListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.trafficmanager.models.ProfileListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProfileListResult"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProfileListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles'} # type: ignore + + def get( + self, + resource_group_name, # type: str + profile_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Profile" + """Gets a Traffic Manager profile. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + profile. + :type resource_group_name: str + :param profile_name: The name of the Traffic Manager profile. + :type profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Profile, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Profile + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Profile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + profile_name, # type: str + parameters, # type: "_models.Profile" + **kwargs # type: Any + ): + # type: (...) -> "_models.Profile" + """Create or update a Traffic Manager profile. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + profile. + :type resource_group_name: str + :param profile_name: The name of the Traffic Manager profile. + :type profile_name: str + :param parameters: The Traffic Manager profile parameters supplied to the CreateOrUpdate + operation. + :type parameters: ~azure.mgmt.trafficmanager.models.Profile + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Profile, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Profile + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] + error_map = { + 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') + + # 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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Profile', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Profile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + profile_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.DeleteOperationResult"] + """Deletes a Traffic Manager profile. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + profile to be deleted. + :type resource_group_name: str + :param profile_name: The name of the Traffic Manager profile to be deleted. + :type profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeleteOperationResult, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.DeleteOperationResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeleteOperationResult"]] + error_map = { + 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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeleteOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + profile_name, # type: str + parameters, # type: "_models.Profile" + **kwargs # type: Any + ): + # type: (...) -> "_models.Profile" + """Update a Traffic Manager profile. + + :param resource_group_name: The name of the resource group containing the Traffic Manager + profile. + :type resource_group_name: str + :param profile_name: The name of the Traffic Manager profile. + :type profile_name: str + :param parameters: The Traffic Manager profile parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.trafficmanager.models.Profile + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Profile, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.Profile + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] + error_map = { + 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') + + # 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, '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 + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Profile', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..e65055d42cb2 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/operations/_traffic_manager_user_metrics_keys_operations.py @@ -0,0 +1,198 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TrafficManagerUserMetricsKeysOperations(object): + """TrafficManagerUserMetricsKeysOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.trafficmanager.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + **kwargs # type: Any + ): + # type: (...) -> "_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 + :return: UserMetricsModel, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.UserMetricsModel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserMetricsModel"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserMetricsModel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default'} # type: ignore + + def create_or_update( + self, + **kwargs # type: Any + ): + # type: (...) -> "_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 + :return: UserMetricsModel, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.UserMetricsModel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserMetricsModel"] + error_map = { + 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') + + # 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 + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('UserMetricsModel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default'} # type: ignore + + def delete( + self, + **kwargs # type: Any + ): + # type: (...) -> "_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 + :return: DeleteOperationResult, or the result of cls(response) + :rtype: ~azure.mgmt.trafficmanager.models.DeleteOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeleteOperationResult"] + error_map = { + 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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeleteOperationResult', pipeline_response) + + if cls: + 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/py.typed b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/sdk_packaging.toml b/sdk/trafficmanager/azure-mgmt-trafficmanager/sdk_packaging.toml new file mode 100644 index 000000000000..5433a9824b97 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-trafficmanager" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Trafficmanager Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/setup.cfg b/sdk/trafficmanager/azure-mgmt-trafficmanager/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/setup.py b/sdk/trafficmanager/azure-mgmt-trafficmanager/setup.py new file mode 100644 index 000000000000..68ad32e31cdc --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-trafficmanager" +PACKAGE_PPRINT_NAME = "Trafficmanager Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/trafficmanager/ci.yml b/sdk/trafficmanager/ci.yml new file mode 100644 index 000000000000..c38b055fda88 --- /dev/null +++ b/sdk/trafficmanager/ci.yml @@ -0,0 +1,35 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/trafficmanager/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/trafficmanager/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: trafficmanager + Artifacts: + - name: azure-mgmt-trafficmanager + safeName: azuremgmttrafficmanager diff --git a/shared_requirements.txt b/shared_requirements.txt index 12ca338940da..382729930c39 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -271,6 +271,7 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-elastic msrest>=0.6.21 #override azure-mgmt-confidentialledger msrest>=0.6.21 #override azure-mgmt-mixedreality msrest>=0.6.21 +#override azure-mgmt-trafficmanager msrest>=0.6.21 #override azure-mgmt-storagecache msrest>=0.6.21 #override azure-mgmt-videoanalyzer msrest>=0.6.21 #override azure-mgmt-extendedlocation msrest>=0.6.21