From fd96d62df9f81657788078ac808ca1e20060df16 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 15 Mar 2022 03:43:57 +0000 Subject: [PATCH] CodeGen from PR 18208 in Azure/azure-rest-api-specs Merge 4772ab9f3e13afc920d577bea23077ec30e32528 into 2abe647120f14bb145968a5543ead8ed51394498 --- sdk/network/azure-mgmt-frontdoor/_meta.json | 11 + .../azure/mgmt/frontdoor/__init__.py | 9 +- .../azure/mgmt/frontdoor/_configuration.py | 19 +- .../_front_door_management_client.py | 131 +- .../azure/mgmt/frontdoor/_metadata.json | 69 +- .../azure/mgmt/frontdoor/_patch.py | 31 + .../azure/mgmt/frontdoor/_vendor.py | 27 + .../azure/mgmt/frontdoor/_version.py | 2 +- .../azure/mgmt/frontdoor/aio/__init__.py | 5 + .../mgmt/frontdoor/aio/_configuration.py | 6 +- .../aio/_front_door_management_client.py | 120 +- .../azure/mgmt/frontdoor/aio/_patch.py | 31 + .../aio/operations/_endpoints_operations.py | 77 +- .../aio/operations/_experiments_operations.py | 315 +- ...front_door_name_availability_operations.py | 51 +- ...ailability_with_subscription_operations.py | 50 +- .../aio/operations/_front_doors_operations.py | 320 +- .../_frontend_endpoints_operations.py | 237 +- .../_managed_rule_sets_operations.py | 60 +- ..._network_experiment_profiles_operations.py | 346 +- .../aio/operations/_policies_operations.py | 230 +- .../_preconfigured_endpoints_operations.py | 66 +- .../aio/operations/_reports_operations.py | 115 +- .../operations/_rules_engines_operations.py | 243 +- .../azure/mgmt/frontdoor/models/__init__.py | 261 +- .../_front_door_management_client_enums.py | 121 +- .../azure/mgmt/frontdoor/models/_models.py | 3474 ----------------- .../mgmt/frontdoor/models/_models_py3.py | 2007 +++++++--- .../operations/_endpoints_operations.py | 152 +- .../operations/_experiments_operations.py | 600 +-- ...front_door_name_availability_operations.py | 103 +- ...ailability_with_subscription_operations.py | 108 +- .../operations/_front_doors_operations.py | 601 ++- .../_frontend_endpoints_operations.py | 457 ++- .../_managed_rule_sets_operations.py | 102 +- ..._network_experiment_profiles_operations.py | 639 +-- .../operations/_policies_operations.py | 427 +- .../_preconfigured_endpoints_operations.py | 116 +- .../operations/_reports_operations.py | 257 +- .../operations/_rules_engines_operations.py | 463 ++- 40 files changed, 5410 insertions(+), 7049 deletions(-) create mode 100644 sdk/network/azure-mgmt-frontdoor/_meta.json create mode 100644 sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_patch.py create mode 100644 sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_vendor.py create mode 100644 sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_patch.py delete mode 100644 sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_models.py diff --git a/sdk/network/azure-mgmt-frontdoor/_meta.json b/sdk/network/azure-mgmt-frontdoor/_meta.json new file mode 100644 index 0000000000000..4c3751a2712e6 --- /dev/null +++ b/sdk/network/azure-mgmt-frontdoor/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "d6191d641c750189751bde4466749fa589265abc", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/frontdoor/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/frontdoor/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/__init__.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/__init__.py index 4afc05f018d0b..c3bd4285aafe7 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/__init__.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['FrontDoorManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_configuration.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_configuration.py index a57a16253db4a..33af7bca94df4 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_configuration.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class FrontDoorManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(FrontDoorManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(FrontDoorManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_front_door_management_client.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_front_door_management_client.py index 2aad8ccc556d8..265eb5508d6de 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_front_door_management_client.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_front_door_management_client.py @@ -6,48 +6,41 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import FrontDoorManagementClientConfiguration +from .operations import EndpointsOperations, ExperimentsOperations, FrontDoorNameAvailabilityOperations, FrontDoorNameAvailabilityWithSubscriptionOperations, FrontDoorsOperations, FrontendEndpointsOperations, ManagedRuleSetsOperations, NetworkExperimentProfilesOperations, PoliciesOperations, PreconfiguredEndpointsOperations, ReportsOperations, RulesEnginesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential -from ._configuration import FrontDoorManagementClientConfiguration -from .operations import NetworkExperimentProfilesOperations -from .operations import PreconfiguredEndpointsOperations -from .operations import ExperimentsOperations -from .operations import ReportsOperations -from .operations import FrontDoorNameAvailabilityOperations -from .operations import FrontDoorNameAvailabilityWithSubscriptionOperations -from .operations import FrontDoorsOperations -from .operations import FrontendEndpointsOperations -from .operations import EndpointsOperations -from .operations import RulesEnginesOperations -from .operations import PoliciesOperations -from .operations import ManagedRuleSetsOperations -from . import models - - -class FrontDoorManagementClient(object): +class FrontDoorManagementClient: """FrontDoor Client. :ivar network_experiment_profiles: NetworkExperimentProfilesOperations operations - :vartype network_experiment_profiles: azure.mgmt.frontdoor.operations.NetworkExperimentProfilesOperations + :vartype network_experiment_profiles: + azure.mgmt.frontdoor.operations.NetworkExperimentProfilesOperations :ivar preconfigured_endpoints: PreconfiguredEndpointsOperations operations - :vartype preconfigured_endpoints: azure.mgmt.frontdoor.operations.PreconfiguredEndpointsOperations + :vartype preconfigured_endpoints: + azure.mgmt.frontdoor.operations.PreconfiguredEndpointsOperations :ivar experiments: ExperimentsOperations operations :vartype experiments: azure.mgmt.frontdoor.operations.ExperimentsOperations :ivar reports: ReportsOperations operations :vartype reports: azure.mgmt.frontdoor.operations.ReportsOperations :ivar front_door_name_availability: FrontDoorNameAvailabilityOperations operations - :vartype front_door_name_availability: azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityOperations - :ivar front_door_name_availability_with_subscription: FrontDoorNameAvailabilityWithSubscriptionOperations operations - :vartype front_door_name_availability_with_subscription: azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityWithSubscriptionOperations + :vartype front_door_name_availability: + azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityOperations + :ivar front_door_name_availability_with_subscription: + FrontDoorNameAvailabilityWithSubscriptionOperations operations + :vartype front_door_name_availability_with_subscription: + azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityWithSubscriptionOperations :ivar front_doors: FrontDoorsOperations operations :vartype front_doors: azure.mgmt.frontdoor.operations.FrontDoorsOperations :ivar frontend_endpoints: FrontendEndpointsOperations operations @@ -62,54 +55,68 @@ class FrontDoorManagementClient(object): :vartype managed_rule_sets: azure.mgmt.frontdoor.operations.ManagedRuleSetsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = FrontDoorManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = FrontDoorManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.network_experiment_profiles = NetworkExperimentProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.preconfigured_endpoints = PreconfiguredEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.experiments = ExperimentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.reports = ReportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.front_door_name_availability = FrontDoorNameAvailabilityOperations(self._client, self._config, self._serialize, self._deserialize) + self.front_door_name_availability_with_subscription = FrontDoorNameAvailabilityWithSubscriptionOperations(self._client, self._config, self._serialize, self._deserialize) + self.front_doors = FrontDoorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.frontend_endpoints = FrontendEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules_engines = RulesEnginesOperations(self._client, self._config, self._serialize, self._deserialize) + self.policies = PoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_rule_sets = ManagedRuleSetsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ - self.network_experiment_profiles = NetworkExperimentProfilesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.preconfigured_endpoints = PreconfiguredEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.experiments = ExperimentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.reports = ReportsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.front_door_name_availability = FrontDoorNameAvailabilityOperations( - self._client, self._config, self._serialize, self._deserialize) - self.front_door_name_availability_with_subscription = FrontDoorNameAvailabilityWithSubscriptionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.front_doors = FrontDoorsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.frontend_endpoints = FrontendEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.endpoints = EndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rules_engines = RulesEnginesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.policies = PoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_rule_sets = ManagedRuleSetsOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_metadata.json b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_metadata.json index e969a9ac742f1..b75a244eaa362 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_metadata.json +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_metadata.json @@ -5,11 +5,13 @@ "name": "FrontDoorManagementClient", "filename": "_front_door_management_client", "description": "FrontDoor Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, - "client_side_validation": false + "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\": [\"FrontDoorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"FrontDoorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "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, # type: str", + "signature": "subscription_id: str,", "description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true @@ -42,14 +44,57 @@ }, "constant": { }, - "call": "credential, subscription_id" + "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", + "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 + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "network_experiment_profiles": "NetworkExperimentProfilesOperations", @@ -64,9 +109,5 @@ "rules_engines": "RulesEnginesOperations", "policies": "PoliciesOperations", "managed_rule_sets": "ManagedRuleSetsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_patch.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_vendor.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_version.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_version.py index c47f66669f1bf..e5754a47ce68f 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_version.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/__init__.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/__init__.py index 879639cbd889a..e8241b5614867 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/__init__.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/__init__.py @@ -8,3 +8,8 @@ from ._front_door_management_client import FrontDoorManagementClient __all__ = ['FrontDoorManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_configuration.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_configuration.py index fa50fe396e7bf..28c746f02a66e 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_configuration.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(FrontDoorManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(FrontDoorManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +63,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_front_door_management_client.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_front_door_management_client.py index a8f63c5a942fe..00be453abc4f9 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_front_door_management_client.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_front_door_management_client.py @@ -6,46 +6,41 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import FrontDoorManagementClientConfiguration +from .operations import EndpointsOperations, ExperimentsOperations, FrontDoorNameAvailabilityOperations, FrontDoorNameAvailabilityWithSubscriptionOperations, FrontDoorsOperations, FrontendEndpointsOperations, ManagedRuleSetsOperations, NetworkExperimentProfilesOperations, PoliciesOperations, PreconfiguredEndpointsOperations, ReportsOperations, RulesEnginesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import FrontDoorManagementClientConfiguration -from .operations import NetworkExperimentProfilesOperations -from .operations import PreconfiguredEndpointsOperations -from .operations import ExperimentsOperations -from .operations import ReportsOperations -from .operations import FrontDoorNameAvailabilityOperations -from .operations import FrontDoorNameAvailabilityWithSubscriptionOperations -from .operations import FrontDoorsOperations -from .operations import FrontendEndpointsOperations -from .operations import EndpointsOperations -from .operations import RulesEnginesOperations -from .operations import PoliciesOperations -from .operations import ManagedRuleSetsOperations -from .. import models - - -class FrontDoorManagementClient(object): +class FrontDoorManagementClient: """FrontDoor Client. :ivar network_experiment_profiles: NetworkExperimentProfilesOperations operations - :vartype network_experiment_profiles: azure.mgmt.frontdoor.aio.operations.NetworkExperimentProfilesOperations + :vartype network_experiment_profiles: + azure.mgmt.frontdoor.aio.operations.NetworkExperimentProfilesOperations :ivar preconfigured_endpoints: PreconfiguredEndpointsOperations operations - :vartype preconfigured_endpoints: azure.mgmt.frontdoor.aio.operations.PreconfiguredEndpointsOperations + :vartype preconfigured_endpoints: + azure.mgmt.frontdoor.aio.operations.PreconfiguredEndpointsOperations :ivar experiments: ExperimentsOperations operations :vartype experiments: azure.mgmt.frontdoor.aio.operations.ExperimentsOperations :ivar reports: ReportsOperations operations :vartype reports: azure.mgmt.frontdoor.aio.operations.ReportsOperations :ivar front_door_name_availability: FrontDoorNameAvailabilityOperations operations - :vartype front_door_name_availability: azure.mgmt.frontdoor.aio.operations.FrontDoorNameAvailabilityOperations - :ivar front_door_name_availability_with_subscription: FrontDoorNameAvailabilityWithSubscriptionOperations operations - :vartype front_door_name_availability_with_subscription: azure.mgmt.frontdoor.aio.operations.FrontDoorNameAvailabilityWithSubscriptionOperations + :vartype front_door_name_availability: + azure.mgmt.frontdoor.aio.operations.FrontDoorNameAvailabilityOperations + :ivar front_door_name_availability_with_subscription: + FrontDoorNameAvailabilityWithSubscriptionOperations operations + :vartype front_door_name_availability_with_subscription: + azure.mgmt.frontdoor.aio.operations.FrontDoorNameAvailabilityWithSubscriptionOperations :ivar front_doors: FrontDoorsOperations operations :vartype front_doors: azure.mgmt.frontdoor.aio.operations.FrontDoorsOperations :ivar frontend_endpoints: FrontendEndpointsOperations operations @@ -60,53 +55,68 @@ class FrontDoorManagementClient(object): :vartype managed_rule_sets: azure.mgmt.frontdoor.aio.operations.ManagedRuleSetsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The subscription credentials which uniquely identify the Microsoft + Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = FrontDoorManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = FrontDoorManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.network_experiment_profiles = NetworkExperimentProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.preconfigured_endpoints = PreconfiguredEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.experiments = ExperimentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.reports = ReportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.front_door_name_availability = FrontDoorNameAvailabilityOperations(self._client, self._config, self._serialize, self._deserialize) + self.front_door_name_availability_with_subscription = FrontDoorNameAvailabilityWithSubscriptionOperations(self._client, self._config, self._serialize, self._deserialize) + self.front_doors = FrontDoorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.frontend_endpoints = FrontendEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules_engines = RulesEnginesOperations(self._client, self._config, self._serialize, self._deserialize) + self.policies = PoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_rule_sets = ManagedRuleSetsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ - self.network_experiment_profiles = NetworkExperimentProfilesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.preconfigured_endpoints = PreconfiguredEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.experiments = ExperimentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.reports = ReportsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.front_door_name_availability = FrontDoorNameAvailabilityOperations( - self._client, self._config, self._serialize, self._deserialize) - self.front_door_name_availability_with_subscription = FrontDoorNameAvailabilityWithSubscriptionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.front_doors = FrontDoorsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.frontend_endpoints = FrontendEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.endpoints = EndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rules_engines = RulesEnginesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.policies = PoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_rule_sets = ManagedRuleSetsOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_patch.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_endpoints_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_endpoints_operations.py index 33e2e5242035f..a02f28431d205 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_endpoints_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_endpoints_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._endpoints_operations import build_purge_content_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,58 +51,49 @@ async def _purge_content_initial( resource_group_name: str, front_door_name: str, content_file_paths: "_models.PurgeParameters", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._purge_content_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(content_file_paths, 'PurgeParameters') + + request = build_purge_content_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + content_type=content_type, + json=_json, + template_url=self._purge_content_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(content_file_paths, 'PurgeParameters') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _purge_content_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_content( self, resource_group_name: str, front_door_name: str, content_file_paths: "_models.PurgeParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Removes a content from Front Door. @@ -112,15 +107,18 @@ async def begin_purge_content( :type content_file_paths: ~azure.mgmt.frontdoor.models.PurgeParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -132,24 +130,18 @@ async def begin_purge_content( resource_group_name=resource_group_name, front_door_name=front_door_name, content_file_paths=content_file_paths, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -161,4 +153,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_content.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/purge'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_experiments_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_experiments_operations.py index 8a1ff2ad924ee..c9a4db6b6fcb2 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_experiments_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_experiments_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._experiments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_profile_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_profile( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ExperimentList"]: """Gets a list of Experiments. @@ -67,36 +73,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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_profile.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self.list_by_profile.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExperimentList', pipeline_response) + deserialized = self._deserialize("ExperimentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,23 +112,25 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, experiment_name: str, - **kwargs + **kwargs: Any ) -> "_models.Experiment": """Gets an Experiment by ExperimentName. @@ -147,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Experiment', pipeline_response) @@ -183,55 +178,46 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, profile_name: str, experiment_name: str, parameters: "_models.Experiment", - **kwargs + **kwargs: Any ) -> "_models.Experiment": cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Experiment') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Experiment') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Experiment', pipeline_response) @@ -246,15 +232,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, profile_name: str, experiment_name: str, parameters: "_models.Experiment", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Experiment"]: """Creates or updates an Experiment. @@ -270,15 +259,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.frontdoor.models.Experiment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Experiment or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Experiment or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.frontdoor.models.Experiment] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +284,21 @@ async def begin_create_or_update( profile_name=profile_name, experiment_name=experiment_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Experiment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -324,6 +310,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore async def _update_initial( @@ -332,47 +319,36 @@ async def _update_initial( profile_name: str, experiment_name: str, parameters: "_models.ExperimentUpdateModel", - **kwargs + **kwargs: Any ) -> "_models.Experiment": cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ExperimentUpdateModel') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ExperimentUpdateModel') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Experiment', pipeline_response) @@ -384,15 +360,18 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, profile_name: str, experiment_name: str, parameters: "_models.ExperimentUpdateModel", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Experiment"]: """Updates an Experiment by Experiment id. @@ -408,15 +387,19 @@ async def begin_update( :type parameters: ~azure.mgmt.frontdoor.models.ExperimentUpdateModel :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Experiment or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Experiment or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.frontdoor.models.Experiment] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] lro_delay = kwargs.pop( 'polling_interval', @@ -429,28 +412,21 @@ async def begin_update( profile_name=profile_name, experiment_name=experiment_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Experiment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -462,6 +438,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore async def _delete_initial( @@ -469,54 +446,45 @@ async def _delete_initial( resource_group_name: str, profile_name: str, experiment_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, experiment_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an Experiment. @@ -530,15 +498,17 @@ async def begin_delete( :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -553,22 +523,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -580,4 +542,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_door_name_availability_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_door_name_availability_operations.py index 1adeeddb5b942..5c187bb7bfdc1 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_door_name_availability_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_door_name_availability_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._front_door_name_availability_operations import build_check_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,15 +44,17 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check( self, check_front_door_name_availability_input: "_models.CheckNameAvailabilityInput", - **kwargs + **kwargs: Any ) -> "_models.CheckNameAvailabilityOutput": """Check the availability of a Front Door resource name. :param check_front_door_name_availability_input: Input to check. - :type check_front_door_name_availability_input: ~azure.mgmt.frontdoor.models.CheckNameAvailabilityInput + :type check_front_door_name_availability_input: + ~azure.mgmt.frontdoor.models.CheckNameAvailabilityInput :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput, or the result of cls(response) :rtype: ~azure.mgmt.frontdoor.models.CheckNameAvailabilityOutput @@ -59,32 +65,25 @@ async def check( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check.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(check_front_door_name_availability_input, 'CheckNameAvailabilityInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_front_door_name_availability_input, 'CheckNameAvailabilityInput') + + request = build_check_request( + content_type=content_type, + json=_json, + template_url=self.check.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) @@ -93,4 +92,6 @@ async def check( return cls(pipeline_response, deserialized, {}) return deserialized + check.metadata = {'url': '/providers/Microsoft.Network/checkFrontDoorNameAvailability'} # type: ignore + diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_door_name_availability_with_subscription_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_door_name_availability_with_subscription_operations.py index e72ded6a7d4b5..2f1baa75a5622 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_door_name_availability_with_subscription_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_door_name_availability_with_subscription_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._front_door_name_availability_with_subscription_operations import build_check_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,15 +44,17 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check( self, check_front_door_name_availability_input: "_models.CheckNameAvailabilityInput", - **kwargs + **kwargs: Any ) -> "_models.CheckNameAvailabilityOutput": """Check the availability of a Front Door subdomain. :param check_front_door_name_availability_input: Input to check. - :type check_front_door_name_availability_input: ~azure.mgmt.frontdoor.models.CheckNameAvailabilityInput + :type check_front_door_name_availability_input: + ~azure.mgmt.frontdoor.models.CheckNameAvailabilityInput :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput, or the result of cls(response) :rtype: ~azure.mgmt.frontdoor.models.CheckNameAvailabilityOutput @@ -59,36 +65,26 @@ async def check( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_front_door_name_availability_input, 'CheckNameAvailabilityInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(check_front_door_name_availability_input, 'CheckNameAvailabilityInput') - 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) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) @@ -97,4 +93,6 @@ async def check( return cls(pipeline_response, deserialized, {}) return deserialized + check.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability'} # type: ignore + diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_doors_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_doors_operations.py index bc68952221690..fa9b7d9d4205b 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_doors_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_front_doors_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._front_doors_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_validate_custom_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,15 +48,17 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.FrontDoorListResult"]: """Lists all of the Front Doors within an Azure subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FrontDoorListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.FrontDoorListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.FrontDoorListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FrontDoorListResult"] @@ -59,34 +66,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FrontDoorListResult', pipeline_response) + deserialized = self._deserialize("FrontDoorListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,21 +101,23 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/frontDoors'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.FrontDoorListResult"]: """Lists all of the Front Doors within a resource group under a subscription. @@ -121,7 +125,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FrontDoorListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.FrontDoorListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.FrontDoorListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FrontDoorListResult"] @@ -129,35 +134,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FrontDoorListResult', pipeline_response) + deserialized = self._deserialize("FrontDoorListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -170,22 +171,24 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, front_door_name: str, - **kwargs + **kwargs: Any ) -> "_models.FrontDoor": """Gets a Front Door with the specified Front Door name under the specified subscription and resource group. @@ -204,33 +207,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FrontDoor', pipeline_response) @@ -239,53 +232,44 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, front_door_name: str, front_door_parameters: "_models.FrontDoor", - **kwargs + **kwargs: Any ) -> "_models.FrontDoor": cls = kwargs.pop('cls', None) # type: ClsType["_models.FrontDoor"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(front_door_parameters, 'FrontDoor') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(front_door_parameters, 'FrontDoor') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('FrontDoor', pipeline_response) @@ -300,14 +284,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, front_door_name: str, front_door_parameters: "_models.FrontDoor", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.FrontDoor"]: """Creates a new Front Door with a Front Door name under the specified subscription and resource group. @@ -320,15 +307,19 @@ async def begin_create_or_update( :type front_door_parameters: ~azure.mgmt.frontdoor.models.FrontDoor :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FrontDoor or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FrontDoor or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.frontdoor.models.FrontDoor] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FrontDoor"] lro_delay = kwargs.pop( 'polling_interval', @@ -340,27 +331,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, front_door_name=front_door_name, front_door_parameters=front_door_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FrontDoor', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -372,58 +357,50 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'} # type: ignore async def _delete_initial( self, resource_group_name: str, front_door_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, front_door_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing Front Door with the specified parameters. @@ -433,15 +410,17 @@ async def begin_delete( :type front_door_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -455,21 +434,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -481,14 +453,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'} # type: ignore + @distributed_trace_async async def validate_custom_domain( self, resource_group_name: str, front_door_name: str, custom_domain_properties: "_models.ValidateCustomDomainInput", - **kwargs + **kwargs: Any ) -> "_models.ValidateCustomDomainOutput": """Validates the custom domain mapping to ensure it maps to the correct Front Door endpoint in DNS. @@ -509,38 +483,28 @@ async def validate_custom_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_custom_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_validate_custom_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + content_type=content_type, + json=_json, + template_url=self.validate_custom_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') - 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) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ValidateCustomDomainOutput', pipeline_response) @@ -549,4 +513,6 @@ async def validate_custom_domain( return cls(pipeline_response, deserialized, {}) return deserialized + validate_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/validateCustomDomain'} # type: ignore + diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_frontend_endpoints_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_frontend_endpoints_operations.py index c337c814d3d08..5137991d5f624 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_frontend_endpoints_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_frontend_endpoints_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._frontend_endpoints_operations import build_disable_https_request_initial, build_enable_https_request_initial, build_get_request, build_list_by_front_door_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_front_door( self, resource_group_name: str, front_door_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.FrontendEndpointsListResult"]: """Lists all of the frontend endpoints within a Front Door. @@ -56,8 +62,10 @@ def list_by_front_door( :param front_door_name: Name of the Front Door which is globally unique. :type front_door_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FrontendEndpointsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.FrontendEndpointsListResult] + :return: An iterator like instance of either FrontendEndpointsListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.FrontendEndpointsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FrontendEndpointsListResult"] @@ -65,36 +73,33 @@ def list_by_front_door( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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_front_door.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_front_door_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=self.list_by_front_door.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_front_door_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FrontendEndpointsListResult', pipeline_response) + deserialized = self._deserialize("FrontendEndpointsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,23 +112,25 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_front_door.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, front_door_name: str, frontend_endpoint_name: str, - **kwargs + **kwargs: Any ) -> "_models.FrontendEndpoint": """Gets a Frontend endpoint with the specified name within the specified Front Door. @@ -144,34 +151,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'frontendEndpointName': self._serialize.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + frontend_endpoint_name=frontend_endpoint_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FrontendEndpoint', pipeline_response) @@ -180,68 +177,61 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}'} # type: ignore + async def _enable_https_initial( self, resource_group_name: str, front_door_name: str, frontend_endpoint_name: str, custom_https_configuration: "_models.CustomHttpsConfiguration", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._enable_https_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'frontendEndpointName': self._serialize.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(custom_https_configuration, 'CustomHttpsConfiguration') + + request = build_enable_https_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + frontend_endpoint_name=frontend_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._enable_https_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(custom_https_configuration, 'CustomHttpsConfiguration') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _enable_https_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/enableHttps'} # type: ignore + + @distributed_trace_async async def begin_enable_https( self, resource_group_name: str, front_door_name: str, frontend_endpoint_name: str, custom_https_configuration: "_models.CustomHttpsConfiguration", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Enables a frontendEndpoint for HTTPS traffic. @@ -256,15 +246,18 @@ async def begin_enable_https( :type custom_https_configuration: ~azure.mgmt.frontdoor.models.CustomHttpsConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -277,25 +270,18 @@ async def begin_enable_https( front_door_name=front_door_name, frontend_endpoint_name=frontend_endpoint_name, custom_https_configuration=custom_https_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'frontendEndpointName': self._serialize.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -307,6 +293,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_enable_https.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/enableHttps'} # type: ignore async def _disable_https_initial( @@ -314,54 +301,45 @@ async def _disable_https_initial( resource_group_name: str, front_door_name: str, frontend_endpoint_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self._disable_https_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'frontendEndpointName': self._serialize.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_https_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + frontend_endpoint_name=frontend_endpoint_name, + template_url=self._disable_https_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _disable_https_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/disableHttps'} # type: ignore + + @distributed_trace_async async def begin_disable_https( self, resource_group_name: str, front_door_name: str, frontend_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Disables a frontendEndpoint for HTTPS traffic. @@ -374,15 +352,17 @@ async def begin_disable_https( :type frontend_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -397,22 +377,14 @@ async def begin_disable_https( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'frontendEndpointName': self._serialize.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -424,4 +396,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_disable_https.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/disableHttps'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_managed_rule_sets_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_managed_rule_sets_operations.py index d682ff45f7836..a650236cf6351 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_managed_rule_sets_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_managed_rule_sets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._managed_rule_sets_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,15 +46,18 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ManagedRuleSetDefinitionList"]: """Lists all available managed rule sets. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedRuleSetDefinitionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.ManagedRuleSetDefinitionList] + :return: An iterator like instance of either ManagedRuleSetDefinitionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.ManagedRuleSetDefinitionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedRuleSetDefinitionList"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-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.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedRuleSetDefinitionList', pipeline_response) + deserialized = self._deserialize("ManagedRuleSetDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,12 +100,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_network_experiment_profiles_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_network_experiment_profiles_operations.py index ea3bea371bd05..1f7faf85620cb 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_network_experiment_profiles_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_network_experiment_profiles_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._network_experiment_profiles_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,9 +48,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ProfileList"]: """Gets a list of Network Experiment Profiles under a subscription. @@ -61,34 +67,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProfileList', pipeline_response) + deserialized = self._deserialize("ProfileList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,21 +102,23 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/NetworkExperimentProfiles'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ProfileList"]: """Gets a list of Network Experiment Profiles within a resource group under a subscription. @@ -133,35 +136,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProfileList', pipeline_response) + deserialized = self._deserialize("ProfileList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,22 +173,24 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> "_models.Profile": """Gets an NetworkExperiment Profile by ProfileName. @@ -209,33 +210,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Profile', pipeline_response) @@ -244,53 +235,44 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore + async def _create_or_update_initial( self, profile_name: str, resource_group_name: str, parameters: "_models.Profile", - **kwargs + **kwargs: Any ) -> "_models.Profile": 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 = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Profile') + + request = build_create_or_update_request_initial( + profile_name=profile_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Profile', pipeline_response) @@ -305,14 +287,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, profile_name: str, resource_group_name: str, parameters: "_models.Profile", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Profile"]: """Creates an NetworkExperiment Profile. @@ -326,15 +311,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.frontdoor.models.Profile :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Profile or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Profile or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.frontdoor.models.Profile] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,27 +335,21 @@ async def begin_create_or_update( profile_name=profile_name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Profile', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -378,6 +361,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore async def _update_initial( @@ -385,46 +369,35 @@ async def _update_initial( resource_group_name: str, profile_name: str, parameters: "_models.ProfileUpdateModel", - **kwargs + **kwargs: Any ) -> "_models.Profile": 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 = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ProfileUpdateModel') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ProfileUpdateModel') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Profile', pipeline_response) @@ -436,14 +409,17 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, profile_name: str, parameters: "_models.ProfileUpdateModel", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Profile"]: """Updates an NetworkExperimentProfiles by NetworkExperimentProfile name. @@ -457,15 +433,19 @@ async def begin_update( :type parameters: ~azure.mgmt.frontdoor.models.ProfileUpdateModel :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Profile or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Profile or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.frontdoor.models.Profile] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,27 +457,21 @@ async def begin_update( resource_group_name=resource_group_name, profile_name=profile_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Profile', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -509,58 +483,50 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore async def _delete_initial( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an NetworkExperiment Profile by ProfileName. @@ -572,15 +538,17 @@ async def begin_delete( :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -594,21 +562,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -620,4 +581,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_policies_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_policies_operations.py index 0d3644f729864..57c2a8a1fa284 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_policies_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_policies_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._policies_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,18 +48,21 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.WebApplicationFirewallPolicyList"]: """Lists all of the protection policies within a resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. :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 WebApplicationFirewallPolicyList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicyList] + :return: An iterator like instance of either WebApplicationFirewallPolicyList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicyList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebApplicationFirewallPolicyList"] @@ -62,35 +70,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-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.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WebApplicationFirewallPolicyList', pipeline_response) + deserialized = self._deserialize("WebApplicationFirewallPolicyList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,22 +107,24 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, policy_name: str, - **kwargs + **kwargs: Any ) -> "_models.WebApplicationFirewallPolicy": """Retrieve protection policy with specified name within a resource group. @@ -136,33 +142,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128, min_length=0), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + policy_name=policy_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WebApplicationFirewallPolicy', pipeline_response) @@ -171,53 +167,44 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, policy_name: str, parameters: "_models.WebApplicationFirewallPolicy", - **kwargs + **kwargs: Any ) -> "_models.WebApplicationFirewallPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.WebApplicationFirewallPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128, min_length=0), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'WebApplicationFirewallPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + policy_name=policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'WebApplicationFirewallPolicy') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('WebApplicationFirewallPolicy', pipeline_response) @@ -232,14 +219,17 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, policy_name: str, parameters: "_models.WebApplicationFirewallPolicy", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.WebApplicationFirewallPolicy"]: """Create or update policy with specified rule set name within a resource group. @@ -251,15 +241,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicy :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WebApplicationFirewallPolicy or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WebApplicationFirewallPolicy or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicy] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WebApplicationFirewallPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,27 +266,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, policy_name=policy_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('WebApplicationFirewallPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128, min_length=0), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -303,38 +292,31 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'} # type: ignore async def _delete_initial( self, resource_group_name: str, policy_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128, min_length=0), - '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] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + policy_name=policy_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -347,11 +329,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, policy_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes Policy. @@ -361,15 +345,17 @@ async def begin_delete( :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -383,21 +369,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128, min_length=0), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -409,4 +388,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_preconfigured_endpoints_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_preconfigured_endpoints_operations.py index 365e002a207bf..f55d117e94317 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_preconfigured_endpoints_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_preconfigured_endpoints_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._preconfigured_endpoints_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,11 +46,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PreconfiguredEndpointList"]: """Gets a list of Preconfigured Endpoints. @@ -56,8 +62,10 @@ def list( :param profile_name: The Profile identifier associated with the Tenant and Partner. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PreconfiguredEndpointList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.PreconfiguredEndpointList] + :return: An iterator like instance of either PreconfiguredEndpointList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.PreconfiguredEndpointList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PreconfiguredEndpointList"] @@ -65,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PreconfiguredEndpointList', pipeline_response) + deserialized = self._deserialize("PreconfiguredEndpointList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,12 +112,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_reports_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_reports_operations.py index fa4398afee31c..840538d82e338 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_reports_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_reports_operations.py @@ -6,16 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._reports_operations import build_get_latency_scorecards_request, build_get_timeseries_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_latency_scorecards( self, resource_group_name: str, @@ -49,7 +54,7 @@ async def get_latency_scorecards( aggregation_interval: Union[str, "_models.LatencyScorecardAggregationInterval"], end_date_time_utc: Optional[str] = None, country: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.LatencyScorecard": """Gets a Latency Scorecard for a given Experiment. @@ -62,7 +67,8 @@ async def get_latency_scorecards( :param experiment_name: The Experiment identifier associated with the Experiment. :type experiment_name: str :param aggregation_interval: The aggregation interval of the Latency Scorecard. - :type aggregation_interval: str or ~azure.mgmt.frontdoor.models.LatencyScorecardAggregationInterval + :type aggregation_interval: str or + ~azure.mgmt.frontdoor.models.LatencyScorecardAggregationInterval :param end_date_time_utc: The end DateTime of the Latency Scorecard in UTC. :type end_date_time_utc: str :param country: The country associated with the Latency Scorecard. Values are country ISO codes @@ -78,39 +84,27 @@ async def get_latency_scorecards( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get_latency_scorecards.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if end_date_time_utc is not None: - query_parameters['endDateTimeUTC'] = self._serialize.query("end_date_time_utc", end_date_time_utc, 'str') - if country is not None: - query_parameters['country'] = self._serialize.query("country", country, 'str') - query_parameters['aggregationInterval'] = self._serialize.query("aggregation_interval", aggregation_interval, '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) + + + request = build_get_latency_scorecards_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + aggregation_interval=aggregation_interval, + end_date_time_utc=end_date_time_utc, + country=country, + template_url=self.get_latency_scorecards.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LatencyScorecard', pipeline_response) @@ -119,8 +113,11 @@ async def get_latency_scorecards( return cls(pipeline_response, deserialized, {}) return deserialized + get_latency_scorecards.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/LatencyScorecard'} # type: ignore + + @distributed_trace_async async def get_timeseries( self, resource_group_name: str, @@ -132,7 +129,7 @@ async def get_timeseries( timeseries_type: Union[str, "_models.TimeseriesType"], endpoint: Optional[str] = None, country: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.Timeseries": """Gets a Timeseries for a given Experiment. @@ -167,42 +164,30 @@ async def get_timeseries( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get_timeseries.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['startDateTimeUTC'] = self._serialize.query("start_date_time_utc", start_date_time_utc, 'iso-8601') - query_parameters['endDateTimeUTC'] = self._serialize.query("end_date_time_utc", end_date_time_utc, 'iso-8601') - query_parameters['aggregationInterval'] = self._serialize.query("aggregation_interval", aggregation_interval, 'str') - query_parameters['timeseriesType'] = self._serialize.query("timeseries_type", timeseries_type, 'str') - if endpoint is not None: - query_parameters['endpoint'] = self._serialize.query("endpoint", endpoint, 'str') - if country is not None: - query_parameters['country'] = self._serialize.query("country", country, '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) + + + request = build_get_timeseries_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + start_date_time_utc=start_date_time_utc, + end_date_time_utc=end_date_time_utc, + aggregation_interval=aggregation_interval, + timeseries_type=timeseries_type, + endpoint=endpoint, + country=country, + template_url=self.get_timeseries.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Timeseries', pipeline_response) @@ -211,4 +196,6 @@ async def get_timeseries( return cls(pipeline_response, deserialized, {}) return deserialized + get_timeseries.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/Timeseries'} # type: ignore + diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_rules_engines_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_rules_engines_operations.py index 3718b619f23d7..bbac22ea89921 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_rules_engines_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/aio/operations/_rules_engines_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._rules_engines_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_front_door_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_front_door( self, resource_group_name: str, front_door_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RulesEngineListResult"]: """Lists all of the Rules Engine Configurations within a Front Door. @@ -56,8 +62,10 @@ def list_by_front_door( :param front_door_name: Name of the Front Door which is globally unique. :type front_door_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RulesEngineListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.RulesEngineListResult] + :return: An iterator like instance of either RulesEngineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.frontdoor.models.RulesEngineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RulesEngineListResult"] @@ -65,36 +73,33 @@ def list_by_front_door( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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_front_door.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_front_door_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=self.list_by_front_door.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_front_door_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RulesEngineListResult', pipeline_response) + deserialized = self._deserialize("RulesEngineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,23 +112,25 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_front_door.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, front_door_name: str, rules_engine_name: str, - **kwargs + **kwargs: Any ) -> "_models.RulesEngine": """Gets a Rules Engine Configuration with the specified name within the specified Front Door. @@ -143,34 +150,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'rulesEngineName': self._serialize.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + rules_engine_name=rules_engine_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RulesEngine', pipeline_response) @@ -179,55 +176,46 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, front_door_name: str, rules_engine_name: str, rules_engine_parameters: "_models.RulesEngine", - **kwargs + **kwargs: Any ) -> "_models.RulesEngine": cls = kwargs.pop('cls', None) # type: ClsType["_models.RulesEngine"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'rulesEngineName': self._serialize.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(rules_engine_parameters, 'RulesEngine') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + rules_engine_name=rules_engine_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(rules_engine_parameters, 'RulesEngine') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('RulesEngine', pipeline_response) @@ -242,15 +230,18 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, front_door_name: str, rules_engine_name: str, rules_engine_parameters: "_models.RulesEngine", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.RulesEngine"]: """Creates a new Rules Engine Configuration with the specified name within the specified Front Door. @@ -266,15 +257,19 @@ async def begin_create_or_update( :type rules_engine_parameters: ~azure.mgmt.frontdoor.models.RulesEngine :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RulesEngine or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RulesEngine or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.frontdoor.models.RulesEngine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RulesEngine"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +282,21 @@ async def begin_create_or_update( front_door_name=front_door_name, rules_engine_name=rules_engine_name, rules_engine_parameters=rules_engine_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RulesEngine', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'rulesEngineName': self._serialize.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -320,6 +308,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}'} # type: ignore async def _delete_initial( @@ -327,54 +316,45 @@ async def _delete_initial( resource_group_name: str, front_door_name: str, rules_engine_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'rulesEngineName': self._serialize.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + rules_engine_name=rules_engine_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, front_door_name: str, rules_engine_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing Rules Engine Configuration with the specified parameters. @@ -386,15 +366,17 @@ async def begin_delete( :type rules_engine_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -409,22 +391,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'rulesEngineName': self._serialize.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -436,4 +410,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/__init__.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/__init__.py index 8b3787e077a08..9cf83bea2753f 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/__init__.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/__init__.py @@ -6,180 +6,93 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AzureAsyncOperationResult - from ._models_py3 import Backend - from ._models_py3 import BackendPool - from ._models_py3 import BackendPoolListResult - from ._models_py3 import BackendPoolProperties - from ._models_py3 import BackendPoolUpdateParameters - from ._models_py3 import BackendPoolsSettings - from ._models_py3 import CacheConfiguration - from ._models_py3 import CheckNameAvailabilityInput - from ._models_py3 import CheckNameAvailabilityOutput - from ._models_py3 import CustomHttpsConfiguration - from ._models_py3 import CustomRule - from ._models_py3 import CustomRuleList - from ._models_py3 import Endpoint - from ._models_py3 import Error - from ._models_py3 import ErrorDetails - from ._models_py3 import ErrorResponse - from ._models_py3 import Experiment - from ._models_py3 import ExperimentList - from ._models_py3 import ExperimentUpdateModel - from ._models_py3 import ForwardingConfiguration - from ._models_py3 import FrontDoor - from ._models_py3 import FrontDoorListResult - from ._models_py3 import FrontDoorProperties - from ._models_py3 import FrontDoorUpdateParameters - from ._models_py3 import FrontendEndpoint - from ._models_py3 import FrontendEndpointLink - from ._models_py3 import FrontendEndpointProperties - from ._models_py3 import FrontendEndpointUpdateParameters - from ._models_py3 import FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink - from ._models_py3 import FrontendEndpointsListResult - from ._models_py3 import HeaderAction - from ._models_py3 import HealthProbeSettingsListResult - from ._models_py3 import HealthProbeSettingsModel - from ._models_py3 import HealthProbeSettingsProperties - from ._models_py3 import HealthProbeSettingsUpdateParameters - from ._models_py3 import KeyVaultCertificateSourceParametersVault - from ._models_py3 import LatencyMetric - from ._models_py3 import LatencyScorecard - from ._models_py3 import LoadBalancingSettingsListResult - from ._models_py3 import LoadBalancingSettingsModel - from ._models_py3 import LoadBalancingSettingsProperties - from ._models_py3 import LoadBalancingSettingsUpdateParameters - from ._models_py3 import ManagedRuleDefinition - from ._models_py3 import ManagedRuleExclusion - from ._models_py3 import ManagedRuleGroupDefinition - from ._models_py3 import ManagedRuleGroupOverride - from ._models_py3 import ManagedRuleOverride - from ._models_py3 import ManagedRuleSet - from ._models_py3 import ManagedRuleSetDefinition - from ._models_py3 import ManagedRuleSetDefinitionList - from ._models_py3 import ManagedRuleSetList - from ._models_py3 import MatchCondition - from ._models_py3 import PolicySettings - from ._models_py3 import PreconfiguredEndpoint - from ._models_py3 import PreconfiguredEndpointList - from ._models_py3 import Profile - from ._models_py3 import ProfileList - from ._models_py3 import ProfileUpdateModel - from ._models_py3 import PurgeParameters - from ._models_py3 import RedirectConfiguration - from ._models_py3 import Resource - from ._models_py3 import RouteConfiguration - from ._models_py3 import RoutingRule - from ._models_py3 import RoutingRuleLink - from ._models_py3 import RoutingRuleListResult - from ._models_py3 import RoutingRuleProperties - from ._models_py3 import RoutingRuleUpdateParameters - from ._models_py3 import RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink - from ._models_py3 import RulesEngine - from ._models_py3 import RulesEngineAction - from ._models_py3 import RulesEngineListResult - from ._models_py3 import RulesEngineMatchCondition - from ._models_py3 import RulesEngineProperties - from ._models_py3 import RulesEngineRule - from ._models_py3 import RulesEngineUpdateParameters - from ._models_py3 import SecurityPolicyLink - from ._models_py3 import Sku - from ._models_py3 import SubResource - from ._models_py3 import TagsObject - from ._models_py3 import Timeseries - from ._models_py3 import TimeseriesDataPoint - from ._models_py3 import ValidateCustomDomainInput - from ._models_py3 import ValidateCustomDomainOutput - from ._models_py3 import WebApplicationFirewallPolicy - from ._models_py3 import WebApplicationFirewallPolicyList -except (SyntaxError, ImportError): - from ._models import AzureAsyncOperationResult # type: ignore - from ._models import Backend # type: ignore - from ._models import BackendPool # type: ignore - from ._models import BackendPoolListResult # type: ignore - from ._models import BackendPoolProperties # type: ignore - from ._models import BackendPoolUpdateParameters # type: ignore - from ._models import BackendPoolsSettings # type: ignore - from ._models import CacheConfiguration # type: ignore - from ._models import CheckNameAvailabilityInput # type: ignore - from ._models import CheckNameAvailabilityOutput # type: ignore - from ._models import CustomHttpsConfiguration # type: ignore - from ._models import CustomRule # type: ignore - from ._models import CustomRuleList # type: ignore - from ._models import Endpoint # type: ignore - from ._models import Error # type: ignore - from ._models import ErrorDetails # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Experiment # type: ignore - from ._models import ExperimentList # type: ignore - from ._models import ExperimentUpdateModel # type: ignore - from ._models import ForwardingConfiguration # type: ignore - from ._models import FrontDoor # type: ignore - from ._models import FrontDoorListResult # type: ignore - from ._models import FrontDoorProperties # type: ignore - from ._models import FrontDoorUpdateParameters # type: ignore - from ._models import FrontendEndpoint # type: ignore - from ._models import FrontendEndpointLink # type: ignore - from ._models import FrontendEndpointProperties # type: ignore - from ._models import FrontendEndpointUpdateParameters # type: ignore - from ._models import FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink # type: ignore - from ._models import FrontendEndpointsListResult # type: ignore - from ._models import HeaderAction # type: ignore - from ._models import HealthProbeSettingsListResult # type: ignore - from ._models import HealthProbeSettingsModel # type: ignore - from ._models import HealthProbeSettingsProperties # type: ignore - from ._models import HealthProbeSettingsUpdateParameters # type: ignore - from ._models import KeyVaultCertificateSourceParametersVault # type: ignore - from ._models import LatencyMetric # type: ignore - from ._models import LatencyScorecard # type: ignore - from ._models import LoadBalancingSettingsListResult # type: ignore - from ._models import LoadBalancingSettingsModel # type: ignore - from ._models import LoadBalancingSettingsProperties # type: ignore - from ._models import LoadBalancingSettingsUpdateParameters # type: ignore - from ._models import ManagedRuleDefinition # type: ignore - from ._models import ManagedRuleExclusion # type: ignore - from ._models import ManagedRuleGroupDefinition # type: ignore - from ._models import ManagedRuleGroupOverride # type: ignore - from ._models import ManagedRuleOverride # type: ignore - from ._models import ManagedRuleSet # type: ignore - from ._models import ManagedRuleSetDefinition # type: ignore - from ._models import ManagedRuleSetDefinitionList # type: ignore - from ._models import ManagedRuleSetList # type: ignore - from ._models import MatchCondition # type: ignore - from ._models import PolicySettings # type: ignore - from ._models import PreconfiguredEndpoint # type: ignore - from ._models import PreconfiguredEndpointList # type: ignore - from ._models import Profile # type: ignore - from ._models import ProfileList # type: ignore - from ._models import ProfileUpdateModel # type: ignore - from ._models import PurgeParameters # type: ignore - from ._models import RedirectConfiguration # type: ignore - from ._models import Resource # type: ignore - from ._models import RouteConfiguration # type: ignore - from ._models import RoutingRule # type: ignore - from ._models import RoutingRuleLink # type: ignore - from ._models import RoutingRuleListResult # type: ignore - from ._models import RoutingRuleProperties # type: ignore - from ._models import RoutingRuleUpdateParameters # type: ignore - from ._models import RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink # type: ignore - from ._models import RulesEngine # type: ignore - from ._models import RulesEngineAction # type: ignore - from ._models import RulesEngineListResult # type: ignore - from ._models import RulesEngineMatchCondition # type: ignore - from ._models import RulesEngineProperties # type: ignore - from ._models import RulesEngineRule # type: ignore - from ._models import RulesEngineUpdateParameters # type: ignore - from ._models import SecurityPolicyLink # type: ignore - from ._models import Sku # type: ignore - from ._models import SubResource # type: ignore - from ._models import TagsObject # type: ignore - from ._models import Timeseries # type: ignore - from ._models import TimeseriesDataPoint # type: ignore - from ._models import ValidateCustomDomainInput # type: ignore - from ._models import ValidateCustomDomainOutput # type: ignore - from ._models import WebApplicationFirewallPolicy # type: ignore - from ._models import WebApplicationFirewallPolicyList # type: ignore +from ._models_py3 import AzureAsyncOperationResult +from ._models_py3 import Backend +from ._models_py3 import BackendPool +from ._models_py3 import BackendPoolListResult +from ._models_py3 import BackendPoolProperties +from ._models_py3 import BackendPoolUpdateParameters +from ._models_py3 import BackendPoolsSettings +from ._models_py3 import CacheConfiguration +from ._models_py3 import CheckNameAvailabilityInput +from ._models_py3 import CheckNameAvailabilityOutput +from ._models_py3 import CustomHttpsConfiguration +from ._models_py3 import CustomRule +from ._models_py3 import CustomRuleList +from ._models_py3 import Endpoint +from ._models_py3 import Error +from ._models_py3 import ErrorDetails +from ._models_py3 import ErrorResponse +from ._models_py3 import Experiment +from ._models_py3 import ExperimentList +from ._models_py3 import ExperimentUpdateModel +from ._models_py3 import ForwardingConfiguration +from ._models_py3 import FrontDoor +from ._models_py3 import FrontDoorListResult +from ._models_py3 import FrontDoorProperties +from ._models_py3 import FrontDoorUpdateParameters +from ._models_py3 import FrontendEndpoint +from ._models_py3 import FrontendEndpointLink +from ._models_py3 import FrontendEndpointProperties +from ._models_py3 import FrontendEndpointUpdateParameters +from ._models_py3 import FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink +from ._models_py3 import FrontendEndpointsListResult +from ._models_py3 import HeaderAction +from ._models_py3 import HealthProbeSettingsListResult +from ._models_py3 import HealthProbeSettingsModel +from ._models_py3 import HealthProbeSettingsProperties +from ._models_py3 import HealthProbeSettingsUpdateParameters +from ._models_py3 import KeyVaultCertificateSourceParametersVault +from ._models_py3 import LatencyMetric +from ._models_py3 import LatencyScorecard +from ._models_py3 import LoadBalancingSettingsListResult +from ._models_py3 import LoadBalancingSettingsModel +from ._models_py3 import LoadBalancingSettingsProperties +from ._models_py3 import LoadBalancingSettingsUpdateParameters +from ._models_py3 import ManagedRuleDefinition +from ._models_py3 import ManagedRuleExclusion +from ._models_py3 import ManagedRuleGroupDefinition +from ._models_py3 import ManagedRuleGroupOverride +from ._models_py3 import ManagedRuleOverride +from ._models_py3 import ManagedRuleSet +from ._models_py3 import ManagedRuleSetDefinition +from ._models_py3 import ManagedRuleSetDefinitionList +from ._models_py3 import ManagedRuleSetList +from ._models_py3 import MatchCondition +from ._models_py3 import PolicySettings +from ._models_py3 import PreconfiguredEndpoint +from ._models_py3 import PreconfiguredEndpointList +from ._models_py3 import Profile +from ._models_py3 import ProfileList +from ._models_py3 import ProfileUpdateModel +from ._models_py3 import PurgeParameters +from ._models_py3 import RedirectConfiguration +from ._models_py3 import Resource +from ._models_py3 import RouteConfiguration +from ._models_py3 import RoutingRule +from ._models_py3 import RoutingRuleLink +from ._models_py3 import RoutingRuleListResult +from ._models_py3 import RoutingRuleProperties +from ._models_py3 import RoutingRuleUpdateParameters +from ._models_py3 import RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink +from ._models_py3 import RulesEngine +from ._models_py3 import RulesEngineAction +from ._models_py3 import RulesEngineListResult +from ._models_py3 import RulesEngineMatchCondition +from ._models_py3 import RulesEngineProperties +from ._models_py3 import RulesEngineRule +from ._models_py3 import RulesEngineUpdateParameters +from ._models_py3 import SecurityPolicyLink +from ._models_py3 import Sku +from ._models_py3 import SubResource +from ._models_py3 import TagsObject +from ._models_py3 import Timeseries +from ._models_py3 import TimeseriesDataPoint +from ._models_py3 import ValidateCustomDomainInput +from ._models_py3 import ValidateCustomDomainOutput +from ._models_py3 import WebApplicationFirewallPolicy +from ._models_py3 import WebApplicationFirewallPolicyList + from ._front_door_management_client_enums import ( ActionType, diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_front_door_management_client_enums.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_front_door_management_client_enums.py index 9c9b19ade63c0..fbfaeef404a77 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_front_door_management_client_enums.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_front_door_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines the action to take on rule match. """ @@ -35,28 +20,28 @@ class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LOG = "Log" REDIRECT = "Redirect" -class AggregationInterval(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AggregationInterval(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The aggregation interval of the Timeseries """ HOURLY = "Hourly" DAILY = "Daily" -class Availability(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Availability(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether the name is available. """ AVAILABLE = "Available" UNAVAILABLE = "Unavailable" -class BackendEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BackendEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to enable use of this backend. Permitted values are 'Enabled' or 'Disabled' """ ENABLED = "Enabled" DISABLED = "Disabled" -class CustomHttpsProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CustomHttpsProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning status of Custom Https of the frontendEndpoint. """ @@ -66,7 +51,7 @@ class CustomHttpsProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, DISABLED = "Disabled" FAILED = "Failed" -class CustomHttpsProvisioningSubstate(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CustomHttpsProvisioningSubstate(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. """ @@ -82,7 +67,7 @@ class CustomHttpsProvisioningSubstate(with_metaclass(_CaseInsensitiveEnumMeta, s DELETING_CERTIFICATE = "DeletingCertificate" CERTIFICATE_DELETED = "CertificateDeleted" -class CustomRuleEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CustomRuleEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. """ @@ -90,14 +75,14 @@ class CustomRuleEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) DISABLED = "Disabled" ENABLED = "Enabled" -class DynamicCompressionEnabled(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DynamicCompressionEnabled(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to use dynamic compression for cached content """ ENABLED = "Enabled" DISABLED = "Disabled" -class EndpointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EndpointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of endpoint """ @@ -106,7 +91,7 @@ class EndpointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CDN = "CDN" ATM = "ATM" -class EnforceCertificateNameCheckEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EnforceCertificateNameCheckEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to enforce certificate name check on HTTPS requests to all backend pools. No effect on non-HTTPS requests. """ @@ -114,20 +99,20 @@ class EnforceCertificateNameCheckEnabledState(with_metaclass(_CaseInsensitiveEnu ENABLED = "Enabled" DISABLED = "Disabled" -class FrontDoorCertificateSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorCertificateSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines the source of the SSL certificate """ AZURE_KEY_VAULT = "AzureKeyVault" FRONT_DOOR = "FrontDoor" -class FrontDoorCertificateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorCertificateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines the type of the certificate used for secure connections to a frontendEndpoint """ DEDICATED = "Dedicated" -class FrontDoorEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Operational status of the Front Door load balancer. Permitted values are 'Enabled' or 'Disabled' """ @@ -135,7 +120,7 @@ class FrontDoorEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) ENABLED = "Enabled" DISABLED = "Disabled" -class FrontDoorForwardingProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorForwardingProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Protocol this rule will use when forwarding traffic to backends. """ @@ -143,21 +128,21 @@ class FrontDoorForwardingProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, HTTPS_ONLY = "HttpsOnly" MATCH_REQUEST = "MatchRequest" -class FrontDoorHealthProbeMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorHealthProbeMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Configures which HTTP method to use to probe the backends defined under backendPools. """ GET = "GET" HEAD = "HEAD" -class FrontDoorProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Accepted protocol schemes. """ HTTP = "Http" HTTPS = "Https" -class FrontDoorQuery(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorQuery(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Treatment of URL query terms when forming the cache key. """ @@ -166,7 +151,7 @@ class FrontDoorQuery(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STRIP_ONLY = "StripOnly" STRIP_ALL_EXCEPT = "StripAllExcept" -class FrontDoorRedirectProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorRedirectProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The protocol of the destination to where the traffic is redirected """ @@ -174,7 +159,7 @@ class FrontDoorRedirectProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, En HTTPS_ONLY = "HttpsOnly" MATCH_REQUEST = "MatchRequest" -class FrontDoorRedirectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorRedirectType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The redirect type the rule will use when redirecting traffic. """ @@ -183,7 +168,7 @@ class FrontDoorRedirectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) TEMPORARY_REDIRECT = "TemporaryRedirect" PERMANENT_REDIRECT = "PermanentRedirect" -class FrontDoorResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource status of the Front Door or Front Door SubResource. """ @@ -194,13 +179,13 @@ class FrontDoorResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) DISABLED = "Disabled" DELETING = "Deleting" -class FrontDoorTlsProtocolType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FrontDoorTlsProtocolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines the TLS extension protocol that is used for secure delivery """ SERVER_NAME_INDICATION = "ServerNameIndication" -class HeaderActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HeaderActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Which type of manipulation to apply to the header. """ @@ -208,7 +193,7 @@ class HeaderActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETE = "Delete" OVERWRITE = "Overwrite" -class HealthProbeEnabled(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HealthProbeEnabled(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. @@ -217,20 +202,20 @@ class HealthProbeEnabled(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class LatencyScorecardAggregationInterval(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LatencyScorecardAggregationInterval(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DAILY = "Daily" WEEKLY = "Weekly" MONTHLY = "Monthly" -class ManagedRuleEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedRuleEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes if the managed rule is in enabled or disabled state. """ DISABLED = "Disabled" ENABLED = "Enabled" -class ManagedRuleExclusionMatchVariable(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedRuleExclusionMatchVariable(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The variable type to be excluded. """ @@ -240,7 +225,7 @@ class ManagedRuleExclusionMatchVariable(with_metaclass(_CaseInsensitiveEnumMeta, REQUEST_BODY_POST_ARG_NAMES = "RequestBodyPostArgNames" REQUEST_BODY_JSON_ARG_NAMES = "RequestBodyJsonArgNames" -class ManagedRuleExclusionSelectorMatchOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedRuleExclusionSelectorMatchOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Comparison operator to apply to the selector when specifying which elements in the collection this exclusion applies to. """ @@ -251,7 +236,7 @@ class ManagedRuleExclusionSelectorMatchOperator(with_metaclass(_CaseInsensitiveE ENDS_WITH = "EndsWith" EQUALS_ANY = "EqualsAny" -class ManagedRuleSetActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedRuleSetActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines the action to take when a managed rule set score threshold is met. """ @@ -259,7 +244,7 @@ class ManagedRuleSetActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu LOG = "Log" REDIRECT = "Redirect" -class MatchProcessingBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MatchProcessingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. """ @@ -267,7 +252,7 @@ class MatchProcessingBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CONTINUE_ENUM = "Continue" STOP = "Stop" -class MatchVariable(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MatchVariable(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Request variable to compare with. """ @@ -281,7 +266,7 @@ class MatchVariable(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COOKIES = "Cookies" SOCKET_ADDR = "SocketAddr" -class MinimumTLSVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MinimumTLSVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The minimum TLS version required from the clients to establish an SSL handshake with Front Door. """ @@ -289,7 +274,7 @@ class MinimumTLSVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ONE0 = "1.0" ONE2 = "1.2" -class NetworkExperimentResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkExperimentResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines the server side resource status """ @@ -300,7 +285,7 @@ class NetworkExperimentResourceState(with_metaclass(_CaseInsensitiveEnumMeta, st DISABLED = "Disabled" DELETING = "Deleting" -class NetworkOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkOperationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Azure async operation. Possible values are: 'InProgress', 'Succeeded', and 'Failed'. """ @@ -309,7 +294,7 @@ class NetworkOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SUCCEEDED = "Succeeded" FAILED = "Failed" -class Operator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Operator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Comparison type to use for matching with the variable value. """ @@ -326,28 +311,28 @@ class Operator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENDS_WITH = "EndsWith" REG_EX = "RegEx" -class PolicyEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes if the policy is in enabled or disabled state. Defaults to Enabled if not specified. """ DISABLED = "Disabled" ENABLED = "Enabled" -class PolicyMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes if it is in detection mode or prevention mode at policy level. """ PREVENTION = "Prevention" DETECTION = "Detection" -class PolicyRequestBodyCheck(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyRequestBodyCheck(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes if policy managed rules will inspect the request body content. """ DISABLED = "Disabled" ENABLED = "Enabled" -class PolicyResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource status of the policy. """ @@ -358,7 +343,7 @@ class PolicyResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DISABLED = "Disabled" DELETING = "Deleting" -class PrivateEndpointStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Approval status for the connection to the Private Link """ @@ -368,21 +353,21 @@ class PrivateEndpointStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) DISCONNECTED = "Disconnected" TIMEOUT = "Timeout" -class ResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of Front Door resource used in CheckNameAvailability. """ MICROSOFT_NETWORK_FRONT_DOORS = "Microsoft.Network/frontDoors" MICROSOFT_NETWORK_FRONT_DOORS_FRONTEND_ENDPOINTS = "Microsoft.Network/frontDoors/frontendEndpoints" -class RoutingRuleEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoutingRuleEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled' """ ENABLED = "Enabled" DISABLED = "Disabled" -class RulesEngineMatchVariable(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RulesEngineMatchVariable(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Match Variable """ @@ -399,7 +384,7 @@ class RulesEngineMatchVariable(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu REQUEST_BODY = "RequestBody" REQUEST_SCHEME = "RequestScheme" -class RulesEngineOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RulesEngineOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to apply to the match condition. """ @@ -415,21 +400,21 @@ class RulesEngineOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BEGINS_WITH = "BeginsWith" ENDS_WITH = "EndsWith" -class RuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes type of rule. """ MATCH_RULE = "MatchRule" RATE_LIMIT_RULE = "RateLimitRule" -class SessionAffinityEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SessionAffinityEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled' """ ENABLED = "Enabled" DISABLED = "Disabled" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Name of the pricing tier. """ @@ -437,19 +422,19 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_AZURE_FRONT_DOOR = "Standard_AzureFrontDoor" PREMIUM_AZURE_FRONT_DOOR = "Premium_AzureFrontDoor" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the Experiment """ ENABLED = "Enabled" DISABLED = "Disabled" -class TimeseriesAggregationInterval(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeseriesAggregationInterval(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): HOURLY = "Hourly" DAILY = "Daily" -class TimeseriesType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TimeseriesType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of Timeseries """ @@ -458,7 +443,7 @@ class TimeseriesType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LATENCY_P75 = "LatencyP75" LATENCY_P95 = "LatencyP95" -class Transform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Transform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes what transforms are applied before matching """ @@ -469,7 +454,7 @@ class Transform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): URL_ENCODE = "UrlEncode" REMOVE_NULLS = "RemoveNulls" -class TransformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TransformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes what transforms applied before matching. """ diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_models.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_models.py deleted file mode 100644 index c01fb5be775ad..0000000000000 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_models.py +++ /dev/null @@ -1,3474 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AzureAsyncOperationResult(msrest.serialization.Model): - """The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. - - :param status: Status of the Azure async operation. Possible values are: 'InProgress', - 'Succeeded', and 'Failed'. Possible values include: "InProgress", "Succeeded", "Failed". - :type status: str or ~azure.mgmt.frontdoor.models.NetworkOperationStatus - :param error: - :type error: ~azure.mgmt.frontdoor.models.Error - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureAsyncOperationResult, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.error = kwargs.get('error', None) - - -class Backend(msrest.serialization.Model): - """Backend address of a frontDoor load balancer. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param address: Location of the backend (IP address or FQDN). - :type address: str - :param private_link_alias: The Alias of the Private Link resource. Populating this optional - field indicates that this backend is 'Private'. - :type private_link_alias: str - :param private_link_resource_id: The Resource Id of the Private Link resource. Populating this - optional field indicates that this backend is 'Private'. - :type private_link_resource_id: str - :param private_link_location: The location of the Private Link resource. Required only if - 'privateLinkResourceId' is populated. - :type private_link_location: str - :ivar private_endpoint_status: The Approval status for the connection to the Private Link. - Possible values include: "Pending", "Approved", "Rejected", "Disconnected", "Timeout". - :vartype private_endpoint_status: str or ~azure.mgmt.frontdoor.models.PrivateEndpointStatus - :param private_link_approval_message: A custom message to be included in the approval request - to connect to the Private Link. - :type private_link_approval_message: str - :param http_port: The HTTP TCP port number. Must be between 1 and 65535. - :type http_port: int - :param https_port: The HTTPS TCP port number. Must be between 1 and 65535. - :type https_port: int - :param enabled_state: Whether to enable use of this backend. Permitted values are 'Enabled' or - 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.BackendEnabledState - :param priority: Priority to use for load balancing. Higher priorities will not be used for - load balancing if any lower priority backend is healthy. - :type priority: int - :param weight: Weight of this endpoint for load balancing purposes. - :type weight: int - :param backend_host_header: The value to use as the host header sent to the backend. If blank - or unspecified, this defaults to the incoming host. - :type backend_host_header: str - """ - - _validation = { - 'private_endpoint_status': {'readonly': True}, - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, - } - - _attribute_map = { - 'address': {'key': 'address', 'type': 'str'}, - 'private_link_alias': {'key': 'privateLinkAlias', 'type': 'str'}, - 'private_link_resource_id': {'key': 'privateLinkResourceId', 'type': 'str'}, - 'private_link_location': {'key': 'privateLinkLocation', 'type': 'str'}, - 'private_endpoint_status': {'key': 'privateEndpointStatus', 'type': 'str'}, - 'private_link_approval_message': {'key': 'privateLinkApprovalMessage', 'type': 'str'}, - 'http_port': {'key': 'httpPort', 'type': 'int'}, - 'https_port': {'key': 'httpsPort', 'type': 'int'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'priority': {'key': 'priority', 'type': 'int'}, - 'weight': {'key': 'weight', 'type': 'int'}, - 'backend_host_header': {'key': 'backendHostHeader', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Backend, self).__init__(**kwargs) - self.address = kwargs.get('address', None) - self.private_link_alias = kwargs.get('private_link_alias', None) - self.private_link_resource_id = kwargs.get('private_link_resource_id', None) - self.private_link_location = kwargs.get('private_link_location', None) - self.private_endpoint_status = None - self.private_link_approval_message = kwargs.get('private_link_approval_message', None) - self.http_port = kwargs.get('http_port', None) - self.https_port = kwargs.get('https_port', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.priority = kwargs.get('priority', None) - self.weight = kwargs.get('weight', None) - self.backend_host_header = kwargs.get('backend_host_header', None) - - -class SubResource(msrest.serialization.Model): - """Reference to another subresource. - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubResource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class BackendPool(SubResource): - """A backend pool is a collection of backends that can be routed to. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type id: str - :param name: Resource name. - :type name: str - :ivar type: Resource type. - :vartype type: str - :param backends: The set of backends for this pool. - :type backends: list[~azure.mgmt.frontdoor.models.Backend] - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource - :param health_probe_settings: L7 health probe settings for a backend pool. - :type health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - """ - - _validation = { - 'type': {'readonly': True}, - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'backends': {'key': 'properties.backends', 'type': '[Backend]'}, - 'load_balancing_settings': {'key': 'properties.loadBalancingSettings', 'type': 'SubResource'}, - 'health_probe_settings': {'key': 'properties.healthProbeSettings', 'type': 'SubResource'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BackendPool, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = None - self.backends = kwargs.get('backends', None) - self.load_balancing_settings = kwargs.get('load_balancing_settings', None) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.resource_state = None - - -class BackendPoolListResult(msrest.serialization.Model): - """Result of the request to list Backend Pools. It contains a list of Backend Pools objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Backend Pools within a Front Door. - :vartype value: list[~azure.mgmt.frontdoor.models.BackendPool] - :param next_link: URL to get the next set of BackendPool objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BackendPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BackendPoolListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class BackendPoolUpdateParameters(msrest.serialization.Model): - """A collection of backends that can be routed to. - - :param backends: The set of backends for this pool. - :type backends: list[~azure.mgmt.frontdoor.models.Backend] - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource - :param health_probe_settings: L7 health probe settings for a backend pool. - :type health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource - """ - - _attribute_map = { - 'backends': {'key': 'backends', 'type': '[Backend]'}, - 'load_balancing_settings': {'key': 'loadBalancingSettings', 'type': 'SubResource'}, - 'health_probe_settings': {'key': 'healthProbeSettings', 'type': 'SubResource'}, - } - - def __init__( - self, - **kwargs - ): - super(BackendPoolUpdateParameters, self).__init__(**kwargs) - self.backends = kwargs.get('backends', None) - self.load_balancing_settings = kwargs.get('load_balancing_settings', None) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - - -class BackendPoolProperties(BackendPoolUpdateParameters): - """The JSON object that contains the properties required to create a Backend Pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param backends: The set of backends for this pool. - :type backends: list[~azure.mgmt.frontdoor.models.Backend] - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource - :param health_probe_settings: L7 health probe settings for a backend pool. - :type health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - """ - - _validation = { - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'backends': {'key': 'backends', 'type': '[Backend]'}, - 'load_balancing_settings': {'key': 'loadBalancingSettings', 'type': 'SubResource'}, - 'health_probe_settings': {'key': 'healthProbeSettings', 'type': 'SubResource'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BackendPoolProperties, self).__init__(**kwargs) - self.resource_state = None - - -class BackendPoolsSettings(msrest.serialization.Model): - """Settings that apply to all backend pools. - - :param enforce_certificate_name_check: Whether to enforce certificate name check on HTTPS - requests to all backend pools. No effect on non-HTTPS requests. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :type enforce_certificate_name_check: str or - ~azure.mgmt.frontdoor.models.EnforceCertificateNameCheckEnabledState - :param send_recv_timeout_seconds: Send and receive timeout on forwarding request to the - backend. When timeout is reached, the request fails and returns. - :type send_recv_timeout_seconds: int - """ - - _validation = { - 'send_recv_timeout_seconds': {'minimum': 16}, - } - - _attribute_map = { - 'enforce_certificate_name_check': {'key': 'enforceCertificateNameCheck', 'type': 'str'}, - 'send_recv_timeout_seconds': {'key': 'sendRecvTimeoutSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(BackendPoolsSettings, self).__init__(**kwargs) - self.enforce_certificate_name_check = kwargs.get('enforce_certificate_name_check', "Enabled") - self.send_recv_timeout_seconds = kwargs.get('send_recv_timeout_seconds', None) - - -class CacheConfiguration(msrest.serialization.Model): - """Caching settings for a caching-type route. To disable caching, do not provide a cacheConfiguration object. - - :param query_parameter_strip_directive: Treatment of URL query terms when forming the cache - key. Possible values include: "StripNone", "StripAll", "StripOnly", "StripAllExcept". - :type query_parameter_strip_directive: str or ~azure.mgmt.frontdoor.models.FrontDoorQuery - :param query_parameters: query parameters to include or exclude (comma separated). - :type query_parameters: str - :param dynamic_compression: Whether to use dynamic compression for cached content. Possible - values include: "Enabled", "Disabled". - :type dynamic_compression: str or ~azure.mgmt.frontdoor.models.DynamicCompressionEnabled - :param cache_duration: The duration for which the content needs to be cached. Allowed format is - in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). HTTP requires the value - to be no more than a year. - :type cache_duration: ~datetime.timedelta - """ - - _attribute_map = { - 'query_parameter_strip_directive': {'key': 'queryParameterStripDirective', 'type': 'str'}, - 'query_parameters': {'key': 'queryParameters', 'type': 'str'}, - 'dynamic_compression': {'key': 'dynamicCompression', 'type': 'str'}, - 'cache_duration': {'key': 'cacheDuration', 'type': 'duration'}, - } - - def __init__( - self, - **kwargs - ): - super(CacheConfiguration, self).__init__(**kwargs) - self.query_parameter_strip_directive = kwargs.get('query_parameter_strip_directive', None) - self.query_parameters = kwargs.get('query_parameters', None) - self.dynamic_compression = kwargs.get('dynamic_compression', None) - self.cache_duration = kwargs.get('cache_duration', None) - - -class CheckNameAvailabilityInput(msrest.serialization.Model): - """Input of CheckNameAvailability API. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The resource name to validate. - :type name: str - :param type: Required. The type of the resource whose name is to be validated. Possible values - include: "Microsoft.Network/frontDoors", "Microsoft.Network/frontDoors/frontendEndpoints". - :type type: str or ~azure.mgmt.frontdoor.models.ResourceType - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityInput, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs['type'] - - -class CheckNameAvailabilityOutput(msrest.serialization.Model): - """Output of check name availability API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_availability: Indicates whether the name is available. Possible values include: - "Available", "Unavailable". - :vartype name_availability: str or ~azure.mgmt.frontdoor.models.Availability - :ivar reason: The reason why the name is not available. - :vartype reason: str - :ivar message: The detailed error message describing why the name is not available. - :vartype message: str - """ - - _validation = { - 'name_availability': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_availability': {'key': 'nameAvailability', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityOutput, self).__init__(**kwargs) - self.name_availability = None - self.reason = None - self.message = None - - -class CustomHttpsConfiguration(msrest.serialization.Model): - """Https settings for a domain. - - All required parameters must be populated in order to send to Azure. - - :param certificate_source: Required. Defines the source of the SSL certificate. Possible values - include: "AzureKeyVault", "FrontDoor". - :type certificate_source: str or ~azure.mgmt.frontdoor.models.FrontDoorCertificateSource - :param protocol_type: Required. Defines the TLS extension protocol that is used for secure - delivery. Possible values include: "ServerNameIndication". - :type protocol_type: str or ~azure.mgmt.frontdoor.models.FrontDoorTlsProtocolType - :param minimum_tls_version: Required. The minimum TLS version required from the clients to - establish an SSL handshake with Front Door. Possible values include: "1.0", "1.2". - :type minimum_tls_version: str or ~azure.mgmt.frontdoor.models.MinimumTLSVersion - :param certificate_type: Defines the type of the certificate used for secure connections to a - frontendEndpoint. Possible values include: "Dedicated". - :type certificate_type: str or ~azure.mgmt.frontdoor.models.FrontDoorCertificateType - :param vault: The Key Vault containing the SSL certificate. - :type vault: ~azure.mgmt.frontdoor.models.KeyVaultCertificateSourceParametersVault - :param secret_name: The name of the Key Vault secret representing the full certificate PFX. - :type secret_name: str - :param secret_version: The version of the Key Vault secret representing the full certificate - PFX. - :type secret_version: str - """ - - _validation = { - 'certificate_source': {'required': True}, - 'protocol_type': {'required': True}, - 'minimum_tls_version': {'required': True}, - } - - _attribute_map = { - 'certificate_source': {'key': 'certificateSource', 'type': 'str'}, - 'protocol_type': {'key': 'protocolType', 'type': 'str'}, - 'minimum_tls_version': {'key': 'minimumTlsVersion', 'type': 'str'}, - 'certificate_type': {'key': 'frontDoorCertificateSourceParameters.certificateType', 'type': 'str'}, - 'vault': {'key': 'keyVaultCertificateSourceParameters.vault', 'type': 'KeyVaultCertificateSourceParametersVault'}, - 'secret_name': {'key': 'keyVaultCertificateSourceParameters.secretName', 'type': 'str'}, - 'secret_version': {'key': 'keyVaultCertificateSourceParameters.secretVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomHttpsConfiguration, self).__init__(**kwargs) - self.certificate_source = kwargs['certificate_source'] - self.protocol_type = kwargs['protocol_type'] - self.minimum_tls_version = kwargs['minimum_tls_version'] - self.certificate_type = kwargs.get('certificate_type', None) - self.vault = kwargs.get('vault', None) - self.secret_name = kwargs.get('secret_name', None) - self.secret_version = kwargs.get('secret_version', None) - - -class CustomRule(msrest.serialization.Model): - """Defines contents of a web application rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Describes the name of the rule. - :type name: str - :param priority: Required. Describes priority of the rule. Rules with a lower value will be - evaluated before rules with a higher value. - :type priority: int - :param enabled_state: Describes if the custom rule is in enabled or disabled state. Defaults to - Enabled if not specified. Possible values include: "Disabled", "Enabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.CustomRuleEnabledState - :param rule_type: Required. Describes type of rule. Possible values include: "MatchRule", - "RateLimitRule". - :type rule_type: str or ~azure.mgmt.frontdoor.models.RuleType - :param rate_limit_duration_in_minutes: Time window for resetting the rate limit count. Default - is 1 minute. - :type rate_limit_duration_in_minutes: int - :param rate_limit_threshold: Number of allowed requests per client within the time window. - :type rate_limit_threshold: int - :param match_conditions: Required. List of match conditions. - :type match_conditions: list[~azure.mgmt.frontdoor.models.MatchCondition] - :param action: Required. Describes what action to be applied when rule matches. Possible values - include: "Allow", "Block", "Log", "Redirect". - :type action: str or ~azure.mgmt.frontdoor.models.ActionType - """ - - _validation = { - 'name': {'max_length': 128, 'min_length': 0}, - 'priority': {'required': True}, - 'rule_type': {'required': True}, - 'rate_limit_duration_in_minutes': {'maximum': 5, 'minimum': 0}, - 'rate_limit_threshold': {'minimum': 0}, - 'match_conditions': {'required': True}, - 'action': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'priority': {'key': 'priority', 'type': 'int'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'rule_type': {'key': 'ruleType', 'type': 'str'}, - 'rate_limit_duration_in_minutes': {'key': 'rateLimitDurationInMinutes', 'type': 'int'}, - 'rate_limit_threshold': {'key': 'rateLimitThreshold', 'type': 'int'}, - 'match_conditions': {'key': 'matchConditions', 'type': '[MatchCondition]'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomRule, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.priority = kwargs['priority'] - self.enabled_state = kwargs.get('enabled_state', None) - self.rule_type = kwargs['rule_type'] - self.rate_limit_duration_in_minutes = kwargs.get('rate_limit_duration_in_minutes', None) - self.rate_limit_threshold = kwargs.get('rate_limit_threshold', None) - self.match_conditions = kwargs['match_conditions'] - self.action = kwargs['action'] - - -class CustomRuleList(msrest.serialization.Model): - """Defines contents of custom rules. - - :param rules: List of rules. - :type rules: list[~azure.mgmt.frontdoor.models.CustomRule] - """ - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[CustomRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomRuleList, self).__init__(**kwargs) - self.rules = kwargs.get('rules', None) - - -class Endpoint(msrest.serialization.Model): - """Defines the endpoint properties. - - :param name: The name of the endpoint. - :type name: str - :param endpoint: The endpoint URL. - :type endpoint: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'endpoint': {'key': 'endpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoint, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.endpoint = kwargs.get('endpoint', None) - - -class Error(msrest.serialization.Model): - """Error. - - :param code: - :type code: str - :param message: - :type message: str - :param target: - :type target: str - :param details: - :type details: list[~azure.mgmt.frontdoor.models.ErrorDetails] - :param inner_error: - :type inner_error: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetails]'}, - 'inner_error': {'key': 'innerError', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Error, 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) - self.inner_error = kwargs.get('inner_error', None) - - -class ErrorDetails(msrest.serialization.Model): - """ErrorDetails. - - :param code: - :type code: str - :param target: - :type target: str - :param message: - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetails, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.target = kwargs.get('target', None) - self.message = kwargs.get('message', None) - - -class ErrorResponse(msrest.serialization.Model): - """Error response indicates Front Door service is not able to process the incoming request. The reason is provided in the error message. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.code = None - self.message = None - - -class Resource(msrest.serialization.Model): - """Common resource representation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class Experiment(Resource): - """Defines the properties of an Experiment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of the details or intents of the Experiment. - :type description: str - :param endpoint_a: The endpoint A of an experiment. - :type endpoint_a: ~azure.mgmt.frontdoor.models.Endpoint - :param endpoint_b: The endpoint B of an experiment. - :type endpoint_b: ~azure.mgmt.frontdoor.models.Endpoint - :param enabled_state: The state of the Experiment. Possible values include: "Enabled", - "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.State - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.NetworkExperimentResourceState - :ivar status: The description of Experiment status from the server side. - :vartype status: str - :ivar script_file_uri: The uri to the Script used in the Experiment. - :vartype script_file_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_state': {'readonly': True}, - 'status': {'readonly': True}, - 'script_file_uri': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'endpoint_a': {'key': 'properties.endpointA', 'type': 'Endpoint'}, - 'endpoint_b': {'key': 'properties.endpointB', 'type': 'Endpoint'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'script_file_uri': {'key': 'properties.scriptFileUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Experiment, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.endpoint_a = kwargs.get('endpoint_a', None) - self.endpoint_b = kwargs.get('endpoint_b', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.resource_state = None - self.status = None - self.script_file_uri = None - - -class ExperimentList(msrest.serialization.Model): - """Defines a list of Experiments. It contains a list of Experiment objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Experiments within a resource group. - :vartype value: list[~azure.mgmt.frontdoor.models.Experiment] - :param next_link: URL to get the next set of Experiment objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Experiment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentList, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class ExperimentUpdateModel(msrest.serialization.Model): - """Defines modifiable attributes of an Experiment. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of the intent or details of the Experiment. - :type description: str - :param enabled_state: The state of the Experiment. Possible values include: "Enabled", - "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.State - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentUpdateModel, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.description = kwargs.get('description', None) - self.enabled_state = kwargs.get('enabled_state', None) - - -class RouteConfiguration(msrest.serialization.Model): - """Base class for all types of Route. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ForwardingConfiguration, RedirectConfiguration. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration': 'ForwardingConfiguration', '#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration': 'RedirectConfiguration'} - } - - def __init__( - self, - **kwargs - ): - super(RouteConfiguration, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - - -class ForwardingConfiguration(RouteConfiguration): - """Describes Forwarding Route. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. Constant filled by server. - :type odata_type: str - :param custom_forwarding_path: A custom path used to rewrite resource paths matched by this - rule. Leave empty to use incoming path. - :type custom_forwarding_path: str - :param forwarding_protocol: Protocol this rule will use when forwarding traffic to backends. - Possible values include: "HttpOnly", "HttpsOnly", "MatchRequest". - :type forwarding_protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorForwardingProtocol - :param cache_configuration: The caching configuration associated with this rule. - :type cache_configuration: ~azure.mgmt.frontdoor.models.CacheConfiguration - :param backend_pool: A reference to the BackendPool which this rule routes to. - :type backend_pool: ~azure.mgmt.frontdoor.models.SubResource - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'custom_forwarding_path': {'key': 'customForwardingPath', 'type': 'str'}, - 'forwarding_protocol': {'key': 'forwardingProtocol', 'type': 'str'}, - 'cache_configuration': {'key': 'cacheConfiguration', 'type': 'CacheConfiguration'}, - 'backend_pool': {'key': 'backendPool', 'type': 'SubResource'}, - } - - def __init__( - self, - **kwargs - ): - super(ForwardingConfiguration, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration' # type: str - self.custom_forwarding_path = kwargs.get('custom_forwarding_path', None) - self.forwarding_protocol = kwargs.get('forwarding_protocol', None) - self.cache_configuration = kwargs.get('cache_configuration', None) - self.backend_pool = kwargs.get('backend_pool', None) - - -class FrontDoor(Resource): - """Front Door represents a collection of backend endpoints to route traffic to along with rules that specify how traffic is sent there. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param friendly_name: A friendly name for the frontDoor. - :type friendly_name: str - :param routing_rules: Routing rules associated with this Front Door. - :type routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] - :param load_balancing_settings: Load balancing settings associated with this Front Door - instance. - :type load_balancing_settings: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] - :param health_probe_settings: Health probe settings associated with this Front Door instance. - :type health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] - :param backend_pools: Backend pools available to routing rules. - :type backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] - :param frontend_endpoints: Frontend endpoints available to routing rules. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] - :param backend_pools_settings: Settings for all backendPools. - :type backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings - :param enabled_state: Operational status of the Front Door load balancer. Permitted values are - 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState - :ivar resource_state: Resource status of the Front Door. Possible values include: "Creating", - "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - :ivar provisioning_state: Provisioning state of the Front Door. - :vartype provisioning_state: str - :ivar cname: The host that each frontendEndpoint must CNAME to. - :vartype cname: str - :ivar frontdoor_id: The Id of the frontdoor. - :vartype frontdoor_id: str - :ivar rules_engines: Rules Engine Configurations available to routing rules. - :vartype rules_engines: list[~azure.mgmt.frontdoor.models.RulesEngine] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'cname': {'readonly': True}, - 'frontdoor_id': {'readonly': True}, - 'rules_engines': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'routing_rules': {'key': 'properties.routingRules', 'type': '[RoutingRule]'}, - 'load_balancing_settings': {'key': 'properties.loadBalancingSettings', 'type': '[LoadBalancingSettingsModel]'}, - 'health_probe_settings': {'key': 'properties.healthProbeSettings', 'type': '[HealthProbeSettingsModel]'}, - 'backend_pools': {'key': 'properties.backendPools', 'type': '[BackendPool]'}, - 'frontend_endpoints': {'key': 'properties.frontendEndpoints', 'type': '[FrontendEndpoint]'}, - 'backend_pools_settings': {'key': 'properties.backendPoolsSettings', 'type': 'BackendPoolsSettings'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'cname': {'key': 'properties.cname', 'type': 'str'}, - 'frontdoor_id': {'key': 'properties.frontdoorId', 'type': 'str'}, - 'rules_engines': {'key': 'properties.rulesEngines', 'type': '[RulesEngine]'}, - } - - def __init__( - self, - **kwargs - ): - super(FrontDoor, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.routing_rules = kwargs.get('routing_rules', None) - self.load_balancing_settings = kwargs.get('load_balancing_settings', None) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.backend_pools = kwargs.get('backend_pools', None) - self.frontend_endpoints = kwargs.get('frontend_endpoints', None) - self.backend_pools_settings = kwargs.get('backend_pools_settings', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.resource_state = None - self.provisioning_state = None - self.cname = None - self.frontdoor_id = None - self.rules_engines = None - - -class FrontDoorListResult(msrest.serialization.Model): - """Result of the request to list Front Doors. It contains a list of Front Door objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Front Doors within a resource group. - :vartype value: list[~azure.mgmt.frontdoor.models.FrontDoor] - :param next_link: URL to get the next set of Front Door objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FrontDoor]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FrontDoorListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class FrontDoorUpdateParameters(msrest.serialization.Model): - """The properties needed to update a Front Door. - - :param friendly_name: A friendly name for the frontDoor. - :type friendly_name: str - :param routing_rules: Routing rules associated with this Front Door. - :type routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] - :param load_balancing_settings: Load balancing settings associated with this Front Door - instance. - :type load_balancing_settings: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] - :param health_probe_settings: Health probe settings associated with this Front Door instance. - :type health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] - :param backend_pools: Backend pools available to routing rules. - :type backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] - :param frontend_endpoints: Frontend endpoints available to routing rules. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] - :param backend_pools_settings: Settings for all backendPools. - :type backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings - :param enabled_state: Operational status of the Front Door load balancer. Permitted values are - 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'routing_rules': {'key': 'routingRules', 'type': '[RoutingRule]'}, - 'load_balancing_settings': {'key': 'loadBalancingSettings', 'type': '[LoadBalancingSettingsModel]'}, - 'health_probe_settings': {'key': 'healthProbeSettings', 'type': '[HealthProbeSettingsModel]'}, - 'backend_pools': {'key': 'backendPools', 'type': '[BackendPool]'}, - 'frontend_endpoints': {'key': 'frontendEndpoints', 'type': '[FrontendEndpoint]'}, - 'backend_pools_settings': {'key': 'backendPoolsSettings', 'type': 'BackendPoolsSettings'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FrontDoorUpdateParameters, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.routing_rules = kwargs.get('routing_rules', None) - self.load_balancing_settings = kwargs.get('load_balancing_settings', None) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.backend_pools = kwargs.get('backend_pools', None) - self.frontend_endpoints = kwargs.get('frontend_endpoints', None) - self.backend_pools_settings = kwargs.get('backend_pools_settings', None) - self.enabled_state = kwargs.get('enabled_state', None) - - -class FrontDoorProperties(FrontDoorUpdateParameters): - """The JSON object that contains the properties required to create an endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param friendly_name: A friendly name for the frontDoor. - :type friendly_name: str - :param routing_rules: Routing rules associated with this Front Door. - :type routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] - :param load_balancing_settings: Load balancing settings associated with this Front Door - instance. - :type load_balancing_settings: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] - :param health_probe_settings: Health probe settings associated with this Front Door instance. - :type health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] - :param backend_pools: Backend pools available to routing rules. - :type backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] - :param frontend_endpoints: Frontend endpoints available to routing rules. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] - :param backend_pools_settings: Settings for all backendPools. - :type backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings - :param enabled_state: Operational status of the Front Door load balancer. Permitted values are - 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState - :ivar resource_state: Resource status of the Front Door. Possible values include: "Creating", - "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - :ivar provisioning_state: Provisioning state of the Front Door. - :vartype provisioning_state: str - :ivar cname: The host that each frontendEndpoint must CNAME to. - :vartype cname: str - :ivar frontdoor_id: The Id of the frontdoor. - :vartype frontdoor_id: str - :ivar rules_engines: Rules Engine Configurations available to routing rules. - :vartype rules_engines: list[~azure.mgmt.frontdoor.models.RulesEngine] - """ - - _validation = { - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'cname': {'readonly': True}, - 'frontdoor_id': {'readonly': True}, - 'rules_engines': {'readonly': True}, - } - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'routing_rules': {'key': 'routingRules', 'type': '[RoutingRule]'}, - 'load_balancing_settings': {'key': 'loadBalancingSettings', 'type': '[LoadBalancingSettingsModel]'}, - 'health_probe_settings': {'key': 'healthProbeSettings', 'type': '[HealthProbeSettingsModel]'}, - 'backend_pools': {'key': 'backendPools', 'type': '[BackendPool]'}, - 'frontend_endpoints': {'key': 'frontendEndpoints', 'type': '[FrontendEndpoint]'}, - 'backend_pools_settings': {'key': 'backendPoolsSettings', 'type': 'BackendPoolsSettings'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'cname': {'key': 'cname', 'type': 'str'}, - 'frontdoor_id': {'key': 'frontdoorId', 'type': 'str'}, - 'rules_engines': {'key': 'rulesEngines', 'type': '[RulesEngine]'}, - } - - def __init__( - self, - **kwargs - ): - super(FrontDoorProperties, self).__init__(**kwargs) - self.resource_state = None - self.provisioning_state = None - self.cname = None - self.frontdoor_id = None - self.rules_engines = None - - -class FrontendEndpoint(SubResource): - """A frontend endpoint used for routing. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type id: str - :param name: Resource name. - :type name: str - :ivar type: Resource type. - :vartype type: str - :param host_name: The host name of the frontendEndpoint. Must be a domain name. - :type host_name: str - :param session_affinity_enabled_state: Whether to allow session affinity on this host. Valid - options are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_enabled_state: str or - ~azure.mgmt.frontdoor.models.SessionAffinityEnabledState - :param session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in - seconds for session affinity, if applicable. - :type session_affinity_ttl_seconds: int - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - each host (if applicable). - :type web_application_firewall_policy_link: - ~azure.mgmt.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - :ivar custom_https_provisioning_state: Provisioning status of Custom Https of the - frontendEndpoint. Possible values include: "Enabling", "Enabled", "Disabling", "Disabled", - "Failed". - :vartype custom_https_provisioning_state: str or - ~azure.mgmt.frontdoor.models.CustomHttpsProvisioningState - :ivar custom_https_provisioning_substate: Provisioning substate shows the progress of custom - HTTPS enabling/disabling process step by step. Possible values include: - "SubmittingDomainControlValidationRequest", "PendingDomainControlValidationREquestApproval", - "DomainControlValidationRequestApproved", "DomainControlValidationRequestRejected", - "DomainControlValidationRequestTimedOut", "IssuingCertificate", "DeployingCertificate", - "CertificateDeployed", "DeletingCertificate", "CertificateDeleted". - :vartype custom_https_provisioning_substate: str or - ~azure.mgmt.frontdoor.models.CustomHttpsProvisioningSubstate - :ivar custom_https_configuration: The configuration specifying how to enable HTTPS. - :vartype custom_https_configuration: ~azure.mgmt.frontdoor.models.CustomHttpsConfiguration - """ - - _validation = { - 'type': {'readonly': True}, - 'resource_state': {'readonly': True}, - 'custom_https_provisioning_state': {'readonly': True}, - 'custom_https_provisioning_substate': {'readonly': True}, - 'custom_https_configuration': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'session_affinity_enabled_state': {'key': 'properties.sessionAffinityEnabledState', 'type': 'str'}, - 'session_affinity_ttl_seconds': {'key': 'properties.sessionAffinityTtlSeconds', 'type': 'int'}, - 'web_application_firewall_policy_link': {'key': 'properties.webApplicationFirewallPolicyLink', 'type': 'FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'custom_https_provisioning_state': {'key': 'properties.customHttpsProvisioningState', 'type': 'str'}, - 'custom_https_provisioning_substate': {'key': 'properties.customHttpsProvisioningSubstate', 'type': 'str'}, - 'custom_https_configuration': {'key': 'properties.customHttpsConfiguration', 'type': 'CustomHttpsConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(FrontendEndpoint, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = None - self.host_name = kwargs.get('host_name', None) - self.session_affinity_enabled_state = kwargs.get('session_affinity_enabled_state', None) - self.session_affinity_ttl_seconds = kwargs.get('session_affinity_ttl_seconds', None) - self.web_application_firewall_policy_link = kwargs.get('web_application_firewall_policy_link', None) - self.resource_state = None - self.custom_https_provisioning_state = None - self.custom_https_provisioning_substate = None - self.custom_https_configuration = None - - -class FrontendEndpointLink(msrest.serialization.Model): - """Defines the Resource ID for a Frontend Endpoint. - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FrontendEndpointLink, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class FrontendEndpointUpdateParameters(msrest.serialization.Model): - """Frontend endpoint used in routing rule. - - :param host_name: The host name of the frontendEndpoint. Must be a domain name. - :type host_name: str - :param session_affinity_enabled_state: Whether to allow session affinity on this host. Valid - options are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_enabled_state: str or - ~azure.mgmt.frontdoor.models.SessionAffinityEnabledState - :param session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in - seconds for session affinity, if applicable. - :type session_affinity_ttl_seconds: int - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - each host (if applicable). - :type web_application_firewall_policy_link: - ~azure.mgmt.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink - """ - - _attribute_map = { - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'session_affinity_enabled_state': {'key': 'sessionAffinityEnabledState', 'type': 'str'}, - 'session_affinity_ttl_seconds': {'key': 'sessionAffinityTtlSeconds', 'type': 'int'}, - 'web_application_firewall_policy_link': {'key': 'webApplicationFirewallPolicyLink', 'type': 'FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink'}, - } - - def __init__( - self, - **kwargs - ): - super(FrontendEndpointUpdateParameters, self).__init__(**kwargs) - self.host_name = kwargs.get('host_name', None) - self.session_affinity_enabled_state = kwargs.get('session_affinity_enabled_state', None) - self.session_affinity_ttl_seconds = kwargs.get('session_affinity_ttl_seconds', None) - self.web_application_firewall_policy_link = kwargs.get('web_application_firewall_policy_link', None) - - -class FrontendEndpointProperties(FrontendEndpointUpdateParameters): - """The JSON object that contains the properties required to create a frontend endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param host_name: The host name of the frontendEndpoint. Must be a domain name. - :type host_name: str - :param session_affinity_enabled_state: Whether to allow session affinity on this host. Valid - options are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_enabled_state: str or - ~azure.mgmt.frontdoor.models.SessionAffinityEnabledState - :param session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in - seconds for session affinity, if applicable. - :type session_affinity_ttl_seconds: int - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - each host (if applicable). - :type web_application_firewall_policy_link: - ~azure.mgmt.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - :ivar custom_https_provisioning_state: Provisioning status of Custom Https of the - frontendEndpoint. Possible values include: "Enabling", "Enabled", "Disabling", "Disabled", - "Failed". - :vartype custom_https_provisioning_state: str or - ~azure.mgmt.frontdoor.models.CustomHttpsProvisioningState - :ivar custom_https_provisioning_substate: Provisioning substate shows the progress of custom - HTTPS enabling/disabling process step by step. Possible values include: - "SubmittingDomainControlValidationRequest", "PendingDomainControlValidationREquestApproval", - "DomainControlValidationRequestApproved", "DomainControlValidationRequestRejected", - "DomainControlValidationRequestTimedOut", "IssuingCertificate", "DeployingCertificate", - "CertificateDeployed", "DeletingCertificate", "CertificateDeleted". - :vartype custom_https_provisioning_substate: str or - ~azure.mgmt.frontdoor.models.CustomHttpsProvisioningSubstate - :ivar custom_https_configuration: The configuration specifying how to enable HTTPS. - :vartype custom_https_configuration: ~azure.mgmt.frontdoor.models.CustomHttpsConfiguration - """ - - _validation = { - 'resource_state': {'readonly': True}, - 'custom_https_provisioning_state': {'readonly': True}, - 'custom_https_provisioning_substate': {'readonly': True}, - 'custom_https_configuration': {'readonly': True}, - } - - _attribute_map = { - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'session_affinity_enabled_state': {'key': 'sessionAffinityEnabledState', 'type': 'str'}, - 'session_affinity_ttl_seconds': {'key': 'sessionAffinityTtlSeconds', 'type': 'int'}, - 'web_application_firewall_policy_link': {'key': 'webApplicationFirewallPolicyLink', 'type': 'FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - 'custom_https_provisioning_state': {'key': 'customHttpsProvisioningState', 'type': 'str'}, - 'custom_https_provisioning_substate': {'key': 'customHttpsProvisioningSubstate', 'type': 'str'}, - 'custom_https_configuration': {'key': 'customHttpsConfiguration', 'type': 'CustomHttpsConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(FrontendEndpointProperties, self).__init__(**kwargs) - self.resource_state = None - self.custom_https_provisioning_state = None - self.custom_https_provisioning_substate = None - self.custom_https_configuration = None - - -class FrontendEndpointsListResult(msrest.serialization.Model): - """Result of the request to list frontend endpoints. It contains a list of Frontend endpoint objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Frontend endpoints within a Front Door. - :vartype value: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] - :param next_link: URL to get the next set of frontend endpoints if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FrontendEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FrontendEndpointsListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink(msrest.serialization.Model): - """Defines the Web Application Firewall policy for each host (if applicable). - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class HeaderAction(msrest.serialization.Model): - """An action that can manipulate an http header. - - All required parameters must be populated in order to send to Azure. - - :param header_action_type: Required. Which type of manipulation to apply to the header. - Possible values include: "Append", "Delete", "Overwrite". - :type header_action_type: str or ~azure.mgmt.frontdoor.models.HeaderActionType - :param header_name: Required. The name of the header this action will apply to. - :type header_name: str - :param value: The value to update the given header name with. This value is not used if the - actionType is Delete. - :type value: str - """ - - _validation = { - 'header_action_type': {'required': True}, - 'header_name': {'required': True}, - } - - _attribute_map = { - 'header_action_type': {'key': 'headerActionType', 'type': 'str'}, - 'header_name': {'key': 'headerName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HeaderAction, self).__init__(**kwargs) - self.header_action_type = kwargs['header_action_type'] - self.header_name = kwargs['header_name'] - self.value = kwargs.get('value', None) - - -class HealthProbeSettingsListResult(msrest.serialization.Model): - """Result of the request to list HealthProbeSettings. It contains a list of HealthProbeSettings objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of HealthProbeSettings within a Front Door. - :vartype value: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] - :param next_link: URL to get the next set of HealthProbeSettings objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[HealthProbeSettingsModel]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HealthProbeSettingsListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class HealthProbeSettingsModel(SubResource): - """Load balancing settings for a backend pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type id: str - :param name: Resource name. - :type name: str - :ivar type: Resource type. - :vartype type: str - :param path: The path to use for the health probe. Default is /. - :type path: str - :param protocol: Protocol scheme to use for this probe. Possible values include: "Http", - "Https". - :type protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol - :param interval_in_seconds: The number of seconds between health probes. - :type interval_in_seconds: int - :param health_probe_method: Configures which HTTP method to use to probe the backends defined - under backendPools. Possible values include: "GET", "HEAD". Default value: "HEAD". - :type health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod - :param enabled_state: Whether to enable health probes to be made against backends defined under - backendPools. Health probes can only be disabled if there is a single enabled backend in single - enabled backend pool. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - """ - - _validation = { - 'type': {'readonly': True}, - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'path': {'key': 'properties.path', 'type': 'str'}, - 'protocol': {'key': 'properties.protocol', 'type': 'str'}, - 'interval_in_seconds': {'key': 'properties.intervalInSeconds', 'type': 'int'}, - 'health_probe_method': {'key': 'properties.healthProbeMethod', 'type': 'str'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HealthProbeSettingsModel, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = None - self.path = kwargs.get('path', None) - self.protocol = kwargs.get('protocol', None) - self.interval_in_seconds = kwargs.get('interval_in_seconds', None) - self.health_probe_method = kwargs.get('health_probe_method', "HEAD") - self.enabled_state = kwargs.get('enabled_state', None) - self.resource_state = None - - -class HealthProbeSettingsUpdateParameters(msrest.serialization.Model): - """L7 health probe settings for a backend pool. - - :param path: The path to use for the health probe. Default is /. - :type path: str - :param protocol: Protocol scheme to use for this probe. Possible values include: "Http", - "Https". - :type protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol - :param interval_in_seconds: The number of seconds between health probes. - :type interval_in_seconds: int - :param health_probe_method: Configures which HTTP method to use to probe the backends defined - under backendPools. Possible values include: "GET", "HEAD". Default value: "HEAD". - :type health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod - :param enabled_state: Whether to enable health probes to be made against backends defined under - backendPools. Health probes can only be disabled if there is a single enabled backend in single - enabled backend pool. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled - """ - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'int'}, - 'health_probe_method': {'key': 'healthProbeMethod', 'type': 'str'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HealthProbeSettingsUpdateParameters, self).__init__(**kwargs) - self.path = kwargs.get('path', None) - self.protocol = kwargs.get('protocol', None) - self.interval_in_seconds = kwargs.get('interval_in_seconds', None) - self.health_probe_method = kwargs.get('health_probe_method', "HEAD") - self.enabled_state = kwargs.get('enabled_state', None) - - -class HealthProbeSettingsProperties(HealthProbeSettingsUpdateParameters): - """The JSON object that contains the properties required to create a health probe settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param path: The path to use for the health probe. Default is /. - :type path: str - :param protocol: Protocol scheme to use for this probe. Possible values include: "Http", - "Https". - :type protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol - :param interval_in_seconds: The number of seconds between health probes. - :type interval_in_seconds: int - :param health_probe_method: Configures which HTTP method to use to probe the backends defined - under backendPools. Possible values include: "GET", "HEAD". Default value: "HEAD". - :type health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod - :param enabled_state: Whether to enable health probes to be made against backends defined under - backendPools. Health probes can only be disabled if there is a single enabled backend in single - enabled backend pool. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - """ - - _validation = { - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'int'}, - 'health_probe_method': {'key': 'healthProbeMethod', 'type': 'str'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HealthProbeSettingsProperties, self).__init__(**kwargs) - self.resource_state = None - - -class KeyVaultCertificateSourceParametersVault(msrest.serialization.Model): - """The Key Vault containing the SSL certificate. - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultCertificateSourceParametersVault, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class LatencyMetric(msrest.serialization.Model): - """Defines the properties of a latency metric used in the latency scorecard. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the Latency Metric. - :vartype name: str - :ivar end_date_time_utc: The end time of the Latency Scorecard in UTC. - :vartype end_date_time_utc: str - :ivar a_value: The metric value of the A endpoint. - :vartype a_value: float - :ivar b_value: The metric value of the B endpoint. - :vartype b_value: float - :ivar delta: The difference in value between endpoint A and B. - :vartype delta: float - :ivar delta_percent: The percent difference between endpoint A and B. - :vartype delta_percent: float - :ivar a_c_lower95_ci: The lower end of the 95% confidence interval for endpoint A. - :vartype a_c_lower95_ci: float - :ivar a_h_upper95_ci: The upper end of the 95% confidence interval for endpoint A. - :vartype a_h_upper95_ci: float - :ivar b_c_lower95_ci: The lower end of the 95% confidence interval for endpoint B. - :vartype b_c_lower95_ci: float - :ivar b_upper95_ci: The upper end of the 95% confidence interval for endpoint B. - :vartype b_upper95_ci: float - """ - - _validation = { - 'name': {'readonly': True}, - 'end_date_time_utc': {'readonly': True}, - 'a_value': {'readonly': True}, - 'b_value': {'readonly': True}, - 'delta': {'readonly': True}, - 'delta_percent': {'readonly': True}, - 'a_c_lower95_ci': {'readonly': True}, - 'a_h_upper95_ci': {'readonly': True}, - 'b_c_lower95_ci': {'readonly': True}, - 'b_upper95_ci': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'end_date_time_utc': {'key': 'endDateTimeUTC', 'type': 'str'}, - 'a_value': {'key': 'aValue', 'type': 'float'}, - 'b_value': {'key': 'bValue', 'type': 'float'}, - 'delta': {'key': 'delta', 'type': 'float'}, - 'delta_percent': {'key': 'deltaPercent', 'type': 'float'}, - 'a_c_lower95_ci': {'key': 'aCLower95CI', 'type': 'float'}, - 'a_h_upper95_ci': {'key': 'aHUpper95CI', 'type': 'float'}, - 'b_c_lower95_ci': {'key': 'bCLower95CI', 'type': 'float'}, - 'b_upper95_ci': {'key': 'bUpper95CI', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(LatencyMetric, self).__init__(**kwargs) - self.name = None - self.end_date_time_utc = None - self.a_value = None - self.b_value = None - self.delta = None - self.delta_percent = None - self.a_c_lower95_ci = None - self.a_h_upper95_ci = None - self.b_c_lower95_ci = None - self.b_upper95_ci = None - - -class LatencyScorecard(Resource): - """Defines the LatencyScorecard. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar id_properties_id: The unique identifier of the Latency Scorecard. - :vartype id_properties_id: str - :ivar name_properties_name: The name of the Latency Scorecard. - :vartype name_properties_name: str - :ivar description: The description of the Latency Scorecard. - :vartype description: str - :ivar endpoint_a: The A endpoint in the scorecard. - :vartype endpoint_a: str - :ivar endpoint_b: The B endpoint in the scorecard. - :vartype endpoint_b: str - :ivar start_date_time_utc: The start time of the Latency Scorecard in UTC. - :vartype start_date_time_utc: ~datetime.datetime - :ivar end_date_time_utc: The end time of the Latency Scorecard in UTC. - :vartype end_date_time_utc: ~datetime.datetime - :ivar country: The country associated with the Latency Scorecard. Values are country ISO codes - as specified here- https://www.iso.org/iso-3166-country-codes.html. - :vartype country: str - :param latency_metrics: The latency metrics of the Latency Scorecard. - :type latency_metrics: list[~azure.mgmt.frontdoor.models.LatencyMetric] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'id_properties_id': {'readonly': True}, - 'name_properties_name': {'readonly': True}, - 'description': {'readonly': True}, - 'endpoint_a': {'readonly': True}, - 'endpoint_b': {'readonly': True}, - 'start_date_time_utc': {'readonly': True}, - 'end_date_time_utc': {'readonly': True}, - 'country': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'endpoint_a': {'key': 'properties.endpointA', 'type': 'str'}, - 'endpoint_b': {'key': 'properties.endpointB', 'type': 'str'}, - 'start_date_time_utc': {'key': 'properties.startDateTimeUTC', 'type': 'iso-8601'}, - 'end_date_time_utc': {'key': 'properties.endDateTimeUTC', 'type': 'iso-8601'}, - 'country': {'key': 'properties.country', 'type': 'str'}, - 'latency_metrics': {'key': 'properties.latencyMetrics', 'type': '[LatencyMetric]'}, - } - - def __init__( - self, - **kwargs - ): - super(LatencyScorecard, self).__init__(**kwargs) - self.id_properties_id = None - self.name_properties_name = None - self.description = None - self.endpoint_a = None - self.endpoint_b = None - self.start_date_time_utc = None - self.end_date_time_utc = None - self.country = None - self.latency_metrics = kwargs.get('latency_metrics', None) - - -class LoadBalancingSettingsListResult(msrest.serialization.Model): - """Result of the request to list load balancing settings. It contains a list of load balancing settings objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Backend Pools within a Front Door. - :vartype value: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] - :param next_link: URL to get the next set of LoadBalancingSettings objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[LoadBalancingSettingsModel]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancingSettingsListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class LoadBalancingSettingsModel(SubResource): - """Load balancing settings for a backend pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type id: str - :param name: Resource name. - :type name: str - :ivar type: Resource type. - :vartype type: str - :param sample_size: The number of samples to consider for load balancing decisions. - :type sample_size: int - :param successful_samples_required: The number of samples within the sample period that must - succeed. - :type successful_samples_required: int - :param additional_latency_milliseconds: The additional latency in milliseconds for probes to - fall into the lowest latency bucket. - :type additional_latency_milliseconds: int - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - """ - - _validation = { - 'type': {'readonly': True}, - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sample_size': {'key': 'properties.sampleSize', 'type': 'int'}, - 'successful_samples_required': {'key': 'properties.successfulSamplesRequired', 'type': 'int'}, - 'additional_latency_milliseconds': {'key': 'properties.additionalLatencyMilliseconds', 'type': 'int'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancingSettingsModel, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = None - self.sample_size = kwargs.get('sample_size', None) - self.successful_samples_required = kwargs.get('successful_samples_required', None) - self.additional_latency_milliseconds = kwargs.get('additional_latency_milliseconds', None) - self.resource_state = None - - -class LoadBalancingSettingsUpdateParameters(msrest.serialization.Model): - """Round-Robin load balancing settings for a backend pool. - - :param sample_size: The number of samples to consider for load balancing decisions. - :type sample_size: int - :param successful_samples_required: The number of samples within the sample period that must - succeed. - :type successful_samples_required: int - :param additional_latency_milliseconds: The additional latency in milliseconds for probes to - fall into the lowest latency bucket. - :type additional_latency_milliseconds: int - """ - - _attribute_map = { - 'sample_size': {'key': 'sampleSize', 'type': 'int'}, - 'successful_samples_required': {'key': 'successfulSamplesRequired', 'type': 'int'}, - 'additional_latency_milliseconds': {'key': 'additionalLatencyMilliseconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancingSettingsUpdateParameters, self).__init__(**kwargs) - self.sample_size = kwargs.get('sample_size', None) - self.successful_samples_required = kwargs.get('successful_samples_required', None) - self.additional_latency_milliseconds = kwargs.get('additional_latency_milliseconds', None) - - -class LoadBalancingSettingsProperties(LoadBalancingSettingsUpdateParameters): - """The JSON object that contains the properties required to create load balancing settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param sample_size: The number of samples to consider for load balancing decisions. - :type sample_size: int - :param successful_samples_required: The number of samples within the sample period that must - succeed. - :type successful_samples_required: int - :param additional_latency_milliseconds: The additional latency in milliseconds for probes to - fall into the lowest latency bucket. - :type additional_latency_milliseconds: int - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - """ - - _validation = { - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'sample_size': {'key': 'sampleSize', 'type': 'int'}, - 'successful_samples_required': {'key': 'successfulSamplesRequired', 'type': 'int'}, - 'additional_latency_milliseconds': {'key': 'additionalLatencyMilliseconds', 'type': 'int'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancingSettingsProperties, self).__init__(**kwargs) - self.resource_state = None - - -class ManagedRuleDefinition(msrest.serialization.Model): - """Describes a managed rule definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar rule_id: Identifier for the managed rule. - :vartype rule_id: str - :ivar default_state: Describes the default state for the managed rule. Possible values include: - "Disabled", "Enabled". - :vartype default_state: str or ~azure.mgmt.frontdoor.models.ManagedRuleEnabledState - :ivar default_action: Describes the default action to be applied when the managed rule matches. - Possible values include: "Allow", "Block", "Log", "Redirect". - :vartype default_action: str or ~azure.mgmt.frontdoor.models.ActionType - :ivar description: Describes the functionality of the managed rule. - :vartype description: str - """ - - _validation = { - 'rule_id': {'readonly': True}, - 'default_state': {'readonly': True}, - 'default_action': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'default_state': {'key': 'defaultState', 'type': 'str'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleDefinition, self).__init__(**kwargs) - self.rule_id = None - self.default_state = None - self.default_action = None - self.description = None - - -class ManagedRuleExclusion(msrest.serialization.Model): - """Exclude variables from managed rule evaluation. - - All required parameters must be populated in order to send to Azure. - - :param match_variable: Required. The variable type to be excluded. Possible values include: - "RequestHeaderNames", "RequestCookieNames", "QueryStringArgNames", "RequestBodyPostArgNames", - "RequestBodyJsonArgNames". - :type match_variable: str or ~azure.mgmt.frontdoor.models.ManagedRuleExclusionMatchVariable - :param selector_match_operator: Required. Comparison operator to apply to the selector when - specifying which elements in the collection this exclusion applies to. Possible values include: - "Equals", "Contains", "StartsWith", "EndsWith", "EqualsAny". - :type selector_match_operator: str or - ~azure.mgmt.frontdoor.models.ManagedRuleExclusionSelectorMatchOperator - :param selector: Required. Selector value for which elements in the collection this exclusion - applies to. - :type selector: str - """ - - _validation = { - 'match_variable': {'required': True}, - 'selector_match_operator': {'required': True}, - 'selector': {'required': True}, - } - - _attribute_map = { - 'match_variable': {'key': 'matchVariable', 'type': 'str'}, - 'selector_match_operator': {'key': 'selectorMatchOperator', 'type': 'str'}, - 'selector': {'key': 'selector', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleExclusion, self).__init__(**kwargs) - self.match_variable = kwargs['match_variable'] - self.selector_match_operator = kwargs['selector_match_operator'] - self.selector = kwargs['selector'] - - -class ManagedRuleGroupDefinition(msrest.serialization.Model): - """Describes a managed rule group. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar rule_group_name: Name of the managed rule group. - :vartype rule_group_name: str - :ivar description: Description of the managed rule group. - :vartype description: str - :ivar rules: List of rules within the managed rule group. - :vartype rules: list[~azure.mgmt.frontdoor.models.ManagedRuleDefinition] - """ - - _validation = { - 'rule_group_name': {'readonly': True}, - 'description': {'readonly': True}, - 'rules': {'readonly': True}, - } - - _attribute_map = { - 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[ManagedRuleDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleGroupDefinition, self).__init__(**kwargs) - self.rule_group_name = None - self.description = None - self.rules = None - - -class ManagedRuleGroupOverride(msrest.serialization.Model): - """Defines a managed rule group override setting. - - All required parameters must be populated in order to send to Azure. - - :param rule_group_name: Required. Describes the managed rule group to override. - :type rule_group_name: str - :param exclusions: Describes the exclusions that are applied to all rules in the group. - :type exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] - :param rules: List of rules that will be disabled. If none specified, all rules in the group - will be disabled. - :type rules: list[~azure.mgmt.frontdoor.models.ManagedRuleOverride] - """ - - _validation = { - 'rule_group_name': {'required': True}, - } - - _attribute_map = { - 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, - 'exclusions': {'key': 'exclusions', 'type': '[ManagedRuleExclusion]'}, - 'rules': {'key': 'rules', 'type': '[ManagedRuleOverride]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleGroupOverride, self).__init__(**kwargs) - self.rule_group_name = kwargs['rule_group_name'] - self.exclusions = kwargs.get('exclusions', None) - self.rules = kwargs.get('rules', None) - - -class ManagedRuleOverride(msrest.serialization.Model): - """Defines a managed rule group override setting. - - All required parameters must be populated in order to send to Azure. - - :param rule_id: Required. Identifier for the managed rule. - :type rule_id: str - :param enabled_state: Describes if the managed rule is in enabled or disabled state. Defaults - to Disabled if not specified. Possible values include: "Disabled", "Enabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.ManagedRuleEnabledState - :param action: Describes the override action to be applied when rule matches. Possible values - include: "Allow", "Block", "Log", "Redirect". - :type action: str or ~azure.mgmt.frontdoor.models.ActionType - :param exclusions: Describes the exclusions that are applied to this specific rule. - :type exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] - """ - - _validation = { - 'rule_id': {'required': True}, - } - - _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'exclusions': {'key': 'exclusions', 'type': '[ManagedRuleExclusion]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleOverride, self).__init__(**kwargs) - self.rule_id = kwargs['rule_id'] - self.enabled_state = kwargs.get('enabled_state', None) - self.action = kwargs.get('action', None) - self.exclusions = kwargs.get('exclusions', None) - - -class ManagedRuleSet(msrest.serialization.Model): - """Defines a managed rule set. - - All required parameters must be populated in order to send to Azure. - - :param rule_set_type: Required. Defines the rule set type to use. - :type rule_set_type: str - :param rule_set_version: Required. Defines the version of the rule set to use. - :type rule_set_version: str - :param rule_set_action: Defines the action to take when a managed rule set score threshold is - met. Possible values include: "Block", "Log", "Redirect". - :type rule_set_action: str or ~azure.mgmt.frontdoor.models.ManagedRuleSetActionType - :param exclusions: Describes the exclusions that are applied to all rules in the set. - :type exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] - :param rule_group_overrides: Defines the rule group overrides to apply to the rule set. - :type rule_group_overrides: list[~azure.mgmt.frontdoor.models.ManagedRuleGroupOverride] - """ - - _validation = { - 'rule_set_type': {'required': True}, - 'rule_set_version': {'required': True}, - } - - _attribute_map = { - 'rule_set_type': {'key': 'ruleSetType', 'type': 'str'}, - 'rule_set_version': {'key': 'ruleSetVersion', 'type': 'str'}, - 'rule_set_action': {'key': 'ruleSetAction', 'type': 'str'}, - 'exclusions': {'key': 'exclusions', 'type': '[ManagedRuleExclusion]'}, - 'rule_group_overrides': {'key': 'ruleGroupOverrides', 'type': '[ManagedRuleGroupOverride]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleSet, self).__init__(**kwargs) - self.rule_set_type = kwargs['rule_set_type'] - self.rule_set_version = kwargs['rule_set_version'] - self.rule_set_action = kwargs.get('rule_set_action', None) - self.exclusions = kwargs.get('exclusions', None) - self.rule_group_overrides = kwargs.get('rule_group_overrides', None) - - -class ManagedRuleSetDefinition(Resource): - """Describes the a managed rule set definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar provisioning_state: Provisioning state of the managed rule set. - :vartype provisioning_state: str - :ivar rule_set_id: Id of the managed rule set. - :vartype rule_set_id: str - :ivar rule_set_type: Type of the managed rule set. - :vartype rule_set_type: str - :ivar rule_set_version: Version of the managed rule set type. - :vartype rule_set_version: str - :ivar rule_groups: Rule groups of the managed rule set. - :vartype rule_groups: list[~azure.mgmt.frontdoor.models.ManagedRuleGroupDefinition] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'rule_set_id': {'readonly': True}, - 'rule_set_type': {'readonly': True}, - 'rule_set_version': {'readonly': True}, - 'rule_groups': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'rule_set_id': {'key': 'properties.ruleSetId', 'type': 'str'}, - 'rule_set_type': {'key': 'properties.ruleSetType', 'type': 'str'}, - 'rule_set_version': {'key': 'properties.ruleSetVersion', 'type': 'str'}, - 'rule_groups': {'key': 'properties.ruleGroups', 'type': '[ManagedRuleGroupDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleSetDefinition, self).__init__(**kwargs) - self.provisioning_state = None - self.rule_set_id = None - self.rule_set_type = None - self.rule_set_version = None - self.rule_groups = None - - -class ManagedRuleSetDefinitionList(msrest.serialization.Model): - """List of managed rule set definitions available for use in a policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of managed rule set definitions. - :vartype value: list[~azure.mgmt.frontdoor.models.ManagedRuleSetDefinition] - :param next_link: URL to retrieve next set of managed rule set definitions. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedRuleSetDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleSetDefinitionList, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class ManagedRuleSetList(msrest.serialization.Model): - """Defines the list of managed rule sets for the policy. - - :param managed_rule_sets: List of rule sets. - :type managed_rule_sets: list[~azure.mgmt.frontdoor.models.ManagedRuleSet] - """ - - _attribute_map = { - 'managed_rule_sets': {'key': 'managedRuleSets', 'type': '[ManagedRuleSet]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleSetList, self).__init__(**kwargs) - self.managed_rule_sets = kwargs.get('managed_rule_sets', None) - - -class MatchCondition(msrest.serialization.Model): - """Define a match condition. - - All required parameters must be populated in order to send to Azure. - - :param match_variable: Required. Request variable to compare with. Possible values include: - "RemoteAddr", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", - "RequestBody", "Cookies", "SocketAddr". - :type match_variable: str or ~azure.mgmt.frontdoor.models.MatchVariable - :param selector: Match against a specific key from the QueryString, PostArgs, RequestHeader or - Cookies variables. Default is null. - :type selector: str - :param operator: Required. Comparison type to use for matching with the variable value. - Possible values include: "Any", "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", - "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", "EndsWith", "RegEx". - :type operator: str or ~azure.mgmt.frontdoor.models.Operator - :param negate_condition: Describes if the result of this condition should be negated. - :type negate_condition: bool - :param match_value: Required. List of possible match values. - :type match_value: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.frontdoor.models.TransformType] - """ - - _validation = { - 'match_variable': {'required': True}, - 'operator': {'required': True}, - 'match_value': {'required': True}, - } - - _attribute_map = { - 'match_variable': {'key': 'matchVariable', 'type': 'str'}, - 'selector': {'key': 'selector', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_value': {'key': 'matchValue', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MatchCondition, self).__init__(**kwargs) - self.match_variable = kwargs['match_variable'] - self.selector = kwargs.get('selector', None) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_value = kwargs['match_value'] - self.transforms = kwargs.get('transforms', None) - - -class PolicySettings(msrest.serialization.Model): - """Defines top-level WebApplicationFirewallPolicy configuration settings. - - :param enabled_state: Describes if the policy is in enabled or disabled state. Defaults to - Enabled if not specified. Possible values include: "Disabled", "Enabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.PolicyEnabledState - :param mode: Describes if it is in detection mode or prevention mode at policy level. Possible - values include: "Prevention", "Detection". - :type mode: str or ~azure.mgmt.frontdoor.models.PolicyMode - :param redirect_url: If action type is redirect, this field represents redirect URL for the - client. - :type redirect_url: str - :param custom_block_response_status_code: If the action type is block, customer can override - the response status code. - :type custom_block_response_status_code: int - :param custom_block_response_body: If the action type is block, customer can override the - response body. The body must be specified in base64 encoding. - :type custom_block_response_body: str - :param request_body_check: Describes if policy managed rules will inspect the request body - content. Possible values include: "Disabled", "Enabled". - :type request_body_check: str or ~azure.mgmt.frontdoor.models.PolicyRequestBodyCheck - """ - - _validation = { - 'custom_block_response_body': {'pattern': r'^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$'}, - } - - _attribute_map = { - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'redirect_url': {'key': 'redirectUrl', 'type': 'str'}, - 'custom_block_response_status_code': {'key': 'customBlockResponseStatusCode', 'type': 'int'}, - 'custom_block_response_body': {'key': 'customBlockResponseBody', 'type': 'str'}, - 'request_body_check': {'key': 'requestBodyCheck', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PolicySettings, self).__init__(**kwargs) - self.enabled_state = kwargs.get('enabled_state', None) - self.mode = kwargs.get('mode', None) - self.redirect_url = kwargs.get('redirect_url', None) - self.custom_block_response_status_code = kwargs.get('custom_block_response_status_code', None) - self.custom_block_response_body = kwargs.get('custom_block_response_body', None) - self.request_body_check = kwargs.get('request_body_check', None) - - -class PreconfiguredEndpoint(Resource): - """Defines the properties of a preconfigured endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of the endpoint. - :type description: str - :param endpoint: The endpoint that is preconfigured. - :type endpoint: str - :param endpoint_type: The type of endpoint. Possible values include: "AFD", "AzureRegion", - "CDN", "ATM". - :type endpoint_type: str or ~azure.mgmt.frontdoor.models.EndpointType - :param backend: The preconfigured endpoint backend. - :type backend: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'endpoint_type': {'key': 'properties.endpointType', 'type': 'str'}, - 'backend': {'key': 'properties.backend', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PreconfiguredEndpoint, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.endpoint = kwargs.get('endpoint', None) - self.endpoint_type = kwargs.get('endpoint_type', None) - self.backend = kwargs.get('backend', None) - - -class PreconfiguredEndpointList(msrest.serialization.Model): - """Defines a list of preconfigured endpoints. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of PreconfiguredEndpoints supported by NetworkExperiment. - :vartype value: list[~azure.mgmt.frontdoor.models.PreconfiguredEndpoint] - :param next_link: URL to get the next set of PreconfiguredEndpoints if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PreconfiguredEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PreconfiguredEndpointList, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class Profile(Resource): - """Defines an Network Experiment Profile and lists of Experiments. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param etag: Gets a unique read-only string that changes whenever the resource is updated. - :type etag: str - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.NetworkExperimentResourceState - :param enabled_state: The state of the Experiment. Possible values include: "Enabled", - "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.State - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Profile, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.resource_state = None - self.enabled_state = kwargs.get('enabled_state', None) - - -class ProfileList(msrest.serialization.Model): - """Defines a list of Profiles. It contains a list of Profile objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Profiles within a resource group. - :vartype value: list[~azure.mgmt.frontdoor.models.Profile] - :param next_link: URL to get the next set of Profile objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Profile]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProfileList, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class ProfileUpdateModel(msrest.serialization.Model): - """Defines modifiable attributes of a Profile. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param enabled_state: The enabled state of the Profile. Possible values include: "Enabled", - "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.State - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProfileUpdateModel, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.enabled_state = kwargs.get('enabled_state', None) - - -class PurgeParameters(msrest.serialization.Model): - """Parameters required for content purge. - - All required parameters must be populated in order to send to Azure. - - :param content_paths: Required. The path to the content to be purged. Can describe a file path - or a wild card directory. - :type content_paths: list[str] - """ - - _validation = { - 'content_paths': {'required': True}, - } - - _attribute_map = { - 'content_paths': {'key': 'contentPaths', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PurgeParameters, self).__init__(**kwargs) - self.content_paths = kwargs['content_paths'] - - -class RedirectConfiguration(RouteConfiguration): - """Describes Redirect Route. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. Constant filled by server. - :type odata_type: str - :param redirect_type: The redirect type the rule will use when redirecting traffic. Possible - values include: "Moved", "Found", "TemporaryRedirect", "PermanentRedirect". - :type redirect_type: str or ~azure.mgmt.frontdoor.models.FrontDoorRedirectType - :param redirect_protocol: The protocol of the destination to where the traffic is redirected. - Possible values include: "HttpOnly", "HttpsOnly", "MatchRequest". - :type redirect_protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorRedirectProtocol - :param custom_host: Host to redirect. Leave empty to use the incoming host as the destination - host. - :type custom_host: str - :param custom_path: The full path to redirect. Path cannot be empty and must start with /. - Leave empty to use the incoming path as destination path. - :type custom_path: str - :param custom_fragment: Fragment to add to the redirect URL. Fragment is the part of the URL - that comes after #. Do not include the #. - :type custom_fragment: str - :param custom_query_string: The set of query strings to be placed in the redirect URL. Setting - this value would replace any existing query string; leave empty to preserve the incoming query - string. Query string must be in :code:``=:code:`` format. The first ? and & will be - added automatically so do not include them in the front, but do separate multiple query strings - with &. - :type custom_query_string: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'redirect_type': {'key': 'redirectType', 'type': 'str'}, - 'redirect_protocol': {'key': 'redirectProtocol', 'type': 'str'}, - 'custom_host': {'key': 'customHost', 'type': 'str'}, - 'custom_path': {'key': 'customPath', 'type': 'str'}, - 'custom_fragment': {'key': 'customFragment', 'type': 'str'}, - 'custom_query_string': {'key': 'customQueryString', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RedirectConfiguration, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration' # type: str - self.redirect_type = kwargs.get('redirect_type', None) - self.redirect_protocol = kwargs.get('redirect_protocol', None) - self.custom_host = kwargs.get('custom_host', None) - self.custom_path = kwargs.get('custom_path', None) - self.custom_fragment = kwargs.get('custom_fragment', None) - self.custom_query_string = kwargs.get('custom_query_string', None) - - -class RoutingRule(SubResource): - """A routing rule represents a specification for traffic to treat and where to send it, along with health probe information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: Resource ID. - :type id: str - :param name: Resource name. - :type name: str - :ivar type: Resource type. - :vartype type: str - :param frontend_endpoints: Frontend endpoints associated with this rule. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] - :param accepted_protocols: Protocol schemes to match for this rule. - :type accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or - 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState - :param route_configuration: A reference to the routing configuration. - :type route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration - :param rules_engine: A reference to a specific Rules Engine Configuration to apply to this - route. - :type rules_engine: ~azure.mgmt.frontdoor.models.SubResource - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - each routing rule (if applicable). - :type web_application_firewall_policy_link: - ~azure.mgmt.frontdoor.models.RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - """ - - _validation = { - 'type': {'readonly': True}, - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'frontend_endpoints': {'key': 'properties.frontendEndpoints', 'type': '[SubResource]'}, - 'accepted_protocols': {'key': 'properties.acceptedProtocols', 'type': '[str]'}, - 'patterns_to_match': {'key': 'properties.patternsToMatch', 'type': '[str]'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - 'route_configuration': {'key': 'properties.routeConfiguration', 'type': 'RouteConfiguration'}, - 'rules_engine': {'key': 'properties.rulesEngine', 'type': 'SubResource'}, - 'web_application_firewall_policy_link': {'key': 'properties.webApplicationFirewallPolicyLink', 'type': 'RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingRule, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = None - self.frontend_endpoints = kwargs.get('frontend_endpoints', None) - self.accepted_protocols = kwargs.get('accepted_protocols', None) - self.patterns_to_match = kwargs.get('patterns_to_match', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.route_configuration = kwargs.get('route_configuration', None) - self.rules_engine = kwargs.get('rules_engine', None) - self.web_application_firewall_policy_link = kwargs.get('web_application_firewall_policy_link', None) - self.resource_state = None - - -class RoutingRuleLink(msrest.serialization.Model): - """Defines the Resource ID for a Routing Rule. - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingRuleLink, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class RoutingRuleListResult(msrest.serialization.Model): - """Result of the request to list Routing Rules. It contains a list of Routing Rule objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Routing Rules within a Front Door. - :vartype value: list[~azure.mgmt.frontdoor.models.RoutingRule] - :param next_link: URL to get the next set of RoutingRule objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RoutingRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingRuleListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class RoutingRuleUpdateParameters(msrest.serialization.Model): - """Routing rules to apply to an endpoint. - - :param frontend_endpoints: Frontend endpoints associated with this rule. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] - :param accepted_protocols: Protocol schemes to match for this rule. - :type accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or - 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState - :param route_configuration: A reference to the routing configuration. - :type route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration - :param rules_engine: A reference to a specific Rules Engine Configuration to apply to this - route. - :type rules_engine: ~azure.mgmt.frontdoor.models.SubResource - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - each routing rule (if applicable). - :type web_application_firewall_policy_link: - ~azure.mgmt.frontdoor.models.RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink - """ - - _attribute_map = { - 'frontend_endpoints': {'key': 'frontendEndpoints', 'type': '[SubResource]'}, - 'accepted_protocols': {'key': 'acceptedProtocols', 'type': '[str]'}, - 'patterns_to_match': {'key': 'patternsToMatch', 'type': '[str]'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'route_configuration': {'key': 'routeConfiguration', 'type': 'RouteConfiguration'}, - 'rules_engine': {'key': 'rulesEngine', 'type': 'SubResource'}, - 'web_application_firewall_policy_link': {'key': 'webApplicationFirewallPolicyLink', 'type': 'RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingRuleUpdateParameters, self).__init__(**kwargs) - self.frontend_endpoints = kwargs.get('frontend_endpoints', None) - self.accepted_protocols = kwargs.get('accepted_protocols', None) - self.patterns_to_match = kwargs.get('patterns_to_match', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.route_configuration = kwargs.get('route_configuration', None) - self.rules_engine = kwargs.get('rules_engine', None) - self.web_application_firewall_policy_link = kwargs.get('web_application_firewall_policy_link', None) - - -class RoutingRuleProperties(RoutingRuleUpdateParameters): - """The JSON object that contains the properties required to create a routing rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param frontend_endpoints: Frontend endpoints associated with this rule. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] - :param accepted_protocols: Protocol schemes to match for this rule. - :type accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or - 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState - :param route_configuration: A reference to the routing configuration. - :type route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration - :param rules_engine: A reference to a specific Rules Engine Configuration to apply to this - route. - :type rules_engine: ~azure.mgmt.frontdoor.models.SubResource - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - each routing rule (if applicable). - :type web_application_firewall_policy_link: - ~azure.mgmt.frontdoor.models.RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - """ - - _validation = { - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'frontend_endpoints': {'key': 'frontendEndpoints', 'type': '[SubResource]'}, - 'accepted_protocols': {'key': 'acceptedProtocols', 'type': '[str]'}, - 'patterns_to_match': {'key': 'patternsToMatch', 'type': '[str]'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'route_configuration': {'key': 'routeConfiguration', 'type': 'RouteConfiguration'}, - 'rules_engine': {'key': 'rulesEngine', 'type': 'SubResource'}, - 'web_application_firewall_policy_link': {'key': 'webApplicationFirewallPolicyLink', 'type': 'RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingRuleProperties, self).__init__(**kwargs) - self.resource_state = None - - -class RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink(msrest.serialization.Model): - """Defines the Web Application Firewall policy for each routing rule (if applicable). - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class RulesEngine(msrest.serialization.Model): - """A rules engine configuration containing a list of rules that will run to modify the runtime behavior of the request and response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar id: Resource ID. - :vartype id: str - :param rules: A list of rules that define a particular Rules Engine Configuration. - :type rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'id': {'readonly': True}, - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'rules': {'key': 'properties.rules', 'type': '[RulesEngineRule]'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RulesEngine, self).__init__(**kwargs) - self.name = None - self.type = None - self.id = None - self.rules = kwargs.get('rules', None) - self.resource_state = None - - -class RulesEngineAction(msrest.serialization.Model): - """One or more actions that will execute, modifying the request and/or response. - - :param request_header_actions: A list of header actions to apply from the request from AFD to - the origin. - :type request_header_actions: list[~azure.mgmt.frontdoor.models.HeaderAction] - :param response_header_actions: A list of header actions to apply from the response from AFD to - the client. - :type response_header_actions: list[~azure.mgmt.frontdoor.models.HeaderAction] - :param route_configuration_override: Override the route configuration. - :type route_configuration_override: ~azure.mgmt.frontdoor.models.RouteConfiguration - """ - - _attribute_map = { - 'request_header_actions': {'key': 'requestHeaderActions', 'type': '[HeaderAction]'}, - 'response_header_actions': {'key': 'responseHeaderActions', 'type': '[HeaderAction]'}, - 'route_configuration_override': {'key': 'routeConfigurationOverride', 'type': 'RouteConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(RulesEngineAction, self).__init__(**kwargs) - self.request_header_actions = kwargs.get('request_header_actions', None) - self.response_header_actions = kwargs.get('response_header_actions', None) - self.route_configuration_override = kwargs.get('route_configuration_override', None) - - -class RulesEngineListResult(msrest.serialization.Model): - """Result of the request to list Rules Engine Configurations. It contains a list of RulesEngine objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of rulesEngines within a Front Door. - :vartype value: list[~azure.mgmt.frontdoor.models.RulesEngine] - :param next_link: URL to get the next set of RulesEngine objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RulesEngine]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RulesEngineListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class RulesEngineMatchCondition(msrest.serialization.Model): - """Define a match condition. - - All required parameters must be populated in order to send to Azure. - - :param rules_engine_match_variable: Required. Match Variable. Possible values include: - "IsMobile", "RemoteAddr", "RequestMethod", "QueryString", "PostArgs", "RequestUri", - "RequestPath", "RequestFilename", "RequestFilenameExtension", "RequestHeader", "RequestBody", - "RequestScheme". - :type rules_engine_match_variable: str or ~azure.mgmt.frontdoor.models.RulesEngineMatchVariable - :param selector: Name of selector in RequestHeader or RequestBody to be matched. - :type selector: str - :param rules_engine_operator: Required. Describes operator to apply to the match condition. - Possible values include: "Any", "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", - "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", "EndsWith". - :type rules_engine_operator: str or ~azure.mgmt.frontdoor.models.RulesEngineOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param rules_engine_match_value: Required. Match values to match against. The operator will - apply to each value in here with OR semantics. If any of them match the variable with the given - operator this match condition is considered a match. - :type rules_engine_match_value: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.frontdoor.models.Transform] - """ - - _validation = { - 'rules_engine_match_variable': {'required': True}, - 'rules_engine_operator': {'required': True}, - 'rules_engine_match_value': {'required': True}, - } - - _attribute_map = { - 'rules_engine_match_variable': {'key': 'rulesEngineMatchVariable', 'type': 'str'}, - 'selector': {'key': 'selector', 'type': 'str'}, - 'rules_engine_operator': {'key': 'rulesEngineOperator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'rules_engine_match_value': {'key': 'rulesEngineMatchValue', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(RulesEngineMatchCondition, self).__init__(**kwargs) - self.rules_engine_match_variable = kwargs['rules_engine_match_variable'] - self.selector = kwargs.get('selector', None) - self.rules_engine_operator = kwargs['rules_engine_operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.rules_engine_match_value = kwargs['rules_engine_match_value'] - self.transforms = kwargs.get('transforms', None) - - -class RulesEngineUpdateParameters(msrest.serialization.Model): - """Rules Engine Configuration to apply to a Routing Rule. - - :param rules: A list of rules that define a particular Rules Engine Configuration. - :type rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] - """ - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[RulesEngineRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(RulesEngineUpdateParameters, self).__init__(**kwargs) - self.rules = kwargs.get('rules', None) - - -class RulesEngineProperties(RulesEngineUpdateParameters): - """The JSON object that contains the properties required to create a Rules Engine Configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param rules: A list of rules that define a particular Rules Engine Configuration. - :type rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] - :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", - "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState - """ - - _validation = { - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[RulesEngineRule]'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RulesEngineProperties, self).__init__(**kwargs) - self.resource_state = None - - -class RulesEngineRule(msrest.serialization.Model): - """Contains a list of match conditions, and an action on how to modify the request/response. If multiple rules match, the actions from one rule that conflict with a previous rule overwrite for a singular action, or append in the case of headers manipulation. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. A name to refer to this specific rule. - :type name: str - :param priority: Required. A priority assigned to this rule. - :type priority: int - :param action: Required. Actions to perform on the request and response if all of the match - conditions are met. - :type action: ~azure.mgmt.frontdoor.models.RulesEngineAction - :param match_conditions: A list of match conditions that must meet in order for the actions of - this rule to run. Having no match conditions means the actions will always run. - :type match_conditions: list[~azure.mgmt.frontdoor.models.RulesEngineMatchCondition] - :param match_processing_behavior: If this rule is a match should the rules engine continue - running the remaining rules or stop. If not present, defaults to Continue. Possible values - include: "Continue", "Stop". - :type match_processing_behavior: str or ~azure.mgmt.frontdoor.models.MatchProcessingBehavior - """ - - _validation = { - 'name': {'required': True}, - 'priority': {'required': True}, - 'action': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'priority': {'key': 'priority', 'type': 'int'}, - 'action': {'key': 'action', 'type': 'RulesEngineAction'}, - 'match_conditions': {'key': 'matchConditions', 'type': '[RulesEngineMatchCondition]'}, - 'match_processing_behavior': {'key': 'matchProcessingBehavior', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RulesEngineRule, self).__init__(**kwargs) - self.name = kwargs['name'] - self.priority = kwargs['priority'] - self.action = kwargs['action'] - self.match_conditions = kwargs.get('match_conditions', None) - self.match_processing_behavior = kwargs.get('match_processing_behavior', None) - - -class SecurityPolicyLink(msrest.serialization.Model): - """Defines the Resource ID for a Security Policy. - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityPolicyLink, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class Sku(msrest.serialization.Model): - """The pricing tier of the web application firewall policy. - - :param name: Name of the pricing tier. Possible values include: "Classic_AzureFrontDoor", - "Standard_AzureFrontDoor", "Premium_AzureFrontDoor". - :type name: str or ~azure.mgmt.frontdoor.models.SkuName - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class TagsObject(msrest.serialization.Model): - """Tags object for patch operations. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TagsObject, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class Timeseries(Resource): - """Defines the Timeseries. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param endpoint: The endpoint associated with the Timeseries data point. - :type endpoint: str - :param start_date_time_utc: The start DateTime of the Timeseries in UTC. - :type start_date_time_utc: str - :param end_date_time_utc: The end DateTime of the Timeseries in UTC. - :type end_date_time_utc: str - :param aggregation_interval: The aggregation interval of the Timeseries. Possible values - include: "Hourly", "Daily". - :type aggregation_interval: str or ~azure.mgmt.frontdoor.models.AggregationInterval - :param timeseries_type: The type of Timeseries. Possible values include: "MeasurementCounts", - "LatencyP50", "LatencyP75", "LatencyP95". - :type timeseries_type: str or ~azure.mgmt.frontdoor.models.TimeseriesType - :param country: The country associated with the Timeseries. Values are country ISO codes as - specified here- https://www.iso.org/iso-3166-country-codes.html. - :type country: str - :param timeseries_data: The set of data points for the timeseries. - :type timeseries_data: list[~azure.mgmt.frontdoor.models.TimeseriesDataPoint] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'start_date_time_utc': {'key': 'properties.startDateTimeUTC', 'type': 'str'}, - 'end_date_time_utc': {'key': 'properties.endDateTimeUTC', 'type': 'str'}, - 'aggregation_interval': {'key': 'properties.aggregationInterval', 'type': 'str'}, - 'timeseries_type': {'key': 'properties.timeseriesType', 'type': 'str'}, - 'country': {'key': 'properties.country', 'type': 'str'}, - 'timeseries_data': {'key': 'properties.timeseriesData', 'type': '[TimeseriesDataPoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(Timeseries, self).__init__(**kwargs) - self.endpoint = kwargs.get('endpoint', None) - self.start_date_time_utc = kwargs.get('start_date_time_utc', None) - self.end_date_time_utc = kwargs.get('end_date_time_utc', None) - self.aggregation_interval = kwargs.get('aggregation_interval', None) - self.timeseries_type = kwargs.get('timeseries_type', None) - self.country = kwargs.get('country', None) - self.timeseries_data = kwargs.get('timeseries_data', None) - - -class TimeseriesDataPoint(msrest.serialization.Model): - """Defines a timeseries datapoint used in a timeseries. - - :param date_time_utc: The DateTime of the Timeseries data point in UTC. - :type date_time_utc: str - :param value: The Value of the Timeseries data point. - :type value: float - """ - - _attribute_map = { - 'date_time_utc': {'key': 'dateTimeUTC', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(TimeseriesDataPoint, self).__init__(**kwargs) - self.date_time_utc = kwargs.get('date_time_utc', None) - self.value = kwargs.get('value', None) - - -class ValidateCustomDomainInput(msrest.serialization.Model): - """Input of the custom domain to be validated for DNS mapping. - - All required parameters must be populated in order to send to Azure. - - :param host_name: Required. The host name of the custom domain. Must be a domain name. - :type host_name: str - """ - - _validation = { - 'host_name': {'required': True}, - } - - _attribute_map = { - 'host_name': {'key': 'hostName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ValidateCustomDomainInput, self).__init__(**kwargs) - self.host_name = kwargs['host_name'] - - -class ValidateCustomDomainOutput(msrest.serialization.Model): - """Output of custom domain validation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar custom_domain_validated: Indicates whether the custom domain is valid or not. - :vartype custom_domain_validated: bool - :ivar reason: The reason why the custom domain is not valid. - :vartype reason: str - :ivar message: Error message describing why the custom domain is not valid. - :vartype message: str - """ - - _validation = { - 'custom_domain_validated': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'custom_domain_validated': {'key': 'customDomainValidated', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ValidateCustomDomainOutput, self).__init__(**kwargs) - self.custom_domain_validated = None - self.reason = None - self.message = None - - -class WebApplicationFirewallPolicy(Resource): - """Defines web application firewall policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param etag: Gets a unique read-only string that changes whenever the resource is updated. - :type etag: str - :param sku: The pricing tier of web application firewall policy. Defaults to - Classic_AzureFrontDoor if not specified. - :type sku: ~azure.mgmt.frontdoor.models.Sku - :param policy_settings: Describes settings for the policy. - :type policy_settings: ~azure.mgmt.frontdoor.models.PolicySettings - :param custom_rules: Describes custom rules inside the policy. - :type custom_rules: ~azure.mgmt.frontdoor.models.CustomRuleList - :param managed_rules: Describes managed rules inside the policy. - :type managed_rules: ~azure.mgmt.frontdoor.models.ManagedRuleSetList - :ivar frontend_endpoint_links: Describes Frontend Endpoints associated with this Web - Application Firewall policy. - :vartype frontend_endpoint_links: list[~azure.mgmt.frontdoor.models.FrontendEndpointLink] - :ivar routing_rule_links: Describes Routing Rules associated with this Web Application Firewall - policy. - :vartype routing_rule_links: list[~azure.mgmt.frontdoor.models.RoutingRuleLink] - :ivar security_policy_links: Describes Security Policy associated with this Web Application - Firewall policy. - :vartype security_policy_links: list[~azure.mgmt.frontdoor.models.SecurityPolicyLink] - :ivar provisioning_state: Provisioning state of the policy. - :vartype provisioning_state: str - :ivar resource_state: Resource status of the policy. Possible values include: "Creating", - "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.frontdoor.models.PolicyResourceState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'frontend_endpoint_links': {'readonly': True}, - 'routing_rule_links': {'readonly': True}, - 'security_policy_links': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'policy_settings': {'key': 'properties.policySettings', 'type': 'PolicySettings'}, - 'custom_rules': {'key': 'properties.customRules', 'type': 'CustomRuleList'}, - 'managed_rules': {'key': 'properties.managedRules', 'type': 'ManagedRuleSetList'}, - 'frontend_endpoint_links': {'key': 'properties.frontendEndpointLinks', 'type': '[FrontendEndpointLink]'}, - 'routing_rule_links': {'key': 'properties.routingRuleLinks', 'type': '[RoutingRuleLink]'}, - 'security_policy_links': {'key': 'properties.securityPolicyLinks', 'type': '[SecurityPolicyLink]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebApplicationFirewallPolicy, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.sku = kwargs.get('sku', None) - self.policy_settings = kwargs.get('policy_settings', None) - self.custom_rules = kwargs.get('custom_rules', None) - self.managed_rules = kwargs.get('managed_rules', None) - self.frontend_endpoint_links = None - self.routing_rule_links = None - self.security_policy_links = None - self.provisioning_state = None - self.resource_state = None - - -class WebApplicationFirewallPolicyList(msrest.serialization.Model): - """Defines a list of WebApplicationFirewallPolicies. It contains a list of WebApplicationFirewallPolicy objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of WebApplicationFirewallPolicies within a resource group. - :vartype value: list[~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicy] - :param next_link: URL to get the next set of WebApplicationFirewallPolicy objects if there are - any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WebApplicationFirewallPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WebApplicationFirewallPolicyList, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_models_py3.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_models_py3.py index 6b92523bcb4de..496205fa88c53 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_models_py3.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/models/_models_py3.py @@ -18,11 +18,11 @@ class AzureAsyncOperationResult(msrest.serialization.Model): """The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. - :param status: Status of the Azure async operation. Possible values are: 'InProgress', + :ivar status: Status of the Azure async operation. Possible values are: 'InProgress', 'Succeeded', and 'Failed'. Possible values include: "InProgress", "Succeeded", "Failed". - :type status: str or ~azure.mgmt.frontdoor.models.NetworkOperationStatus - :param error: - :type error: ~azure.mgmt.frontdoor.models.Error + :vartype status: str or ~azure.mgmt.frontdoor.models.NetworkOperationStatus + :ivar error: + :vartype error: ~azure.mgmt.frontdoor.models.Error """ _attribute_map = { @@ -37,6 +37,13 @@ def __init__( error: Optional["Error"] = None, **kwargs ): + """ + :keyword status: Status of the Azure async operation. Possible values are: 'InProgress', + 'Succeeded', and 'Failed'. Possible values include: "InProgress", "Succeeded", "Failed". + :paramtype status: str or ~azure.mgmt.frontdoor.models.NetworkOperationStatus + :keyword error: + :paramtype error: ~azure.mgmt.frontdoor.models.Error + """ super(AzureAsyncOperationResult, self).__init__(**kwargs) self.status = status self.error = error @@ -47,38 +54,38 @@ class Backend(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param address: Location of the backend (IP address or FQDN). - :type address: str - :param private_link_alias: The Alias of the Private Link resource. Populating this optional + :ivar address: Location of the backend (IP address or FQDN). + :vartype address: str + :ivar private_link_alias: The Alias of the Private Link resource. Populating this optional field indicates that this backend is 'Private'. - :type private_link_alias: str - :param private_link_resource_id: The Resource Id of the Private Link resource. Populating this + :vartype private_link_alias: str + :ivar private_link_resource_id: The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is 'Private'. - :type private_link_resource_id: str - :param private_link_location: The location of the Private Link resource. Required only if + :vartype private_link_resource_id: str + :ivar private_link_location: The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated. - :type private_link_location: str + :vartype private_link_location: str :ivar private_endpoint_status: The Approval status for the connection to the Private Link. Possible values include: "Pending", "Approved", "Rejected", "Disconnected", "Timeout". :vartype private_endpoint_status: str or ~azure.mgmt.frontdoor.models.PrivateEndpointStatus - :param private_link_approval_message: A custom message to be included in the approval request - to connect to the Private Link. - :type private_link_approval_message: str - :param http_port: The HTTP TCP port number. Must be between 1 and 65535. - :type http_port: int - :param https_port: The HTTPS TCP port number. Must be between 1 and 65535. - :type https_port: int - :param enabled_state: Whether to enable use of this backend. Permitted values are 'Enabled' or + :ivar private_link_approval_message: A custom message to be included in the approval request to + connect to the Private Link. + :vartype private_link_approval_message: str + :ivar http_port: The HTTP TCP port number. Must be between 1 and 65535. + :vartype http_port: int + :ivar https_port: The HTTPS TCP port number. Must be between 1 and 65535. + :vartype https_port: int + :ivar enabled_state: Whether to enable use of this backend. Permitted values are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.BackendEnabledState - :param priority: Priority to use for load balancing. Higher priorities will not be used for - load balancing if any lower priority backend is healthy. - :type priority: int - :param weight: Weight of this endpoint for load balancing purposes. - :type weight: int - :param backend_host_header: The value to use as the host header sent to the backend. If blank - or unspecified, this defaults to the incoming host. - :type backend_host_header: str + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.BackendEnabledState + :ivar priority: Priority to use for load balancing. Higher priorities will not be used for load + balancing if any lower priority backend is healthy. + :vartype priority: int + :ivar weight: Weight of this endpoint for load balancing purposes. + :vartype weight: int + :ivar backend_host_header: The value to use as the host header sent to the backend. If blank or + unspecified, this defaults to the incoming host. + :vartype backend_host_header: str """ _validation = { @@ -120,6 +127,37 @@ def __init__( backend_host_header: Optional[str] = None, **kwargs ): + """ + :keyword address: Location of the backend (IP address or FQDN). + :paramtype address: str + :keyword private_link_alias: The Alias of the Private Link resource. Populating this optional + field indicates that this backend is 'Private'. + :paramtype private_link_alias: str + :keyword private_link_resource_id: The Resource Id of the Private Link resource. Populating + this optional field indicates that this backend is 'Private'. + :paramtype private_link_resource_id: str + :keyword private_link_location: The location of the Private Link resource. Required only if + 'privateLinkResourceId' is populated. + :paramtype private_link_location: str + :keyword private_link_approval_message: A custom message to be included in the approval request + to connect to the Private Link. + :paramtype private_link_approval_message: str + :keyword http_port: The HTTP TCP port number. Must be between 1 and 65535. + :paramtype http_port: int + :keyword https_port: The HTTPS TCP port number. Must be between 1 and 65535. + :paramtype https_port: int + :keyword enabled_state: Whether to enable use of this backend. Permitted values are 'Enabled' + or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.BackendEnabledState + :keyword priority: Priority to use for load balancing. Higher priorities will not be used for + load balancing if any lower priority backend is healthy. + :paramtype priority: int + :keyword weight: Weight of this endpoint for load balancing purposes. + :paramtype weight: int + :keyword backend_host_header: The value to use as the host header sent to the backend. If blank + or unspecified, this defaults to the incoming host. + :paramtype backend_host_header: str + """ super(Backend, self).__init__(**kwargs) self.address = address self.private_link_alias = private_link_alias @@ -138,8 +176,8 @@ def __init__( class SubResource(msrest.serialization.Model): """Reference to another subresource. - :param id: Resource ID. - :type id: str + :ivar id: Resource ID. + :vartype id: str """ _attribute_map = { @@ -152,6 +190,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -161,18 +203,18 @@ class BackendPool(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str - :param name: Resource name. - :type name: str + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str :ivar type: Resource type. :vartype type: str - :param backends: The set of backends for this pool. - :type backends: list[~azure.mgmt.frontdoor.models.Backend] - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource - :param health_probe_settings: L7 health probe settings for a backend pool. - :type health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource + :ivar backends: The set of backends for this pool. + :vartype backends: list[~azure.mgmt.frontdoor.models.Backend] + :ivar load_balancing_settings: Load balancing settings for a backend pool. + :vartype load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource + :ivar health_probe_settings: L7 health probe settings for a backend pool. + :vartype health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState @@ -203,6 +245,18 @@ def __init__( health_probe_settings: Optional["SubResource"] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Resource name. + :paramtype name: str + :keyword backends: The set of backends for this pool. + :paramtype backends: list[~azure.mgmt.frontdoor.models.Backend] + :keyword load_balancing_settings: Load balancing settings for a backend pool. + :paramtype load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource + :keyword health_probe_settings: L7 health probe settings for a backend pool. + :paramtype health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource + """ super(BackendPool, self).__init__(id=id, **kwargs) self.name = name self.type = None @@ -219,8 +273,8 @@ class BackendPoolListResult(msrest.serialization.Model): :ivar value: List of Backend Pools within a Front Door. :vartype value: list[~azure.mgmt.frontdoor.models.BackendPool] - :param next_link: URL to get the next set of BackendPool objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of BackendPool objects if there are any. + :vartype next_link: str """ _validation = { @@ -238,6 +292,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of BackendPool objects if there are any. + :paramtype next_link: str + """ super(BackendPoolListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -246,12 +304,12 @@ def __init__( class BackendPoolUpdateParameters(msrest.serialization.Model): """A collection of backends that can be routed to. - :param backends: The set of backends for this pool. - :type backends: list[~azure.mgmt.frontdoor.models.Backend] - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource - :param health_probe_settings: L7 health probe settings for a backend pool. - :type health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource + :ivar backends: The set of backends for this pool. + :vartype backends: list[~azure.mgmt.frontdoor.models.Backend] + :ivar load_balancing_settings: Load balancing settings for a backend pool. + :vartype load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource + :ivar health_probe_settings: L7 health probe settings for a backend pool. + :vartype health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource """ _attribute_map = { @@ -268,6 +326,14 @@ def __init__( health_probe_settings: Optional["SubResource"] = None, **kwargs ): + """ + :keyword backends: The set of backends for this pool. + :paramtype backends: list[~azure.mgmt.frontdoor.models.Backend] + :keyword load_balancing_settings: Load balancing settings for a backend pool. + :paramtype load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource + :keyword health_probe_settings: L7 health probe settings for a backend pool. + :paramtype health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource + """ super(BackendPoolUpdateParameters, self).__init__(**kwargs) self.backends = backends self.load_balancing_settings = load_balancing_settings @@ -279,12 +345,12 @@ class BackendPoolProperties(BackendPoolUpdateParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param backends: The set of backends for this pool. - :type backends: list[~azure.mgmt.frontdoor.models.Backend] - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource - :param health_probe_settings: L7 health probe settings for a backend pool. - :type health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource + :ivar backends: The set of backends for this pool. + :vartype backends: list[~azure.mgmt.frontdoor.models.Backend] + :ivar load_balancing_settings: Load balancing settings for a backend pool. + :vartype load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource + :ivar health_probe_settings: L7 health probe settings for a backend pool. + :vartype health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState @@ -309,6 +375,14 @@ def __init__( health_probe_settings: Optional["SubResource"] = None, **kwargs ): + """ + :keyword backends: The set of backends for this pool. + :paramtype backends: list[~azure.mgmt.frontdoor.models.Backend] + :keyword load_balancing_settings: Load balancing settings for a backend pool. + :paramtype load_balancing_settings: ~azure.mgmt.frontdoor.models.SubResource + :keyword health_probe_settings: L7 health probe settings for a backend pool. + :paramtype health_probe_settings: ~azure.mgmt.frontdoor.models.SubResource + """ super(BackendPoolProperties, self).__init__(backends=backends, load_balancing_settings=load_balancing_settings, health_probe_settings=health_probe_settings, **kwargs) self.resource_state = None @@ -316,14 +390,14 @@ def __init__( class BackendPoolsSettings(msrest.serialization.Model): """Settings that apply to all backend pools. - :param enforce_certificate_name_check: Whether to enforce certificate name check on HTTPS + :ivar enforce_certificate_name_check: Whether to enforce certificate name check on HTTPS requests to all backend pools. No effect on non-HTTPS requests. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type enforce_certificate_name_check: str or + :vartype enforce_certificate_name_check: str or ~azure.mgmt.frontdoor.models.EnforceCertificateNameCheckEnabledState - :param send_recv_timeout_seconds: Send and receive timeout on forwarding request to the - backend. When timeout is reached, the request fails and returns. - :type send_recv_timeout_seconds: int + :ivar send_recv_timeout_seconds: Send and receive timeout on forwarding request to the backend. + When timeout is reached, the request fails and returns. + :vartype send_recv_timeout_seconds: int """ _validation = { @@ -342,6 +416,16 @@ def __init__( send_recv_timeout_seconds: Optional[int] = None, **kwargs ): + """ + :keyword enforce_certificate_name_check: Whether to enforce certificate name check on HTTPS + requests to all backend pools. No effect on non-HTTPS requests. Possible values include: + "Enabled", "Disabled". Default value: "Enabled". + :paramtype enforce_certificate_name_check: str or + ~azure.mgmt.frontdoor.models.EnforceCertificateNameCheckEnabledState + :keyword send_recv_timeout_seconds: Send and receive timeout on forwarding request to the + backend. When timeout is reached, the request fails and returns. + :paramtype send_recv_timeout_seconds: int + """ super(BackendPoolsSettings, self).__init__(**kwargs) self.enforce_certificate_name_check = enforce_certificate_name_check self.send_recv_timeout_seconds = send_recv_timeout_seconds @@ -350,18 +434,18 @@ def __init__( class CacheConfiguration(msrest.serialization.Model): """Caching settings for a caching-type route. To disable caching, do not provide a cacheConfiguration object. - :param query_parameter_strip_directive: Treatment of URL query terms when forming the cache - key. Possible values include: "StripNone", "StripAll", "StripOnly", "StripAllExcept". - :type query_parameter_strip_directive: str or ~azure.mgmt.frontdoor.models.FrontDoorQuery - :param query_parameters: query parameters to include or exclude (comma separated). - :type query_parameters: str - :param dynamic_compression: Whether to use dynamic compression for cached content. Possible + :ivar query_parameter_strip_directive: Treatment of URL query terms when forming the cache key. + Possible values include: "StripNone", "StripAll", "StripOnly", "StripAllExcept". + :vartype query_parameter_strip_directive: str or ~azure.mgmt.frontdoor.models.FrontDoorQuery + :ivar query_parameters: query parameters to include or exclude (comma separated). + :vartype query_parameters: str + :ivar dynamic_compression: Whether to use dynamic compression for cached content. Possible values include: "Enabled", "Disabled". - :type dynamic_compression: str or ~azure.mgmt.frontdoor.models.DynamicCompressionEnabled - :param cache_duration: The duration for which the content needs to be cached. Allowed format is + :vartype dynamic_compression: str or ~azure.mgmt.frontdoor.models.DynamicCompressionEnabled + :ivar cache_duration: The duration for which the content needs to be cached. Allowed format is in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). HTTP requires the value to be no more than a year. - :type cache_duration: ~datetime.timedelta + :vartype cache_duration: ~datetime.timedelta """ _attribute_map = { @@ -380,6 +464,20 @@ def __init__( cache_duration: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword query_parameter_strip_directive: Treatment of URL query terms when forming the cache + key. Possible values include: "StripNone", "StripAll", "StripOnly", "StripAllExcept". + :paramtype query_parameter_strip_directive: str or ~azure.mgmt.frontdoor.models.FrontDoorQuery + :keyword query_parameters: query parameters to include or exclude (comma separated). + :paramtype query_parameters: str + :keyword dynamic_compression: Whether to use dynamic compression for cached content. Possible + values include: "Enabled", "Disabled". + :paramtype dynamic_compression: str or ~azure.mgmt.frontdoor.models.DynamicCompressionEnabled + :keyword cache_duration: The duration for which the content needs to be cached. Allowed format + is in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). HTTP requires the + value to be no more than a year. + :paramtype cache_duration: ~datetime.timedelta + """ super(CacheConfiguration, self).__init__(**kwargs) self.query_parameter_strip_directive = query_parameter_strip_directive self.query_parameters = query_parameters @@ -392,11 +490,11 @@ class CheckNameAvailabilityInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The resource name to validate. - :type name: str - :param type: Required. The type of the resource whose name is to be validated. Possible values + :ivar name: Required. The resource name to validate. + :vartype name: str + :ivar type: Required. The type of the resource whose name is to be validated. Possible values include: "Microsoft.Network/frontDoors", "Microsoft.Network/frontDoors/frontendEndpoints". - :type type: str or ~azure.mgmt.frontdoor.models.ResourceType + :vartype type: str or ~azure.mgmt.frontdoor.models.ResourceType """ _validation = { @@ -416,6 +514,14 @@ def __init__( type: Union[str, "ResourceType"], **kwargs ): + """ + :keyword name: Required. The resource name to validate. + :paramtype name: str + :keyword type: Required. The type of the resource whose name is to be validated. Possible + values include: "Microsoft.Network/frontDoors", + "Microsoft.Network/frontDoors/frontendEndpoints". + :paramtype type: str or ~azure.mgmt.frontdoor.models.ResourceType + """ super(CheckNameAvailabilityInput, self).__init__(**kwargs) self.name = name self.type = type @@ -451,6 +557,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityOutput, self).__init__(**kwargs) self.name_availability = None self.reason = None @@ -462,25 +570,25 @@ class CustomHttpsConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param certificate_source: Required. Defines the source of the SSL certificate. Possible values + :ivar certificate_source: Required. Defines the source of the SSL certificate. Possible values include: "AzureKeyVault", "FrontDoor". - :type certificate_source: str or ~azure.mgmt.frontdoor.models.FrontDoorCertificateSource - :param protocol_type: Required. Defines the TLS extension protocol that is used for secure + :vartype certificate_source: str or ~azure.mgmt.frontdoor.models.FrontDoorCertificateSource + :ivar protocol_type: Required. Defines the TLS extension protocol that is used for secure delivery. Possible values include: "ServerNameIndication". - :type protocol_type: str or ~azure.mgmt.frontdoor.models.FrontDoorTlsProtocolType - :param minimum_tls_version: Required. The minimum TLS version required from the clients to + :vartype protocol_type: str or ~azure.mgmt.frontdoor.models.FrontDoorTlsProtocolType + :ivar minimum_tls_version: Required. The minimum TLS version required from the clients to establish an SSL handshake with Front Door. Possible values include: "1.0", "1.2". - :type minimum_tls_version: str or ~azure.mgmt.frontdoor.models.MinimumTLSVersion - :param certificate_type: Defines the type of the certificate used for secure connections to a + :vartype minimum_tls_version: str or ~azure.mgmt.frontdoor.models.MinimumTLSVersion + :ivar certificate_type: Defines the type of the certificate used for secure connections to a frontendEndpoint. Possible values include: "Dedicated". - :type certificate_type: str or ~azure.mgmt.frontdoor.models.FrontDoorCertificateType - :param vault: The Key Vault containing the SSL certificate. - :type vault: ~azure.mgmt.frontdoor.models.KeyVaultCertificateSourceParametersVault - :param secret_name: The name of the Key Vault secret representing the full certificate PFX. - :type secret_name: str - :param secret_version: The version of the Key Vault secret representing the full certificate + :vartype certificate_type: str or ~azure.mgmt.frontdoor.models.FrontDoorCertificateType + :ivar vault: The Key Vault containing the SSL certificate. + :vartype vault: ~azure.mgmt.frontdoor.models.KeyVaultCertificateSourceParametersVault + :ivar secret_name: The name of the Key Vault secret representing the full certificate PFX. + :vartype secret_name: str + :ivar secret_version: The version of the Key Vault secret representing the full certificate PFX. - :type secret_version: str + :vartype secret_version: str """ _validation = { @@ -511,6 +619,27 @@ def __init__( secret_version: Optional[str] = None, **kwargs ): + """ + :keyword certificate_source: Required. Defines the source of the SSL certificate. Possible + values include: "AzureKeyVault", "FrontDoor". + :paramtype certificate_source: str or ~azure.mgmt.frontdoor.models.FrontDoorCertificateSource + :keyword protocol_type: Required. Defines the TLS extension protocol that is used for secure + delivery. Possible values include: "ServerNameIndication". + :paramtype protocol_type: str or ~azure.mgmt.frontdoor.models.FrontDoorTlsProtocolType + :keyword minimum_tls_version: Required. The minimum TLS version required from the clients to + establish an SSL handshake with Front Door. Possible values include: "1.0", "1.2". + :paramtype minimum_tls_version: str or ~azure.mgmt.frontdoor.models.MinimumTLSVersion + :keyword certificate_type: Defines the type of the certificate used for secure connections to a + frontendEndpoint. Possible values include: "Dedicated". + :paramtype certificate_type: str or ~azure.mgmt.frontdoor.models.FrontDoorCertificateType + :keyword vault: The Key Vault containing the SSL certificate. + :paramtype vault: ~azure.mgmt.frontdoor.models.KeyVaultCertificateSourceParametersVault + :keyword secret_name: The name of the Key Vault secret representing the full certificate PFX. + :paramtype secret_name: str + :keyword secret_version: The version of the Key Vault secret representing the full certificate + PFX. + :paramtype secret_version: str + """ super(CustomHttpsConfiguration, self).__init__(**kwargs) self.certificate_source = certificate_source self.protocol_type = protocol_type @@ -526,27 +655,27 @@ class CustomRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Describes the name of the rule. - :type name: str - :param priority: Required. Describes priority of the rule. Rules with a lower value will be + :ivar name: Describes the name of the rule. + :vartype name: str + :ivar priority: Required. Describes priority of the rule. Rules with a lower value will be evaluated before rules with a higher value. - :type priority: int - :param enabled_state: Describes if the custom rule is in enabled or disabled state. Defaults to + :vartype priority: int + :ivar enabled_state: Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. Possible values include: "Disabled", "Enabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.CustomRuleEnabledState - :param rule_type: Required. Describes type of rule. Possible values include: "MatchRule", + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.CustomRuleEnabledState + :ivar rule_type: Required. Describes type of rule. Possible values include: "MatchRule", "RateLimitRule". - :type rule_type: str or ~azure.mgmt.frontdoor.models.RuleType - :param rate_limit_duration_in_minutes: Time window for resetting the rate limit count. Default + :vartype rule_type: str or ~azure.mgmt.frontdoor.models.RuleType + :ivar rate_limit_duration_in_minutes: Time window for resetting the rate limit count. Default is 1 minute. - :type rate_limit_duration_in_minutes: int - :param rate_limit_threshold: Number of allowed requests per client within the time window. - :type rate_limit_threshold: int - :param match_conditions: Required. List of match conditions. - :type match_conditions: list[~azure.mgmt.frontdoor.models.MatchCondition] - :param action: Required. Describes what action to be applied when rule matches. Possible values + :vartype rate_limit_duration_in_minutes: int + :ivar rate_limit_threshold: Number of allowed requests per client within the time window. + :vartype rate_limit_threshold: int + :ivar match_conditions: Required. List of match conditions. + :vartype match_conditions: list[~azure.mgmt.frontdoor.models.MatchCondition] + :ivar action: Required. Describes what action to be applied when rule matches. Possible values include: "Allow", "Block", "Log", "Redirect". - :type action: str or ~azure.mgmt.frontdoor.models.ActionType + :vartype action: str or ~azure.mgmt.frontdoor.models.ActionType """ _validation = { @@ -583,6 +712,29 @@ def __init__( rate_limit_threshold: Optional[int] = None, **kwargs ): + """ + :keyword name: Describes the name of the rule. + :paramtype name: str + :keyword priority: Required. Describes priority of the rule. Rules with a lower value will be + evaluated before rules with a higher value. + :paramtype priority: int + :keyword enabled_state: Describes if the custom rule is in enabled or disabled state. Defaults + to Enabled if not specified. Possible values include: "Disabled", "Enabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.CustomRuleEnabledState + :keyword rule_type: Required. Describes type of rule. Possible values include: "MatchRule", + "RateLimitRule". + :paramtype rule_type: str or ~azure.mgmt.frontdoor.models.RuleType + :keyword rate_limit_duration_in_minutes: Time window for resetting the rate limit count. + Default is 1 minute. + :paramtype rate_limit_duration_in_minutes: int + :keyword rate_limit_threshold: Number of allowed requests per client within the time window. + :paramtype rate_limit_threshold: int + :keyword match_conditions: Required. List of match conditions. + :paramtype match_conditions: list[~azure.mgmt.frontdoor.models.MatchCondition] + :keyword action: Required. Describes what action to be applied when rule matches. Possible + values include: "Allow", "Block", "Log", "Redirect". + :paramtype action: str or ~azure.mgmt.frontdoor.models.ActionType + """ super(CustomRule, self).__init__(**kwargs) self.name = name self.priority = priority @@ -597,8 +749,8 @@ def __init__( class CustomRuleList(msrest.serialization.Model): """Defines contents of custom rules. - :param rules: List of rules. - :type rules: list[~azure.mgmt.frontdoor.models.CustomRule] + :ivar rules: List of rules. + :vartype rules: list[~azure.mgmt.frontdoor.models.CustomRule] """ _attribute_map = { @@ -611,6 +763,10 @@ def __init__( rules: Optional[List["CustomRule"]] = None, **kwargs ): + """ + :keyword rules: List of rules. + :paramtype rules: list[~azure.mgmt.frontdoor.models.CustomRule] + """ super(CustomRuleList, self).__init__(**kwargs) self.rules = rules @@ -618,10 +774,10 @@ def __init__( class Endpoint(msrest.serialization.Model): """Defines the endpoint properties. - :param name: The name of the endpoint. - :type name: str - :param endpoint: The endpoint URL. - :type endpoint: str + :ivar name: The name of the endpoint. + :vartype name: str + :ivar endpoint: The endpoint URL. + :vartype endpoint: str """ _attribute_map = { @@ -636,6 +792,12 @@ def __init__( endpoint: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the endpoint. + :paramtype name: str + :keyword endpoint: The endpoint URL. + :paramtype endpoint: str + """ super(Endpoint, self).__init__(**kwargs) self.name = name self.endpoint = endpoint @@ -644,16 +806,16 @@ def __init__( class Error(msrest.serialization.Model): """Error. - :param code: - :type code: str - :param message: - :type message: str - :param target: - :type target: str - :param details: - :type details: list[~azure.mgmt.frontdoor.models.ErrorDetails] - :param inner_error: - :type inner_error: str + :ivar code: + :vartype code: str + :ivar message: + :vartype message: str + :ivar target: + :vartype target: str + :ivar details: + :vartype details: list[~azure.mgmt.frontdoor.models.ErrorDetails] + :ivar inner_error: + :vartype inner_error: str """ _attribute_map = { @@ -674,6 +836,18 @@ def __init__( inner_error: Optional[str] = None, **kwargs ): + """ + :keyword code: + :paramtype code: str + :keyword message: + :paramtype message: str + :keyword target: + :paramtype target: str + :keyword details: + :paramtype details: list[~azure.mgmt.frontdoor.models.ErrorDetails] + :keyword inner_error: + :paramtype inner_error: str + """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -685,12 +859,12 @@ def __init__( class ErrorDetails(msrest.serialization.Model): """ErrorDetails. - :param code: - :type code: str - :param target: - :type target: str - :param message: - :type message: str + :ivar code: + :vartype code: str + :ivar target: + :vartype target: str + :ivar message: + :vartype message: str """ _attribute_map = { @@ -707,6 +881,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: + :paramtype code: str + :keyword target: + :paramtype target: str + :keyword message: + :paramtype message: str + """ super(ErrorDetails, self).__init__(**kwargs) self.code = code self.target = target @@ -738,6 +920,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponse, self).__init__(**kwargs) self.code = None self.message = None @@ -754,10 +938,10 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -781,6 +965,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -800,19 +990,19 @@ class Experiment(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of the details or intents of the Experiment. - :type description: str - :param endpoint_a: The endpoint A of an experiment. - :type endpoint_a: ~azure.mgmt.frontdoor.models.Endpoint - :param endpoint_b: The endpoint B of an experiment. - :type endpoint_b: ~azure.mgmt.frontdoor.models.Endpoint - :param enabled_state: The state of the Experiment. Possible values include: "Enabled", + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of the details or intents of the Experiment. + :vartype description: str + :ivar endpoint_a: The endpoint A of an experiment. + :vartype endpoint_a: ~azure.mgmt.frontdoor.models.Endpoint + :ivar endpoint_b: The endpoint B of an experiment. + :vartype endpoint_b: ~azure.mgmt.frontdoor.models.Endpoint + :ivar enabled_state: The state of the Experiment. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.State + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.State :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.NetworkExperimentResourceState @@ -857,6 +1047,21 @@ def __init__( enabled_state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of the details or intents of the Experiment. + :paramtype description: str + :keyword endpoint_a: The endpoint A of an experiment. + :paramtype endpoint_a: ~azure.mgmt.frontdoor.models.Endpoint + :keyword endpoint_b: The endpoint B of an experiment. + :paramtype endpoint_b: ~azure.mgmt.frontdoor.models.Endpoint + :keyword enabled_state: The state of the Experiment. Possible values include: "Enabled", + "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.State + """ super(Experiment, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.endpoint_a = endpoint_a @@ -874,8 +1079,8 @@ class ExperimentList(msrest.serialization.Model): :ivar value: List of Experiments within a resource group. :vartype value: list[~azure.mgmt.frontdoor.models.Experiment] - :param next_link: URL to get the next set of Experiment objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of Experiment objects if there are any. + :vartype next_link: str """ _validation = { @@ -893,6 +1098,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of Experiment objects if there are any. + :paramtype next_link: str + """ super(ExperimentList, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -901,13 +1110,13 @@ def __init__( class ExperimentUpdateModel(msrest.serialization.Model): """Defines modifiable attributes of an Experiment. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of the intent or details of the Experiment. - :type description: str - :param enabled_state: The state of the Experiment. Possible values include: "Enabled", + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of the intent or details of the Experiment. + :vartype description: str + :ivar enabled_state: The state of the Experiment. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.State + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.State """ _attribute_map = { @@ -924,6 +1133,15 @@ def __init__( enabled_state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of the intent or details of the Experiment. + :paramtype description: str + :keyword enabled_state: The state of the Experiment. Possible values include: "Enabled", + "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.State + """ super(ExperimentUpdateModel, self).__init__(**kwargs) self.tags = tags self.description = description @@ -938,8 +1156,8 @@ class RouteConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -958,6 +1176,8 @@ def __init__( self, **kwargs ): + """ + """ super(RouteConfiguration, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] @@ -967,18 +1187,18 @@ class ForwardingConfiguration(RouteConfiguration): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. Constant filled by server. - :type odata_type: str - :param custom_forwarding_path: A custom path used to rewrite resource paths matched by this + :ivar odata_type: Required. Constant filled by server. + :vartype odata_type: str + :ivar custom_forwarding_path: A custom path used to rewrite resource paths matched by this rule. Leave empty to use incoming path. - :type custom_forwarding_path: str - :param forwarding_protocol: Protocol this rule will use when forwarding traffic to backends. + :vartype custom_forwarding_path: str + :ivar forwarding_protocol: Protocol this rule will use when forwarding traffic to backends. Possible values include: "HttpOnly", "HttpsOnly", "MatchRequest". - :type forwarding_protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorForwardingProtocol - :param cache_configuration: The caching configuration associated with this rule. - :type cache_configuration: ~azure.mgmt.frontdoor.models.CacheConfiguration - :param backend_pool: A reference to the BackendPool which this rule routes to. - :type backend_pool: ~azure.mgmt.frontdoor.models.SubResource + :vartype forwarding_protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorForwardingProtocol + :ivar cache_configuration: The caching configuration associated with this rule. + :vartype cache_configuration: ~azure.mgmt.frontdoor.models.CacheConfiguration + :ivar backend_pool: A reference to the BackendPool which this rule routes to. + :vartype backend_pool: ~azure.mgmt.frontdoor.models.SubResource """ _validation = { @@ -1002,6 +1222,18 @@ def __init__( backend_pool: Optional["SubResource"] = None, **kwargs ): + """ + :keyword custom_forwarding_path: A custom path used to rewrite resource paths matched by this + rule. Leave empty to use incoming path. + :paramtype custom_forwarding_path: str + :keyword forwarding_protocol: Protocol this rule will use when forwarding traffic to backends. + Possible values include: "HttpOnly", "HttpsOnly", "MatchRequest". + :paramtype forwarding_protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorForwardingProtocol + :keyword cache_configuration: The caching configuration associated with this rule. + :paramtype cache_configuration: ~azure.mgmt.frontdoor.models.CacheConfiguration + :keyword backend_pool: A reference to the BackendPool which this rule routes to. + :paramtype backend_pool: ~azure.mgmt.frontdoor.models.SubResource + """ super(ForwardingConfiguration, self).__init__(**kwargs) self.odata_type = '#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration' # type: str self.custom_forwarding_path = custom_forwarding_path @@ -1021,28 +1253,28 @@ class FrontDoor(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param friendly_name: A friendly name for the frontDoor. - :type friendly_name: str - :param routing_rules: Routing rules associated with this Front Door. - :type routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] - :param load_balancing_settings: Load balancing settings associated with this Front Door + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar friendly_name: A friendly name for the frontDoor. + :vartype friendly_name: str + :ivar routing_rules: Routing rules associated with this Front Door. + :vartype routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] + :ivar load_balancing_settings: Load balancing settings associated with this Front Door instance. - :type load_balancing_settings: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] - :param health_probe_settings: Health probe settings associated with this Front Door instance. - :type health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] - :param backend_pools: Backend pools available to routing rules. - :type backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] - :param frontend_endpoints: Frontend endpoints available to routing rules. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] - :param backend_pools_settings: Settings for all backendPools. - :type backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings - :param enabled_state: Operational status of the Front Door load balancer. Permitted values are + :vartype load_balancing_settings: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] + :ivar health_probe_settings: Health probe settings associated with this Front Door instance. + :vartype health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] + :ivar backend_pools: Backend pools available to routing rules. + :vartype backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] + :ivar frontend_endpoints: Frontend endpoints available to routing rules. + :vartype frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] + :ivar backend_pools_settings: Settings for all backendPools. + :vartype backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings + :ivar enabled_state: Operational status of the Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState :ivar resource_state: Resource status of the Front Door. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState @@ -1103,6 +1335,31 @@ def __init__( enabled_state: Optional[Union[str, "FrontDoorEnabledState"]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword friendly_name: A friendly name for the frontDoor. + :paramtype friendly_name: str + :keyword routing_rules: Routing rules associated with this Front Door. + :paramtype routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] + :keyword load_balancing_settings: Load balancing settings associated with this Front Door + instance. + :paramtype load_balancing_settings: + list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] + :keyword health_probe_settings: Health probe settings associated with this Front Door instance. + :paramtype health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] + :keyword backend_pools: Backend pools available to routing rules. + :paramtype backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] + :keyword frontend_endpoints: Frontend endpoints available to routing rules. + :paramtype frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] + :keyword backend_pools_settings: Settings for all backendPools. + :paramtype backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings + :keyword enabled_state: Operational status of the Front Door load balancer. Permitted values + are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState + """ super(FrontDoor, self).__init__(location=location, tags=tags, **kwargs) self.friendly_name = friendly_name self.routing_rules = routing_rules @@ -1126,8 +1383,8 @@ class FrontDoorListResult(msrest.serialization.Model): :ivar value: List of Front Doors within a resource group. :vartype value: list[~azure.mgmt.frontdoor.models.FrontDoor] - :param next_link: URL to get the next set of Front Door objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of Front Door objects if there are any. + :vartype next_link: str """ _validation = { @@ -1145,6 +1402,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of Front Door objects if there are any. + :paramtype next_link: str + """ super(FrontDoorListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -1153,24 +1414,24 @@ def __init__( class FrontDoorUpdateParameters(msrest.serialization.Model): """The properties needed to update a Front Door. - :param friendly_name: A friendly name for the frontDoor. - :type friendly_name: str - :param routing_rules: Routing rules associated with this Front Door. - :type routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] - :param load_balancing_settings: Load balancing settings associated with this Front Door + :ivar friendly_name: A friendly name for the frontDoor. + :vartype friendly_name: str + :ivar routing_rules: Routing rules associated with this Front Door. + :vartype routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] + :ivar load_balancing_settings: Load balancing settings associated with this Front Door instance. - :type load_balancing_settings: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] - :param health_probe_settings: Health probe settings associated with this Front Door instance. - :type health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] - :param backend_pools: Backend pools available to routing rules. - :type backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] - :param frontend_endpoints: Frontend endpoints available to routing rules. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] - :param backend_pools_settings: Settings for all backendPools. - :type backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings - :param enabled_state: Operational status of the Front Door load balancer. Permitted values are + :vartype load_balancing_settings: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] + :ivar health_probe_settings: Health probe settings associated with this Front Door instance. + :vartype health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] + :ivar backend_pools: Backend pools available to routing rules. + :vartype backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] + :ivar frontend_endpoints: Frontend endpoints available to routing rules. + :vartype frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] + :ivar backend_pools_settings: Settings for all backendPools. + :vartype backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings + :ivar enabled_state: Operational status of the Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState """ _attribute_map = { @@ -1197,6 +1458,27 @@ def __init__( enabled_state: Optional[Union[str, "FrontDoorEnabledState"]] = None, **kwargs ): + """ + :keyword friendly_name: A friendly name for the frontDoor. + :paramtype friendly_name: str + :keyword routing_rules: Routing rules associated with this Front Door. + :paramtype routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] + :keyword load_balancing_settings: Load balancing settings associated with this Front Door + instance. + :paramtype load_balancing_settings: + list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] + :keyword health_probe_settings: Health probe settings associated with this Front Door instance. + :paramtype health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] + :keyword backend_pools: Backend pools available to routing rules. + :paramtype backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] + :keyword frontend_endpoints: Frontend endpoints available to routing rules. + :paramtype frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] + :keyword backend_pools_settings: Settings for all backendPools. + :paramtype backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings + :keyword enabled_state: Operational status of the Front Door load balancer. Permitted values + are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState + """ super(FrontDoorUpdateParameters, self).__init__(**kwargs) self.friendly_name = friendly_name self.routing_rules = routing_rules @@ -1213,24 +1495,24 @@ class FrontDoorProperties(FrontDoorUpdateParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param friendly_name: A friendly name for the frontDoor. - :type friendly_name: str - :param routing_rules: Routing rules associated with this Front Door. - :type routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] - :param load_balancing_settings: Load balancing settings associated with this Front Door + :ivar friendly_name: A friendly name for the frontDoor. + :vartype friendly_name: str + :ivar routing_rules: Routing rules associated with this Front Door. + :vartype routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] + :ivar load_balancing_settings: Load balancing settings associated with this Front Door instance. - :type load_balancing_settings: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] - :param health_probe_settings: Health probe settings associated with this Front Door instance. - :type health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] - :param backend_pools: Backend pools available to routing rules. - :type backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] - :param frontend_endpoints: Frontend endpoints available to routing rules. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] - :param backend_pools_settings: Settings for all backendPools. - :type backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings - :param enabled_state: Operational status of the Front Door load balancer. Permitted values are + :vartype load_balancing_settings: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] + :ivar health_probe_settings: Health probe settings associated with this Front Door instance. + :vartype health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] + :ivar backend_pools: Backend pools available to routing rules. + :vartype backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] + :ivar frontend_endpoints: Frontend endpoints available to routing rules. + :vartype frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] + :ivar backend_pools_settings: Settings for all backendPools. + :vartype backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings + :ivar enabled_state: Operational status of the Front Door load balancer. Permitted values are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState :ivar resource_state: Resource status of the Front Door. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState @@ -1281,6 +1563,27 @@ def __init__( enabled_state: Optional[Union[str, "FrontDoorEnabledState"]] = None, **kwargs ): + """ + :keyword friendly_name: A friendly name for the frontDoor. + :paramtype friendly_name: str + :keyword routing_rules: Routing rules associated with this Front Door. + :paramtype routing_rules: list[~azure.mgmt.frontdoor.models.RoutingRule] + :keyword load_balancing_settings: Load balancing settings associated with this Front Door + instance. + :paramtype load_balancing_settings: + list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] + :keyword health_probe_settings: Health probe settings associated with this Front Door instance. + :paramtype health_probe_settings: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] + :keyword backend_pools: Backend pools available to routing rules. + :paramtype backend_pools: list[~azure.mgmt.frontdoor.models.BackendPool] + :keyword frontend_endpoints: Frontend endpoints available to routing rules. + :paramtype frontend_endpoints: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] + :keyword backend_pools_settings: Settings for all backendPools. + :paramtype backend_pools_settings: ~azure.mgmt.frontdoor.models.BackendPoolsSettings + :keyword enabled_state: Operational status of the Front Door load balancer. Permitted values + are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.FrontDoorEnabledState + """ super(FrontDoorProperties, self).__init__(friendly_name=friendly_name, routing_rules=routing_rules, load_balancing_settings=load_balancing_settings, health_probe_settings=health_probe_settings, backend_pools=backend_pools, frontend_endpoints=frontend_endpoints, backend_pools_settings=backend_pools_settings, enabled_state=enabled_state, **kwargs) self.resource_state = None self.provisioning_state = None @@ -1294,24 +1597,24 @@ class FrontendEndpoint(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str - :param name: Resource name. - :type name: str + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str :ivar type: Resource type. :vartype type: str - :param host_name: The host name of the frontendEndpoint. Must be a domain name. - :type host_name: str - :param session_affinity_enabled_state: Whether to allow session affinity on this host. Valid + :ivar host_name: The host name of the frontendEndpoint. Must be a domain name. + :vartype host_name: str + :ivar session_affinity_enabled_state: Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_enabled_state: str or + :vartype session_affinity_enabled_state: str or ~azure.mgmt.frontdoor.models.SessionAffinityEnabledState - :param session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in + :ivar session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in seconds for session affinity, if applicable. - :type session_affinity_ttl_seconds: int - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for + :vartype session_affinity_ttl_seconds: int + :ivar web_application_firewall_policy_link: Defines the Web Application Firewall policy for each host (if applicable). - :type web_application_firewall_policy_link: + :vartype web_application_firewall_policy_link: ~azure.mgmt.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". @@ -1366,6 +1669,25 @@ def __init__( web_application_firewall_policy_link: Optional["FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink"] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Resource name. + :paramtype name: str + :keyword host_name: The host name of the frontendEndpoint. Must be a domain name. + :paramtype host_name: str + :keyword session_affinity_enabled_state: Whether to allow session affinity on this host. Valid + options are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype session_affinity_enabled_state: str or + ~azure.mgmt.frontdoor.models.SessionAffinityEnabledState + :keyword session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in + seconds for session affinity, if applicable. + :paramtype session_affinity_ttl_seconds: int + :keyword web_application_firewall_policy_link: Defines the Web Application Firewall policy for + each host (if applicable). + :paramtype web_application_firewall_policy_link: + ~azure.mgmt.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink + """ super(FrontendEndpoint, self).__init__(id=id, **kwargs) self.name = name self.type = None @@ -1382,8 +1704,8 @@ def __init__( class FrontendEndpointLink(msrest.serialization.Model): """Defines the Resource ID for a Frontend Endpoint. - :param id: Resource ID. - :type id: str + :ivar id: Resource ID. + :vartype id: str """ _attribute_map = { @@ -1396,6 +1718,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ super(FrontendEndpointLink, self).__init__(**kwargs) self.id = id @@ -1403,18 +1729,18 @@ def __init__( class FrontendEndpointUpdateParameters(msrest.serialization.Model): """Frontend endpoint used in routing rule. - :param host_name: The host name of the frontendEndpoint. Must be a domain name. - :type host_name: str - :param session_affinity_enabled_state: Whether to allow session affinity on this host. Valid + :ivar host_name: The host name of the frontendEndpoint. Must be a domain name. + :vartype host_name: str + :ivar session_affinity_enabled_state: Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_enabled_state: str or + :vartype session_affinity_enabled_state: str or ~azure.mgmt.frontdoor.models.SessionAffinityEnabledState - :param session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in + :ivar session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in seconds for session affinity, if applicable. - :type session_affinity_ttl_seconds: int - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for + :vartype session_affinity_ttl_seconds: int + :ivar web_application_firewall_policy_link: Defines the Web Application Firewall policy for each host (if applicable). - :type web_application_firewall_policy_link: + :vartype web_application_firewall_policy_link: ~azure.mgmt.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink """ @@ -1434,6 +1760,21 @@ def __init__( web_application_firewall_policy_link: Optional["FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink"] = None, **kwargs ): + """ + :keyword host_name: The host name of the frontendEndpoint. Must be a domain name. + :paramtype host_name: str + :keyword session_affinity_enabled_state: Whether to allow session affinity on this host. Valid + options are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype session_affinity_enabled_state: str or + ~azure.mgmt.frontdoor.models.SessionAffinityEnabledState + :keyword session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in + seconds for session affinity, if applicable. + :paramtype session_affinity_ttl_seconds: int + :keyword web_application_firewall_policy_link: Defines the Web Application Firewall policy for + each host (if applicable). + :paramtype web_application_firewall_policy_link: + ~azure.mgmt.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink + """ super(FrontendEndpointUpdateParameters, self).__init__(**kwargs) self.host_name = host_name self.session_affinity_enabled_state = session_affinity_enabled_state @@ -1446,18 +1787,18 @@ class FrontendEndpointProperties(FrontendEndpointUpdateParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param host_name: The host name of the frontendEndpoint. Must be a domain name. - :type host_name: str - :param session_affinity_enabled_state: Whether to allow session affinity on this host. Valid + :ivar host_name: The host name of the frontendEndpoint. Must be a domain name. + :vartype host_name: str + :ivar session_affinity_enabled_state: Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_enabled_state: str or + :vartype session_affinity_enabled_state: str or ~azure.mgmt.frontdoor.models.SessionAffinityEnabledState - :param session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in + :ivar session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in seconds for session affinity, if applicable. - :type session_affinity_ttl_seconds: int - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for + :vartype session_affinity_ttl_seconds: int + :ivar web_application_firewall_policy_link: Defines the Web Application Firewall policy for each host (if applicable). - :type web_application_firewall_policy_link: + :vartype web_application_firewall_policy_link: ~azure.mgmt.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". @@ -1506,6 +1847,21 @@ def __init__( web_application_firewall_policy_link: Optional["FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink"] = None, **kwargs ): + """ + :keyword host_name: The host name of the frontendEndpoint. Must be a domain name. + :paramtype host_name: str + :keyword session_affinity_enabled_state: Whether to allow session affinity on this host. Valid + options are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype session_affinity_enabled_state: str or + ~azure.mgmt.frontdoor.models.SessionAffinityEnabledState + :keyword session_affinity_ttl_seconds: UNUSED. This field will be ignored. The TTL to use in + seconds for session affinity, if applicable. + :paramtype session_affinity_ttl_seconds: int + :keyword web_application_firewall_policy_link: Defines the Web Application Firewall policy for + each host (if applicable). + :paramtype web_application_firewall_policy_link: + ~azure.mgmt.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink + """ super(FrontendEndpointProperties, self).__init__(host_name=host_name, session_affinity_enabled_state=session_affinity_enabled_state, session_affinity_ttl_seconds=session_affinity_ttl_seconds, web_application_firewall_policy_link=web_application_firewall_policy_link, **kwargs) self.resource_state = None self.custom_https_provisioning_state = None @@ -1520,8 +1876,8 @@ class FrontendEndpointsListResult(msrest.serialization.Model): :ivar value: List of Frontend endpoints within a Front Door. :vartype value: list[~azure.mgmt.frontdoor.models.FrontendEndpoint] - :param next_link: URL to get the next set of frontend endpoints if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of frontend endpoints if there are any. + :vartype next_link: str """ _validation = { @@ -1539,6 +1895,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of frontend endpoints if there are any. + :paramtype next_link: str + """ super(FrontendEndpointsListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -1547,8 +1907,8 @@ def __init__( class FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink(msrest.serialization.Model): """Defines the Web Application Firewall policy for each host (if applicable). - :param id: Resource ID. - :type id: str + :ivar id: Resource ID. + :vartype id: str """ _attribute_map = { @@ -1561,6 +1921,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ super(FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink, self).__init__(**kwargs) self.id = id @@ -1570,14 +1934,14 @@ class HeaderAction(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param header_action_type: Required. Which type of manipulation to apply to the header. - Possible values include: "Append", "Delete", "Overwrite". - :type header_action_type: str or ~azure.mgmt.frontdoor.models.HeaderActionType - :param header_name: Required. The name of the header this action will apply to. - :type header_name: str - :param value: The value to update the given header name with. This value is not used if the + :ivar header_action_type: Required. Which type of manipulation to apply to the header. Possible + values include: "Append", "Delete", "Overwrite". + :vartype header_action_type: str or ~azure.mgmt.frontdoor.models.HeaderActionType + :ivar header_name: Required. The name of the header this action will apply to. + :vartype header_name: str + :ivar value: The value to update the given header name with. This value is not used if the actionType is Delete. - :type value: str + :vartype value: str """ _validation = { @@ -1599,6 +1963,16 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword header_action_type: Required. Which type of manipulation to apply to the header. + Possible values include: "Append", "Delete", "Overwrite". + :paramtype header_action_type: str or ~azure.mgmt.frontdoor.models.HeaderActionType + :keyword header_name: Required. The name of the header this action will apply to. + :paramtype header_name: str + :keyword value: The value to update the given header name with. This value is not used if the + actionType is Delete. + :paramtype value: str + """ super(HeaderAction, self).__init__(**kwargs) self.header_action_type = header_action_type self.header_name = header_name @@ -1612,8 +1986,8 @@ class HealthProbeSettingsListResult(msrest.serialization.Model): :ivar value: List of HealthProbeSettings within a Front Door. :vartype value: list[~azure.mgmt.frontdoor.models.HealthProbeSettingsModel] - :param next_link: URL to get the next set of HealthProbeSettings objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of HealthProbeSettings objects if there are any. + :vartype next_link: str """ _validation = { @@ -1631,6 +2005,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of HealthProbeSettings objects if there are any. + :paramtype next_link: str + """ super(HealthProbeSettingsListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -1641,26 +2019,26 @@ class HealthProbeSettingsModel(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str - :param name: Resource name. - :type name: str + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str :ivar type: Resource type. :vartype type: str - :param path: The path to use for the health probe. Default is /. - :type path: str - :param protocol: Protocol scheme to use for this probe. Possible values include: "Http", + :ivar path: The path to use for the health probe. Default is /. + :vartype path: str + :ivar protocol: Protocol scheme to use for this probe. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol - :param interval_in_seconds: The number of seconds between health probes. - :type interval_in_seconds: int - :param health_probe_method: Configures which HTTP method to use to probe the backends defined + :vartype protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol + :ivar interval_in_seconds: The number of seconds between health probes. + :vartype interval_in_seconds: int + :ivar health_probe_method: Configures which HTTP method to use to probe the backends defined under backendPools. Possible values include: "GET", "HEAD". Default value: "HEAD". - :type health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod - :param enabled_state: Whether to enable health probes to be made against backends defined under + :vartype health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod + :ivar enabled_state: Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState @@ -1695,6 +2073,26 @@ def __init__( enabled_state: Optional[Union[str, "HealthProbeEnabled"]] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Resource name. + :paramtype name: str + :keyword path: The path to use for the health probe. Default is /. + :paramtype path: str + :keyword protocol: Protocol scheme to use for this probe. Possible values include: "Http", + "Https". + :paramtype protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol + :keyword interval_in_seconds: The number of seconds between health probes. + :paramtype interval_in_seconds: int + :keyword health_probe_method: Configures which HTTP method to use to probe the backends defined + under backendPools. Possible values include: "GET", "HEAD". Default value: "HEAD". + :paramtype health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod + :keyword enabled_state: Whether to enable health probes to be made against backends defined + under backendPools. Health probes can only be disabled if there is a single enabled backend in + single enabled backend pool. Possible values include: "Enabled", "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled + """ super(HealthProbeSettingsModel, self).__init__(id=id, **kwargs) self.name = name self.type = None @@ -1709,20 +2107,20 @@ def __init__( class HealthProbeSettingsUpdateParameters(msrest.serialization.Model): """L7 health probe settings for a backend pool. - :param path: The path to use for the health probe. Default is /. - :type path: str - :param protocol: Protocol scheme to use for this probe. Possible values include: "Http", + :ivar path: The path to use for the health probe. Default is /. + :vartype path: str + :ivar protocol: Protocol scheme to use for this probe. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol - :param interval_in_seconds: The number of seconds between health probes. - :type interval_in_seconds: int - :param health_probe_method: Configures which HTTP method to use to probe the backends defined + :vartype protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol + :ivar interval_in_seconds: The number of seconds between health probes. + :vartype interval_in_seconds: int + :ivar health_probe_method: Configures which HTTP method to use to probe the backends defined under backendPools. Possible values include: "GET", "HEAD". Default value: "HEAD". - :type health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod - :param enabled_state: Whether to enable health probes to be made against backends defined under + :vartype health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod + :ivar enabled_state: Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled """ _attribute_map = { @@ -1743,6 +2141,22 @@ def __init__( enabled_state: Optional[Union[str, "HealthProbeEnabled"]] = None, **kwargs ): + """ + :keyword path: The path to use for the health probe. Default is /. + :paramtype path: str + :keyword protocol: Protocol scheme to use for this probe. Possible values include: "Http", + "Https". + :paramtype protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol + :keyword interval_in_seconds: The number of seconds between health probes. + :paramtype interval_in_seconds: int + :keyword health_probe_method: Configures which HTTP method to use to probe the backends defined + under backendPools. Possible values include: "GET", "HEAD". Default value: "HEAD". + :paramtype health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod + :keyword enabled_state: Whether to enable health probes to be made against backends defined + under backendPools. Health probes can only be disabled if there is a single enabled backend in + single enabled backend pool. Possible values include: "Enabled", "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled + """ super(HealthProbeSettingsUpdateParameters, self).__init__(**kwargs) self.path = path self.protocol = protocol @@ -1756,20 +2170,20 @@ class HealthProbeSettingsProperties(HealthProbeSettingsUpdateParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param path: The path to use for the health probe. Default is /. - :type path: str - :param protocol: Protocol scheme to use for this probe. Possible values include: "Http", + :ivar path: The path to use for the health probe. Default is /. + :vartype path: str + :ivar protocol: Protocol scheme to use for this probe. Possible values include: "Http", "Https". - :type protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol - :param interval_in_seconds: The number of seconds between health probes. - :type interval_in_seconds: int - :param health_probe_method: Configures which HTTP method to use to probe the backends defined + :vartype protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol + :ivar interval_in_seconds: The number of seconds between health probes. + :vartype interval_in_seconds: int + :ivar health_probe_method: Configures which HTTP method to use to probe the backends defined under backendPools. Possible values include: "GET", "HEAD". Default value: "HEAD". - :type health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod - :param enabled_state: Whether to enable health probes to be made against backends defined under + :vartype health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod + :ivar enabled_state: Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState @@ -1798,6 +2212,22 @@ def __init__( enabled_state: Optional[Union[str, "HealthProbeEnabled"]] = None, **kwargs ): + """ + :keyword path: The path to use for the health probe. Default is /. + :paramtype path: str + :keyword protocol: Protocol scheme to use for this probe. Possible values include: "Http", + "Https". + :paramtype protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol + :keyword interval_in_seconds: The number of seconds between health probes. + :paramtype interval_in_seconds: int + :keyword health_probe_method: Configures which HTTP method to use to probe the backends defined + under backendPools. Possible values include: "GET", "HEAD". Default value: "HEAD". + :paramtype health_probe_method: str or ~azure.mgmt.frontdoor.models.FrontDoorHealthProbeMethod + :keyword enabled_state: Whether to enable health probes to be made against backends defined + under backendPools. Health probes can only be disabled if there is a single enabled backend in + single enabled backend pool. Possible values include: "Enabled", "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.HealthProbeEnabled + """ super(HealthProbeSettingsProperties, self).__init__(path=path, protocol=protocol, interval_in_seconds=interval_in_seconds, health_probe_method=health_probe_method, enabled_state=enabled_state, **kwargs) self.resource_state = None @@ -1805,8 +2235,8 @@ def __init__( class KeyVaultCertificateSourceParametersVault(msrest.serialization.Model): """The Key Vault containing the SSL certificate. - :param id: Resource ID. - :type id: str + :ivar id: Resource ID. + :vartype id: str """ _attribute_map = { @@ -1819,6 +2249,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ super(KeyVaultCertificateSourceParametersVault, self).__init__(**kwargs) self.id = id @@ -1880,6 +2314,8 @@ def __init__( self, **kwargs ): + """ + """ super(LatencyMetric, self).__init__(**kwargs) self.name = None self.end_date_time_utc = None @@ -1904,10 +2340,10 @@ class LatencyScorecard(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar id_properties_id: The unique identifier of the Latency Scorecard. :vartype id_properties_id: str :ivar name_properties_name: The name of the Latency Scorecard. @@ -1925,8 +2361,8 @@ class LatencyScorecard(Resource): :ivar country: The country associated with the Latency Scorecard. Values are country ISO codes as specified here- https://www.iso.org/iso-3166-country-codes.html. :vartype country: str - :param latency_metrics: The latency metrics of the Latency Scorecard. - :type latency_metrics: list[~azure.mgmt.frontdoor.models.LatencyMetric] + :ivar latency_metrics: The latency metrics of the Latency Scorecard. + :vartype latency_metrics: list[~azure.mgmt.frontdoor.models.LatencyMetric] """ _validation = { @@ -1968,6 +2404,14 @@ def __init__( latency_metrics: Optional[List["LatencyMetric"]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword latency_metrics: The latency metrics of the Latency Scorecard. + :paramtype latency_metrics: list[~azure.mgmt.frontdoor.models.LatencyMetric] + """ super(LatencyScorecard, self).__init__(location=location, tags=tags, **kwargs) self.id_properties_id = None self.name_properties_name = None @@ -1987,8 +2431,8 @@ class LoadBalancingSettingsListResult(msrest.serialization.Model): :ivar value: List of Backend Pools within a Front Door. :vartype value: list[~azure.mgmt.frontdoor.models.LoadBalancingSettingsModel] - :param next_link: URL to get the next set of LoadBalancingSettings objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of LoadBalancingSettings objects if there are any. + :vartype next_link: str """ _validation = { @@ -2006,6 +2450,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of LoadBalancingSettings objects if there are any. + :paramtype next_link: str + """ super(LoadBalancingSettingsListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -2016,20 +2464,20 @@ class LoadBalancingSettingsModel(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str - :param name: Resource name. - :type name: str + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str :ivar type: Resource type. :vartype type: str - :param sample_size: The number of samples to consider for load balancing decisions. - :type sample_size: int - :param successful_samples_required: The number of samples within the sample period that must + :ivar sample_size: The number of samples to consider for load balancing decisions. + :vartype sample_size: int + :ivar successful_samples_required: The number of samples within the sample period that must succeed. - :type successful_samples_required: int - :param additional_latency_milliseconds: The additional latency in milliseconds for probes to + :vartype successful_samples_required: int + :ivar additional_latency_milliseconds: The additional latency in milliseconds for probes to fall into the lowest latency bucket. - :type additional_latency_milliseconds: int + :vartype additional_latency_milliseconds: int :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState @@ -2060,6 +2508,20 @@ def __init__( additional_latency_milliseconds: Optional[int] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Resource name. + :paramtype name: str + :keyword sample_size: The number of samples to consider for load balancing decisions. + :paramtype sample_size: int + :keyword successful_samples_required: The number of samples within the sample period that must + succeed. + :paramtype successful_samples_required: int + :keyword additional_latency_milliseconds: The additional latency in milliseconds for probes to + fall into the lowest latency bucket. + :paramtype additional_latency_milliseconds: int + """ super(LoadBalancingSettingsModel, self).__init__(id=id, **kwargs) self.name = name self.type = None @@ -2072,14 +2534,14 @@ def __init__( class LoadBalancingSettingsUpdateParameters(msrest.serialization.Model): """Round-Robin load balancing settings for a backend pool. - :param sample_size: The number of samples to consider for load balancing decisions. - :type sample_size: int - :param successful_samples_required: The number of samples within the sample period that must + :ivar sample_size: The number of samples to consider for load balancing decisions. + :vartype sample_size: int + :ivar successful_samples_required: The number of samples within the sample period that must succeed. - :type successful_samples_required: int - :param additional_latency_milliseconds: The additional latency in milliseconds for probes to + :vartype successful_samples_required: int + :ivar additional_latency_milliseconds: The additional latency in milliseconds for probes to fall into the lowest latency bucket. - :type additional_latency_milliseconds: int + :vartype additional_latency_milliseconds: int """ _attribute_map = { @@ -2096,6 +2558,16 @@ def __init__( additional_latency_milliseconds: Optional[int] = None, **kwargs ): + """ + :keyword sample_size: The number of samples to consider for load balancing decisions. + :paramtype sample_size: int + :keyword successful_samples_required: The number of samples within the sample period that must + succeed. + :paramtype successful_samples_required: int + :keyword additional_latency_milliseconds: The additional latency in milliseconds for probes to + fall into the lowest latency bucket. + :paramtype additional_latency_milliseconds: int + """ super(LoadBalancingSettingsUpdateParameters, self).__init__(**kwargs) self.sample_size = sample_size self.successful_samples_required = successful_samples_required @@ -2107,14 +2579,14 @@ class LoadBalancingSettingsProperties(LoadBalancingSettingsUpdateParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param sample_size: The number of samples to consider for load balancing decisions. - :type sample_size: int - :param successful_samples_required: The number of samples within the sample period that must + :ivar sample_size: The number of samples to consider for load balancing decisions. + :vartype sample_size: int + :ivar successful_samples_required: The number of samples within the sample period that must succeed. - :type successful_samples_required: int - :param additional_latency_milliseconds: The additional latency in milliseconds for probes to + :vartype successful_samples_required: int + :ivar additional_latency_milliseconds: The additional latency in milliseconds for probes to fall into the lowest latency bucket. - :type additional_latency_milliseconds: int + :vartype additional_latency_milliseconds: int :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState @@ -2139,6 +2611,16 @@ def __init__( additional_latency_milliseconds: Optional[int] = None, **kwargs ): + """ + :keyword sample_size: The number of samples to consider for load balancing decisions. + :paramtype sample_size: int + :keyword successful_samples_required: The number of samples within the sample period that must + succeed. + :paramtype successful_samples_required: int + :keyword additional_latency_milliseconds: The additional latency in milliseconds for probes to + fall into the lowest latency bucket. + :paramtype additional_latency_milliseconds: int + """ super(LoadBalancingSettingsProperties, self).__init__(sample_size=sample_size, successful_samples_required=successful_samples_required, additional_latency_milliseconds=additional_latency_milliseconds, **kwargs) self.resource_state = None @@ -2178,6 +2660,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedRuleDefinition, self).__init__(**kwargs) self.rule_id = None self.default_state = None @@ -2190,18 +2674,18 @@ class ManagedRuleExclusion(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param match_variable: Required. The variable type to be excluded. Possible values include: + :ivar match_variable: Required. The variable type to be excluded. Possible values include: "RequestHeaderNames", "RequestCookieNames", "QueryStringArgNames", "RequestBodyPostArgNames", "RequestBodyJsonArgNames". - :type match_variable: str or ~azure.mgmt.frontdoor.models.ManagedRuleExclusionMatchVariable - :param selector_match_operator: Required. Comparison operator to apply to the selector when + :vartype match_variable: str or ~azure.mgmt.frontdoor.models.ManagedRuleExclusionMatchVariable + :ivar selector_match_operator: Required. Comparison operator to apply to the selector when specifying which elements in the collection this exclusion applies to. Possible values include: "Equals", "Contains", "StartsWith", "EndsWith", "EqualsAny". - :type selector_match_operator: str or + :vartype selector_match_operator: str or ~azure.mgmt.frontdoor.models.ManagedRuleExclusionSelectorMatchOperator - :param selector: Required. Selector value for which elements in the collection this exclusion + :ivar selector: Required. Selector value for which elements in the collection this exclusion applies to. - :type selector: str + :vartype selector: str """ _validation = { @@ -2224,6 +2708,21 @@ def __init__( selector: str, **kwargs ): + """ + :keyword match_variable: Required. The variable type to be excluded. Possible values include: + "RequestHeaderNames", "RequestCookieNames", "QueryStringArgNames", "RequestBodyPostArgNames", + "RequestBodyJsonArgNames". + :paramtype match_variable: str or + ~azure.mgmt.frontdoor.models.ManagedRuleExclusionMatchVariable + :keyword selector_match_operator: Required. Comparison operator to apply to the selector when + specifying which elements in the collection this exclusion applies to. Possible values include: + "Equals", "Contains", "StartsWith", "EndsWith", "EqualsAny". + :paramtype selector_match_operator: str or + ~azure.mgmt.frontdoor.models.ManagedRuleExclusionSelectorMatchOperator + :keyword selector: Required. Selector value for which elements in the collection this exclusion + applies to. + :paramtype selector: str + """ super(ManagedRuleExclusion, self).__init__(**kwargs) self.match_variable = match_variable self.selector_match_operator = selector_match_operator @@ -2259,6 +2758,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedRuleGroupDefinition, self).__init__(**kwargs) self.rule_group_name = None self.description = None @@ -2270,13 +2771,13 @@ class ManagedRuleGroupOverride(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rule_group_name: Required. Describes the managed rule group to override. - :type rule_group_name: str - :param exclusions: Describes the exclusions that are applied to all rules in the group. - :type exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] - :param rules: List of rules that will be disabled. If none specified, all rules in the group + :ivar rule_group_name: Required. Describes the managed rule group to override. + :vartype rule_group_name: str + :ivar exclusions: Describes the exclusions that are applied to all rules in the group. + :vartype exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] + :ivar rules: List of rules that will be disabled. If none specified, all rules in the group will be disabled. - :type rules: list[~azure.mgmt.frontdoor.models.ManagedRuleOverride] + :vartype rules: list[~azure.mgmt.frontdoor.models.ManagedRuleOverride] """ _validation = { @@ -2297,6 +2798,15 @@ def __init__( rules: Optional[List["ManagedRuleOverride"]] = None, **kwargs ): + """ + :keyword rule_group_name: Required. Describes the managed rule group to override. + :paramtype rule_group_name: str + :keyword exclusions: Describes the exclusions that are applied to all rules in the group. + :paramtype exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] + :keyword rules: List of rules that will be disabled. If none specified, all rules in the group + will be disabled. + :paramtype rules: list[~azure.mgmt.frontdoor.models.ManagedRuleOverride] + """ super(ManagedRuleGroupOverride, self).__init__(**kwargs) self.rule_group_name = rule_group_name self.exclusions = exclusions @@ -2308,16 +2818,16 @@ class ManagedRuleOverride(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rule_id: Required. Identifier for the managed rule. - :type rule_id: str - :param enabled_state: Describes if the managed rule is in enabled or disabled state. Defaults - to Disabled if not specified. Possible values include: "Disabled", "Enabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.ManagedRuleEnabledState - :param action: Describes the override action to be applied when rule matches. Possible values + :ivar rule_id: Required. Identifier for the managed rule. + :vartype rule_id: str + :ivar enabled_state: Describes if the managed rule is in enabled or disabled state. Defaults to + Disabled if not specified. Possible values include: "Disabled", "Enabled". + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.ManagedRuleEnabledState + :ivar action: Describes the override action to be applied when rule matches. Possible values include: "Allow", "Block", "Log", "Redirect". - :type action: str or ~azure.mgmt.frontdoor.models.ActionType - :param exclusions: Describes the exclusions that are applied to this specific rule. - :type exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] + :vartype action: str or ~azure.mgmt.frontdoor.models.ActionType + :ivar exclusions: Describes the exclusions that are applied to this specific rule. + :vartype exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] """ _validation = { @@ -2340,6 +2850,18 @@ def __init__( exclusions: Optional[List["ManagedRuleExclusion"]] = None, **kwargs ): + """ + :keyword rule_id: Required. Identifier for the managed rule. + :paramtype rule_id: str + :keyword enabled_state: Describes if the managed rule is in enabled or disabled state. Defaults + to Disabled if not specified. Possible values include: "Disabled", "Enabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.ManagedRuleEnabledState + :keyword action: Describes the override action to be applied when rule matches. Possible values + include: "Allow", "Block", "Log", "Redirect". + :paramtype action: str or ~azure.mgmt.frontdoor.models.ActionType + :keyword exclusions: Describes the exclusions that are applied to this specific rule. + :paramtype exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] + """ super(ManagedRuleOverride, self).__init__(**kwargs) self.rule_id = rule_id self.enabled_state = enabled_state @@ -2352,17 +2874,17 @@ class ManagedRuleSet(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rule_set_type: Required. Defines the rule set type to use. - :type rule_set_type: str - :param rule_set_version: Required. Defines the version of the rule set to use. - :type rule_set_version: str - :param rule_set_action: Defines the action to take when a managed rule set score threshold is + :ivar rule_set_type: Required. Defines the rule set type to use. + :vartype rule_set_type: str + :ivar rule_set_version: Required. Defines the version of the rule set to use. + :vartype rule_set_version: str + :ivar rule_set_action: Defines the action to take when a managed rule set score threshold is met. Possible values include: "Block", "Log", "Redirect". - :type rule_set_action: str or ~azure.mgmt.frontdoor.models.ManagedRuleSetActionType - :param exclusions: Describes the exclusions that are applied to all rules in the set. - :type exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] - :param rule_group_overrides: Defines the rule group overrides to apply to the rule set. - :type rule_group_overrides: list[~azure.mgmt.frontdoor.models.ManagedRuleGroupOverride] + :vartype rule_set_action: str or ~azure.mgmt.frontdoor.models.ManagedRuleSetActionType + :ivar exclusions: Describes the exclusions that are applied to all rules in the set. + :vartype exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] + :ivar rule_group_overrides: Defines the rule group overrides to apply to the rule set. + :vartype rule_group_overrides: list[~azure.mgmt.frontdoor.models.ManagedRuleGroupOverride] """ _validation = { @@ -2388,6 +2910,19 @@ def __init__( rule_group_overrides: Optional[List["ManagedRuleGroupOverride"]] = None, **kwargs ): + """ + :keyword rule_set_type: Required. Defines the rule set type to use. + :paramtype rule_set_type: str + :keyword rule_set_version: Required. Defines the version of the rule set to use. + :paramtype rule_set_version: str + :keyword rule_set_action: Defines the action to take when a managed rule set score threshold is + met. Possible values include: "Block", "Log", "Redirect". + :paramtype rule_set_action: str or ~azure.mgmt.frontdoor.models.ManagedRuleSetActionType + :keyword exclusions: Describes the exclusions that are applied to all rules in the set. + :paramtype exclusions: list[~azure.mgmt.frontdoor.models.ManagedRuleExclusion] + :keyword rule_group_overrides: Defines the rule group overrides to apply to the rule set. + :paramtype rule_group_overrides: list[~azure.mgmt.frontdoor.models.ManagedRuleGroupOverride] + """ super(ManagedRuleSet, self).__init__(**kwargs) self.rule_set_type = rule_set_type self.rule_set_version = rule_set_version @@ -2407,10 +2942,10 @@ class ManagedRuleSetDefinition(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar provisioning_state: Provisioning state of the managed rule set. :vartype provisioning_state: str :ivar rule_set_id: Id of the managed rule set. @@ -2454,6 +2989,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ManagedRuleSetDefinition, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.rule_set_id = None @@ -2469,8 +3010,8 @@ class ManagedRuleSetDefinitionList(msrest.serialization.Model): :ivar value: List of managed rule set definitions. :vartype value: list[~azure.mgmt.frontdoor.models.ManagedRuleSetDefinition] - :param next_link: URL to retrieve next set of managed rule set definitions. - :type next_link: str + :ivar next_link: URL to retrieve next set of managed rule set definitions. + :vartype next_link: str """ _validation = { @@ -2488,6 +3029,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to retrieve next set of managed rule set definitions. + :paramtype next_link: str + """ super(ManagedRuleSetDefinitionList, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -2496,8 +3041,8 @@ def __init__( class ManagedRuleSetList(msrest.serialization.Model): """Defines the list of managed rule sets for the policy. - :param managed_rule_sets: List of rule sets. - :type managed_rule_sets: list[~azure.mgmt.frontdoor.models.ManagedRuleSet] + :ivar managed_rule_sets: List of rule sets. + :vartype managed_rule_sets: list[~azure.mgmt.frontdoor.models.ManagedRuleSet] """ _attribute_map = { @@ -2510,6 +3055,10 @@ def __init__( managed_rule_sets: Optional[List["ManagedRuleSet"]] = None, **kwargs ): + """ + :keyword managed_rule_sets: List of rule sets. + :paramtype managed_rule_sets: list[~azure.mgmt.frontdoor.models.ManagedRuleSet] + """ super(ManagedRuleSetList, self).__init__(**kwargs) self.managed_rule_sets = managed_rule_sets @@ -2519,23 +3068,23 @@ class MatchCondition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param match_variable: Required. Request variable to compare with. Possible values include: + :ivar match_variable: Required. Request variable to compare with. Possible values include: "RemoteAddr", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "Cookies", "SocketAddr". - :type match_variable: str or ~azure.mgmt.frontdoor.models.MatchVariable - :param selector: Match against a specific key from the QueryString, PostArgs, RequestHeader or + :vartype match_variable: str or ~azure.mgmt.frontdoor.models.MatchVariable + :ivar selector: Match against a specific key from the QueryString, PostArgs, RequestHeader or Cookies variables. Default is null. - :type selector: str - :param operator: Required. Comparison type to use for matching with the variable value. - Possible values include: "Any", "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", - "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", "EndsWith", "RegEx". - :type operator: str or ~azure.mgmt.frontdoor.models.Operator - :param negate_condition: Describes if the result of this condition should be negated. - :type negate_condition: bool - :param match_value: Required. List of possible match values. - :type match_value: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.frontdoor.models.TransformType] + :vartype selector: str + :ivar operator: Required. Comparison type to use for matching with the variable value. Possible + values include: "Any", "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", "GreaterThan", + "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", "EndsWith", "RegEx". + :vartype operator: str or ~azure.mgmt.frontdoor.models.Operator + :ivar negate_condition: Describes if the result of this condition should be negated. + :vartype negate_condition: bool + :ivar match_value: Required. List of possible match values. + :vartype match_value: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.frontdoor.models.TransformType] """ _validation = { @@ -2564,6 +3113,25 @@ def __init__( transforms: Optional[List[Union[str, "TransformType"]]] = None, **kwargs ): + """ + :keyword match_variable: Required. Request variable to compare with. Possible values include: + "RemoteAddr", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "Cookies", "SocketAddr". + :paramtype match_variable: str or ~azure.mgmt.frontdoor.models.MatchVariable + :keyword selector: Match against a specific key from the QueryString, PostArgs, RequestHeader + or Cookies variables. Default is null. + :paramtype selector: str + :keyword operator: Required. Comparison type to use for matching with the variable value. + Possible values include: "Any", "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", + "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", "EndsWith", "RegEx". + :paramtype operator: str or ~azure.mgmt.frontdoor.models.Operator + :keyword negate_condition: Describes if the result of this condition should be negated. + :paramtype negate_condition: bool + :keyword match_value: Required. List of possible match values. + :paramtype match_value: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.frontdoor.models.TransformType] + """ super(MatchCondition, self).__init__(**kwargs) self.match_variable = match_variable self.selector = selector @@ -2576,24 +3144,24 @@ def __init__( class PolicySettings(msrest.serialization.Model): """Defines top-level WebApplicationFirewallPolicy configuration settings. - :param enabled_state: Describes if the policy is in enabled or disabled state. Defaults to + :ivar enabled_state: Describes if the policy is in enabled or disabled state. Defaults to Enabled if not specified. Possible values include: "Disabled", "Enabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.PolicyEnabledState - :param mode: Describes if it is in detection mode or prevention mode at policy level. Possible + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.PolicyEnabledState + :ivar mode: Describes if it is in detection mode or prevention mode at policy level. Possible values include: "Prevention", "Detection". - :type mode: str or ~azure.mgmt.frontdoor.models.PolicyMode - :param redirect_url: If action type is redirect, this field represents redirect URL for the + :vartype mode: str or ~azure.mgmt.frontdoor.models.PolicyMode + :ivar redirect_url: If action type is redirect, this field represents redirect URL for the client. - :type redirect_url: str - :param custom_block_response_status_code: If the action type is block, customer can override - the response status code. - :type custom_block_response_status_code: int - :param custom_block_response_body: If the action type is block, customer can override the + :vartype redirect_url: str + :ivar custom_block_response_status_code: If the action type is block, customer can override the + response status code. + :vartype custom_block_response_status_code: int + :ivar custom_block_response_body: If the action type is block, customer can override the response body. The body must be specified in base64 encoding. - :type custom_block_response_body: str - :param request_body_check: Describes if policy managed rules will inspect the request body + :vartype custom_block_response_body: str + :ivar request_body_check: Describes if policy managed rules will inspect the request body content. Possible values include: "Disabled", "Enabled". - :type request_body_check: str or ~azure.mgmt.frontdoor.models.PolicyRequestBodyCheck + :vartype request_body_check: str or ~azure.mgmt.frontdoor.models.PolicyRequestBodyCheck """ _validation = { @@ -2620,6 +3188,26 @@ def __init__( request_body_check: Optional[Union[str, "PolicyRequestBodyCheck"]] = None, **kwargs ): + """ + :keyword enabled_state: Describes if the policy is in enabled or disabled state. Defaults to + Enabled if not specified. Possible values include: "Disabled", "Enabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.PolicyEnabledState + :keyword mode: Describes if it is in detection mode or prevention mode at policy level. + Possible values include: "Prevention", "Detection". + :paramtype mode: str or ~azure.mgmt.frontdoor.models.PolicyMode + :keyword redirect_url: If action type is redirect, this field represents redirect URL for the + client. + :paramtype redirect_url: str + :keyword custom_block_response_status_code: If the action type is block, customer can override + the response status code. + :paramtype custom_block_response_status_code: int + :keyword custom_block_response_body: If the action type is block, customer can override the + response body. The body must be specified in base64 encoding. + :paramtype custom_block_response_body: str + :keyword request_body_check: Describes if policy managed rules will inspect the request body + content. Possible values include: "Disabled", "Enabled". + :paramtype request_body_check: str or ~azure.mgmt.frontdoor.models.PolicyRequestBodyCheck + """ super(PolicySettings, self).__init__(**kwargs) self.enabled_state = enabled_state self.mode = mode @@ -2640,19 +3228,19 @@ class PreconfiguredEndpoint(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: The description of the endpoint. - :type description: str - :param endpoint: The endpoint that is preconfigured. - :type endpoint: str - :param endpoint_type: The type of endpoint. Possible values include: "AFD", "AzureRegion", + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar description: The description of the endpoint. + :vartype description: str + :ivar endpoint: The endpoint that is preconfigured. + :vartype endpoint: str + :ivar endpoint_type: The type of endpoint. Possible values include: "AFD", "AzureRegion", "CDN", "ATM". - :type endpoint_type: str or ~azure.mgmt.frontdoor.models.EndpointType - :param backend: The preconfigured endpoint backend. - :type backend: str + :vartype endpoint_type: str or ~azure.mgmt.frontdoor.models.EndpointType + :ivar backend: The preconfigured endpoint backend. + :vartype backend: str """ _validation = { @@ -2684,6 +3272,21 @@ def __init__( backend: Optional[str] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of the endpoint. + :paramtype description: str + :keyword endpoint: The endpoint that is preconfigured. + :paramtype endpoint: str + :keyword endpoint_type: The type of endpoint. Possible values include: "AFD", "AzureRegion", + "CDN", "ATM". + :paramtype endpoint_type: str or ~azure.mgmt.frontdoor.models.EndpointType + :keyword backend: The preconfigured endpoint backend. + :paramtype backend: str + """ super(PreconfiguredEndpoint, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.endpoint = endpoint @@ -2698,8 +3301,8 @@ class PreconfiguredEndpointList(msrest.serialization.Model): :ivar value: List of PreconfiguredEndpoints supported by NetworkExperiment. :vartype value: list[~azure.mgmt.frontdoor.models.PreconfiguredEndpoint] - :param next_link: URL to get the next set of PreconfiguredEndpoints if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of PreconfiguredEndpoints if there are any. + :vartype next_link: str """ _validation = { @@ -2717,6 +3320,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of PreconfiguredEndpoints if there are any. + :paramtype next_link: str + """ super(PreconfiguredEndpointList, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -2733,18 +3340,18 @@ class Profile(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param etag: Gets a unique read-only string that changes whenever the resource is updated. - :type etag: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar etag: Gets a unique read-only string that changes whenever the resource is updated. + :vartype etag: str :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.NetworkExperimentResourceState - :param enabled_state: The state of the Experiment. Possible values include: "Enabled", + :ivar enabled_state: The state of the Experiment. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.State + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.State """ _validation = { @@ -2774,6 +3381,17 @@ def __init__( enabled_state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword etag: Gets a unique read-only string that changes whenever the resource is updated. + :paramtype etag: str + :keyword enabled_state: The state of the Experiment. Possible values include: "Enabled", + "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.State + """ super(Profile, self).__init__(location=location, tags=tags, **kwargs) self.etag = etag self.resource_state = None @@ -2787,8 +3405,8 @@ class ProfileList(msrest.serialization.Model): :ivar value: List of Profiles within a resource group. :vartype value: list[~azure.mgmt.frontdoor.models.Profile] - :param next_link: URL to get the next set of Profile objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of Profile objects if there are any. + :vartype next_link: str """ _validation = { @@ -2806,6 +3424,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of Profile objects if there are any. + :paramtype next_link: str + """ super(ProfileList, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -2814,11 +3436,11 @@ def __init__( class ProfileUpdateModel(msrest.serialization.Model): """Defines modifiable attributes of a Profile. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param enabled_state: The enabled state of the Profile. Possible values include: "Enabled", + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar enabled_state: The enabled state of the Profile. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.State + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.State """ _attribute_map = { @@ -2833,6 +3455,13 @@ def __init__( enabled_state: Optional[Union[str, "State"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword enabled_state: The enabled state of the Profile. Possible values include: "Enabled", + "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.State + """ super(ProfileUpdateModel, self).__init__(**kwargs) self.tags = tags self.enabled_state = enabled_state @@ -2843,9 +3472,9 @@ class PurgeParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param content_paths: Required. The path to the content to be purged. Can describe a file path + :ivar content_paths: Required. The path to the content to be purged. Can describe a file path or a wild card directory. - :type content_paths: list[str] + :vartype content_paths: list[str] """ _validation = { @@ -2862,6 +3491,11 @@ def __init__( content_paths: List[str], **kwargs ): + """ + :keyword content_paths: Required. The path to the content to be purged. Can describe a file + path or a wild card directory. + :paramtype content_paths: list[str] + """ super(PurgeParameters, self).__init__(**kwargs) self.content_paths = content_paths @@ -2871,29 +3505,29 @@ class RedirectConfiguration(RouteConfiguration): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. Constant filled by server. - :type odata_type: str - :param redirect_type: The redirect type the rule will use when redirecting traffic. Possible + :ivar odata_type: Required. Constant filled by server. + :vartype odata_type: str + :ivar redirect_type: The redirect type the rule will use when redirecting traffic. Possible values include: "Moved", "Found", "TemporaryRedirect", "PermanentRedirect". - :type redirect_type: str or ~azure.mgmt.frontdoor.models.FrontDoorRedirectType - :param redirect_protocol: The protocol of the destination to where the traffic is redirected. + :vartype redirect_type: str or ~azure.mgmt.frontdoor.models.FrontDoorRedirectType + :ivar redirect_protocol: The protocol of the destination to where the traffic is redirected. Possible values include: "HttpOnly", "HttpsOnly", "MatchRequest". - :type redirect_protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorRedirectProtocol - :param custom_host: Host to redirect. Leave empty to use the incoming host as the destination + :vartype redirect_protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorRedirectProtocol + :ivar custom_host: Host to redirect. Leave empty to use the incoming host as the destination host. - :type custom_host: str - :param custom_path: The full path to redirect. Path cannot be empty and must start with /. - Leave empty to use the incoming path as destination path. - :type custom_path: str - :param custom_fragment: Fragment to add to the redirect URL. Fragment is the part of the URL + :vartype custom_host: str + :ivar custom_path: The full path to redirect. Path cannot be empty and must start with /. Leave + empty to use the incoming path as destination path. + :vartype custom_path: str + :ivar custom_fragment: Fragment to add to the redirect URL. Fragment is the part of the URL that comes after #. Do not include the #. - :type custom_fragment: str - :param custom_query_string: The set of query strings to be placed in the redirect URL. Setting + :vartype custom_fragment: str + :ivar custom_query_string: The set of query strings to be placed in the redirect URL. Setting this value would replace any existing query string; leave empty to preserve the incoming query string. Query string must be in :code:``=:code:`` format. The first ? and & will be added automatically so do not include them in the front, but do separate multiple query strings with &. - :type custom_query_string: str + :vartype custom_query_string: str """ _validation = { @@ -2921,6 +3555,29 @@ def __init__( custom_query_string: Optional[str] = None, **kwargs ): + """ + :keyword redirect_type: The redirect type the rule will use when redirecting traffic. Possible + values include: "Moved", "Found", "TemporaryRedirect", "PermanentRedirect". + :paramtype redirect_type: str or ~azure.mgmt.frontdoor.models.FrontDoorRedirectType + :keyword redirect_protocol: The protocol of the destination to where the traffic is redirected. + Possible values include: "HttpOnly", "HttpsOnly", "MatchRequest". + :paramtype redirect_protocol: str or ~azure.mgmt.frontdoor.models.FrontDoorRedirectProtocol + :keyword custom_host: Host to redirect. Leave empty to use the incoming host as the destination + host. + :paramtype custom_host: str + :keyword custom_path: The full path to redirect. Path cannot be empty and must start with /. + Leave empty to use the incoming path as destination path. + :paramtype custom_path: str + :keyword custom_fragment: Fragment to add to the redirect URL. Fragment is the part of the URL + that comes after #. Do not include the #. + :paramtype custom_fragment: str + :keyword custom_query_string: The set of query strings to be placed in the redirect URL. + Setting this value would replace any existing query string; leave empty to preserve the + incoming query string. Query string must be in :code:``=:code:`` format. The first + ? and & will be added automatically so do not include them in the front, but do separate + multiple query strings with &. + :paramtype custom_query_string: str + """ super(RedirectConfiguration, self).__init__(**kwargs) self.odata_type = '#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration' # type: str self.redirect_type = redirect_type @@ -2936,29 +3593,29 @@ class RoutingRule(SubResource): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource ID. - :type id: str - :param name: Resource name. - :type name: str + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str :ivar type: Resource type. :vartype type: str - :param frontend_endpoints: Frontend endpoints associated with this rule. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] - :param accepted_protocols: Protocol schemes to match for this rule. - :type accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + :ivar frontend_endpoints: Frontend endpoints associated with this rule. + :vartype frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] + :ivar accepted_protocols: Protocol schemes to match for this rule. + :vartype accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] + :ivar patterns_to_match: The route patterns of the rule. + :vartype patterns_to_match: list[str] + :ivar enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState - :param route_configuration: A reference to the routing configuration. - :type route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration - :param rules_engine: A reference to a specific Rules Engine Configuration to apply to this + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState + :ivar route_configuration: A reference to the routing configuration. + :vartype route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration + :ivar rules_engine: A reference to a specific Rules Engine Configuration to apply to this route. - :type rules_engine: ~azure.mgmt.frontdoor.models.SubResource - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for + :vartype rules_engine: ~azure.mgmt.frontdoor.models.SubResource + :ivar web_application_firewall_policy_link: Defines the Web Application Firewall policy for each routing rule (if applicable). - :type web_application_firewall_policy_link: + :vartype web_application_firewall_policy_link: ~azure.mgmt.frontdoor.models.RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". @@ -2998,6 +3655,30 @@ def __init__( web_application_firewall_policy_link: Optional["RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink"] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + :keyword name: Resource name. + :paramtype name: str + :keyword frontend_endpoints: Frontend endpoints associated with this rule. + :paramtype frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] + :keyword accepted_protocols: Protocol schemes to match for this rule. + :paramtype accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] + :keyword patterns_to_match: The route patterns of the rule. + :paramtype patterns_to_match: list[str] + :keyword enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState + :keyword route_configuration: A reference to the routing configuration. + :paramtype route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration + :keyword rules_engine: A reference to a specific Rules Engine Configuration to apply to this + route. + :paramtype rules_engine: ~azure.mgmt.frontdoor.models.SubResource + :keyword web_application_firewall_policy_link: Defines the Web Application Firewall policy for + each routing rule (if applicable). + :paramtype web_application_firewall_policy_link: + ~azure.mgmt.frontdoor.models.RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink + """ super(RoutingRule, self).__init__(id=id, **kwargs) self.name = name self.type = None @@ -3014,8 +3695,8 @@ def __init__( class RoutingRuleLink(msrest.serialization.Model): """Defines the Resource ID for a Routing Rule. - :param id: Resource ID. - :type id: str + :ivar id: Resource ID. + :vartype id: str """ _attribute_map = { @@ -3028,6 +3709,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ super(RoutingRuleLink, self).__init__(**kwargs) self.id = id @@ -3039,8 +3724,8 @@ class RoutingRuleListResult(msrest.serialization.Model): :ivar value: List of Routing Rules within a Front Door. :vartype value: list[~azure.mgmt.frontdoor.models.RoutingRule] - :param next_link: URL to get the next set of RoutingRule objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of RoutingRule objects if there are any. + :vartype next_link: str """ _validation = { @@ -3058,6 +3743,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of RoutingRule objects if there are any. + :paramtype next_link: str + """ super(RoutingRuleListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -3066,23 +3755,23 @@ def __init__( class RoutingRuleUpdateParameters(msrest.serialization.Model): """Routing rules to apply to an endpoint. - :param frontend_endpoints: Frontend endpoints associated with this rule. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] - :param accepted_protocols: Protocol schemes to match for this rule. - :type accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + :ivar frontend_endpoints: Frontend endpoints associated with this rule. + :vartype frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] + :ivar accepted_protocols: Protocol schemes to match for this rule. + :vartype accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] + :ivar patterns_to_match: The route patterns of the rule. + :vartype patterns_to_match: list[str] + :ivar enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState - :param route_configuration: A reference to the routing configuration. - :type route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration - :param rules_engine: A reference to a specific Rules Engine Configuration to apply to this + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState + :ivar route_configuration: A reference to the routing configuration. + :vartype route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration + :ivar rules_engine: A reference to a specific Rules Engine Configuration to apply to this route. - :type rules_engine: ~azure.mgmt.frontdoor.models.SubResource - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for + :vartype rules_engine: ~azure.mgmt.frontdoor.models.SubResource + :ivar web_application_firewall_policy_link: Defines the Web Application Firewall policy for each routing rule (if applicable). - :type web_application_firewall_policy_link: + :vartype web_application_firewall_policy_link: ~azure.mgmt.frontdoor.models.RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink """ @@ -3108,6 +3797,26 @@ def __init__( web_application_firewall_policy_link: Optional["RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink"] = None, **kwargs ): + """ + :keyword frontend_endpoints: Frontend endpoints associated with this rule. + :paramtype frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] + :keyword accepted_protocols: Protocol schemes to match for this rule. + :paramtype accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] + :keyword patterns_to_match: The route patterns of the rule. + :paramtype patterns_to_match: list[str] + :keyword enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState + :keyword route_configuration: A reference to the routing configuration. + :paramtype route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration + :keyword rules_engine: A reference to a specific Rules Engine Configuration to apply to this + route. + :paramtype rules_engine: ~azure.mgmt.frontdoor.models.SubResource + :keyword web_application_firewall_policy_link: Defines the Web Application Firewall policy for + each routing rule (if applicable). + :paramtype web_application_firewall_policy_link: + ~azure.mgmt.frontdoor.models.RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink + """ super(RoutingRuleUpdateParameters, self).__init__(**kwargs) self.frontend_endpoints = frontend_endpoints self.accepted_protocols = accepted_protocols @@ -3123,23 +3832,23 @@ class RoutingRuleProperties(RoutingRuleUpdateParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param frontend_endpoints: Frontend endpoints associated with this rule. - :type frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] - :param accepted_protocols: Protocol schemes to match for this rule. - :type accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + :ivar frontend_endpoints: Frontend endpoints associated with this rule. + :vartype frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] + :ivar accepted_protocols: Protocol schemes to match for this rule. + :vartype accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] + :ivar patterns_to_match: The route patterns of the rule. + :vartype patterns_to_match: list[str] + :ivar enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState - :param route_configuration: A reference to the routing configuration. - :type route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration - :param rules_engine: A reference to a specific Rules Engine Configuration to apply to this + :vartype enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState + :ivar route_configuration: A reference to the routing configuration. + :vartype route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration + :ivar rules_engine: A reference to a specific Rules Engine Configuration to apply to this route. - :type rules_engine: ~azure.mgmt.frontdoor.models.SubResource - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for + :vartype rules_engine: ~azure.mgmt.frontdoor.models.SubResource + :ivar web_application_firewall_policy_link: Defines the Web Application Firewall policy for each routing rule (if applicable). - :type web_application_firewall_policy_link: + :vartype web_application_firewall_policy_link: ~azure.mgmt.frontdoor.models.RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". @@ -3173,6 +3882,26 @@ def __init__( web_application_firewall_policy_link: Optional["RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink"] = None, **kwargs ): + """ + :keyword frontend_endpoints: Frontend endpoints associated with this rule. + :paramtype frontend_endpoints: list[~azure.mgmt.frontdoor.models.SubResource] + :keyword accepted_protocols: Protocol schemes to match for this rule. + :paramtype accepted_protocols: list[str or ~azure.mgmt.frontdoor.models.FrontDoorProtocol] + :keyword patterns_to_match: The route patterns of the rule. + :paramtype patterns_to_match: list[str] + :keyword enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype enabled_state: str or ~azure.mgmt.frontdoor.models.RoutingRuleEnabledState + :keyword route_configuration: A reference to the routing configuration. + :paramtype route_configuration: ~azure.mgmt.frontdoor.models.RouteConfiguration + :keyword rules_engine: A reference to a specific Rules Engine Configuration to apply to this + route. + :paramtype rules_engine: ~azure.mgmt.frontdoor.models.SubResource + :keyword web_application_firewall_policy_link: Defines the Web Application Firewall policy for + each routing rule (if applicable). + :paramtype web_application_firewall_policy_link: + ~azure.mgmt.frontdoor.models.RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink + """ super(RoutingRuleProperties, self).__init__(frontend_endpoints=frontend_endpoints, accepted_protocols=accepted_protocols, patterns_to_match=patterns_to_match, enabled_state=enabled_state, route_configuration=route_configuration, rules_engine=rules_engine, web_application_firewall_policy_link=web_application_firewall_policy_link, **kwargs) self.resource_state = None @@ -3180,8 +3909,8 @@ def __init__( class RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink(msrest.serialization.Model): """Defines the Web Application Firewall policy for each routing rule (if applicable). - :param id: Resource ID. - :type id: str + :ivar id: Resource ID. + :vartype id: str """ _attribute_map = { @@ -3194,6 +3923,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ super(RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink, self).__init__(**kwargs) self.id = id @@ -3209,8 +3942,8 @@ class RulesEngine(msrest.serialization.Model): :vartype type: str :ivar id: Resource ID. :vartype id: str - :param rules: A list of rules that define a particular Rules Engine Configuration. - :type rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] + :ivar rules: A list of rules that define a particular Rules Engine Configuration. + :vartype rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState @@ -3237,6 +3970,10 @@ def __init__( rules: Optional[List["RulesEngineRule"]] = None, **kwargs ): + """ + :keyword rules: A list of rules that define a particular Rules Engine Configuration. + :paramtype rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] + """ super(RulesEngine, self).__init__(**kwargs) self.name = None self.type = None @@ -3248,14 +3985,14 @@ def __init__( class RulesEngineAction(msrest.serialization.Model): """One or more actions that will execute, modifying the request and/or response. - :param request_header_actions: A list of header actions to apply from the request from AFD to + :ivar request_header_actions: A list of header actions to apply from the request from AFD to the origin. - :type request_header_actions: list[~azure.mgmt.frontdoor.models.HeaderAction] - :param response_header_actions: A list of header actions to apply from the response from AFD to + :vartype request_header_actions: list[~azure.mgmt.frontdoor.models.HeaderAction] + :ivar response_header_actions: A list of header actions to apply from the response from AFD to the client. - :type response_header_actions: list[~azure.mgmt.frontdoor.models.HeaderAction] - :param route_configuration_override: Override the route configuration. - :type route_configuration_override: ~azure.mgmt.frontdoor.models.RouteConfiguration + :vartype response_header_actions: list[~azure.mgmt.frontdoor.models.HeaderAction] + :ivar route_configuration_override: Override the route configuration. + :vartype route_configuration_override: ~azure.mgmt.frontdoor.models.RouteConfiguration """ _attribute_map = { @@ -3272,6 +4009,16 @@ def __init__( route_configuration_override: Optional["RouteConfiguration"] = None, **kwargs ): + """ + :keyword request_header_actions: A list of header actions to apply from the request from AFD to + the origin. + :paramtype request_header_actions: list[~azure.mgmt.frontdoor.models.HeaderAction] + :keyword response_header_actions: A list of header actions to apply from the response from AFD + to the client. + :paramtype response_header_actions: list[~azure.mgmt.frontdoor.models.HeaderAction] + :keyword route_configuration_override: Override the route configuration. + :paramtype route_configuration_override: ~azure.mgmt.frontdoor.models.RouteConfiguration + """ super(RulesEngineAction, self).__init__(**kwargs) self.request_header_actions = request_header_actions self.response_header_actions = response_header_actions @@ -3285,8 +4032,8 @@ class RulesEngineListResult(msrest.serialization.Model): :ivar value: List of rulesEngines within a Front Door. :vartype value: list[~azure.mgmt.frontdoor.models.RulesEngine] - :param next_link: URL to get the next set of RulesEngine objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of RulesEngine objects if there are any. + :vartype next_link: str """ _validation = { @@ -3304,6 +4051,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of RulesEngine objects if there are any. + :paramtype next_link: str + """ super(RulesEngineListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -3314,25 +4065,26 @@ class RulesEngineMatchCondition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param rules_engine_match_variable: Required. Match Variable. Possible values include: + :ivar rules_engine_match_variable: Required. Match Variable. Possible values include: "IsMobile", "RemoteAddr", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestPath", "RequestFilename", "RequestFilenameExtension", "RequestHeader", "RequestBody", "RequestScheme". - :type rules_engine_match_variable: str or ~azure.mgmt.frontdoor.models.RulesEngineMatchVariable - :param selector: Name of selector in RequestHeader or RequestBody to be matched. - :type selector: str - :param rules_engine_operator: Required. Describes operator to apply to the match condition. + :vartype rules_engine_match_variable: str or + ~azure.mgmt.frontdoor.models.RulesEngineMatchVariable + :ivar selector: Name of selector in RequestHeader or RequestBody to be matched. + :vartype selector: str + :ivar rules_engine_operator: Required. Describes operator to apply to the match condition. Possible values include: "Any", "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", "EndsWith". - :type rules_engine_operator: str or ~azure.mgmt.frontdoor.models.RulesEngineOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param rules_engine_match_value: Required. Match values to match against. The operator will + :vartype rules_engine_operator: str or ~azure.mgmt.frontdoor.models.RulesEngineOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar rules_engine_match_value: Required. Match values to match against. The operator will apply to each value in here with OR semantics. If any of them match the variable with the given operator this match condition is considered a match. - :type rules_engine_match_value: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.frontdoor.models.Transform] + :vartype rules_engine_match_value: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.frontdoor.models.Transform] """ _validation = { @@ -3361,6 +4113,28 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword rules_engine_match_variable: Required. Match Variable. Possible values include: + "IsMobile", "RemoteAddr", "RequestMethod", "QueryString", "PostArgs", "RequestUri", + "RequestPath", "RequestFilename", "RequestFilenameExtension", "RequestHeader", "RequestBody", + "RequestScheme". + :paramtype rules_engine_match_variable: str or + ~azure.mgmt.frontdoor.models.RulesEngineMatchVariable + :keyword selector: Name of selector in RequestHeader or RequestBody to be matched. + :paramtype selector: str + :keyword rules_engine_operator: Required. Describes operator to apply to the match condition. + Possible values include: "Any", "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", + "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", "EndsWith". + :paramtype rules_engine_operator: str or ~azure.mgmt.frontdoor.models.RulesEngineOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword rules_engine_match_value: Required. Match values to match against. The operator will + apply to each value in here with OR semantics. If any of them match the variable with the given + operator this match condition is considered a match. + :paramtype rules_engine_match_value: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.frontdoor.models.Transform] + """ super(RulesEngineMatchCondition, self).__init__(**kwargs) self.rules_engine_match_variable = rules_engine_match_variable self.selector = selector @@ -3373,8 +4147,8 @@ def __init__( class RulesEngineUpdateParameters(msrest.serialization.Model): """Rules Engine Configuration to apply to a Routing Rule. - :param rules: A list of rules that define a particular Rules Engine Configuration. - :type rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] + :ivar rules: A list of rules that define a particular Rules Engine Configuration. + :vartype rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] """ _attribute_map = { @@ -3387,6 +4161,10 @@ def __init__( rules: Optional[List["RulesEngineRule"]] = None, **kwargs ): + """ + :keyword rules: A list of rules that define a particular Rules Engine Configuration. + :paramtype rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] + """ super(RulesEngineUpdateParameters, self).__init__(**kwargs) self.rules = rules @@ -3396,8 +4174,8 @@ class RulesEngineProperties(RulesEngineUpdateParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param rules: A list of rules that define a particular Rules Engine Configuration. - :type rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] + :ivar rules: A list of rules that define a particular Rules Engine Configuration. + :vartype rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] :ivar resource_state: Resource status. Possible values include: "Creating", "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". :vartype resource_state: str or ~azure.mgmt.frontdoor.models.FrontDoorResourceState @@ -3418,6 +4196,10 @@ def __init__( rules: Optional[List["RulesEngineRule"]] = None, **kwargs ): + """ + :keyword rules: A list of rules that define a particular Rules Engine Configuration. + :paramtype rules: list[~azure.mgmt.frontdoor.models.RulesEngineRule] + """ super(RulesEngineProperties, self).__init__(rules=rules, **kwargs) self.resource_state = None @@ -3427,20 +4209,20 @@ class RulesEngineRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. A name to refer to this specific rule. - :type name: str - :param priority: Required. A priority assigned to this rule. - :type priority: int - :param action: Required. Actions to perform on the request and response if all of the match + :ivar name: Required. A name to refer to this specific rule. + :vartype name: str + :ivar priority: Required. A priority assigned to this rule. + :vartype priority: int + :ivar action: Required. Actions to perform on the request and response if all of the match conditions are met. - :type action: ~azure.mgmt.frontdoor.models.RulesEngineAction - :param match_conditions: A list of match conditions that must meet in order for the actions of + :vartype action: ~azure.mgmt.frontdoor.models.RulesEngineAction + :ivar match_conditions: A list of match conditions that must meet in order for the actions of this rule to run. Having no match conditions means the actions will always run. - :type match_conditions: list[~azure.mgmt.frontdoor.models.RulesEngineMatchCondition] - :param match_processing_behavior: If this rule is a match should the rules engine continue + :vartype match_conditions: list[~azure.mgmt.frontdoor.models.RulesEngineMatchCondition] + :ivar match_processing_behavior: If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. Possible values include: "Continue", "Stop". - :type match_processing_behavior: str or ~azure.mgmt.frontdoor.models.MatchProcessingBehavior + :vartype match_processing_behavior: str or ~azure.mgmt.frontdoor.models.MatchProcessingBehavior """ _validation = { @@ -3467,6 +4249,23 @@ def __init__( match_processing_behavior: Optional[Union[str, "MatchProcessingBehavior"]] = None, **kwargs ): + """ + :keyword name: Required. A name to refer to this specific rule. + :paramtype name: str + :keyword priority: Required. A priority assigned to this rule. + :paramtype priority: int + :keyword action: Required. Actions to perform on the request and response if all of the match + conditions are met. + :paramtype action: ~azure.mgmt.frontdoor.models.RulesEngineAction + :keyword match_conditions: A list of match conditions that must meet in order for the actions + of this rule to run. Having no match conditions means the actions will always run. + :paramtype match_conditions: list[~azure.mgmt.frontdoor.models.RulesEngineMatchCondition] + :keyword match_processing_behavior: If this rule is a match should the rules engine continue + running the remaining rules or stop. If not present, defaults to Continue. Possible values + include: "Continue", "Stop". + :paramtype match_processing_behavior: str or + ~azure.mgmt.frontdoor.models.MatchProcessingBehavior + """ super(RulesEngineRule, self).__init__(**kwargs) self.name = name self.priority = priority @@ -3478,8 +4277,8 @@ def __init__( class SecurityPolicyLink(msrest.serialization.Model): """Defines the Resource ID for a Security Policy. - :param id: Resource ID. - :type id: str + :ivar id: Resource ID. + :vartype id: str """ _attribute_map = { @@ -3492,6 +4291,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ super(SecurityPolicyLink, self).__init__(**kwargs) self.id = id @@ -3499,9 +4302,9 @@ def __init__( class Sku(msrest.serialization.Model): """The pricing tier of the web application firewall policy. - :param name: Name of the pricing tier. Possible values include: "Classic_AzureFrontDoor", + :ivar name: Name of the pricing tier. Possible values include: "Classic_AzureFrontDoor", "Standard_AzureFrontDoor", "Premium_AzureFrontDoor". - :type name: str or ~azure.mgmt.frontdoor.models.SkuName + :vartype name: str or ~azure.mgmt.frontdoor.models.SkuName """ _attribute_map = { @@ -3514,6 +4317,11 @@ def __init__( name: Optional[Union[str, "SkuName"]] = None, **kwargs ): + """ + :keyword name: Name of the pricing tier. Possible values include: "Classic_AzureFrontDoor", + "Standard_AzureFrontDoor", "Premium_AzureFrontDoor". + :paramtype name: str or ~azure.mgmt.frontdoor.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name @@ -3521,8 +4329,8 @@ def __init__( class TagsObject(msrest.serialization.Model): """Tags object for patch operations. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -3535,6 +4343,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(TagsObject, self).__init__(**kwargs) self.tags = tags @@ -3550,27 +4362,27 @@ class Timeseries(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param endpoint: The endpoint associated with the Timeseries data point. - :type endpoint: str - :param start_date_time_utc: The start DateTime of the Timeseries in UTC. - :type start_date_time_utc: str - :param end_date_time_utc: The end DateTime of the Timeseries in UTC. - :type end_date_time_utc: str - :param aggregation_interval: The aggregation interval of the Timeseries. Possible values + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar endpoint: The endpoint associated with the Timeseries data point. + :vartype endpoint: str + :ivar start_date_time_utc: The start DateTime of the Timeseries in UTC. + :vartype start_date_time_utc: str + :ivar end_date_time_utc: The end DateTime of the Timeseries in UTC. + :vartype end_date_time_utc: str + :ivar aggregation_interval: The aggregation interval of the Timeseries. Possible values include: "Hourly", "Daily". - :type aggregation_interval: str or ~azure.mgmt.frontdoor.models.AggregationInterval - :param timeseries_type: The type of Timeseries. Possible values include: "MeasurementCounts", + :vartype aggregation_interval: str or ~azure.mgmt.frontdoor.models.AggregationInterval + :ivar timeseries_type: The type of Timeseries. Possible values include: "MeasurementCounts", "LatencyP50", "LatencyP75", "LatencyP95". - :type timeseries_type: str or ~azure.mgmt.frontdoor.models.TimeseriesType - :param country: The country associated with the Timeseries. Values are country ISO codes as + :vartype timeseries_type: str or ~azure.mgmt.frontdoor.models.TimeseriesType + :ivar country: The country associated with the Timeseries. Values are country ISO codes as specified here- https://www.iso.org/iso-3166-country-codes.html. - :type country: str - :param timeseries_data: The set of data points for the timeseries. - :type timeseries_data: list[~azure.mgmt.frontdoor.models.TimeseriesDataPoint] + :vartype country: str + :ivar timeseries_data: The set of data points for the timeseries. + :vartype timeseries_data: list[~azure.mgmt.frontdoor.models.TimeseriesDataPoint] """ _validation = { @@ -3608,6 +4420,29 @@ def __init__( timeseries_data: Optional[List["TimeseriesDataPoint"]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword endpoint: The endpoint associated with the Timeseries data point. + :paramtype endpoint: str + :keyword start_date_time_utc: The start DateTime of the Timeseries in UTC. + :paramtype start_date_time_utc: str + :keyword end_date_time_utc: The end DateTime of the Timeseries in UTC. + :paramtype end_date_time_utc: str + :keyword aggregation_interval: The aggregation interval of the Timeseries. Possible values + include: "Hourly", "Daily". + :paramtype aggregation_interval: str or ~azure.mgmt.frontdoor.models.AggregationInterval + :keyword timeseries_type: The type of Timeseries. Possible values include: "MeasurementCounts", + "LatencyP50", "LatencyP75", "LatencyP95". + :paramtype timeseries_type: str or ~azure.mgmt.frontdoor.models.TimeseriesType + :keyword country: The country associated with the Timeseries. Values are country ISO codes as + specified here- https://www.iso.org/iso-3166-country-codes.html. + :paramtype country: str + :keyword timeseries_data: The set of data points for the timeseries. + :paramtype timeseries_data: list[~azure.mgmt.frontdoor.models.TimeseriesDataPoint] + """ super(Timeseries, self).__init__(location=location, tags=tags, **kwargs) self.endpoint = endpoint self.start_date_time_utc = start_date_time_utc @@ -3621,10 +4456,10 @@ def __init__( class TimeseriesDataPoint(msrest.serialization.Model): """Defines a timeseries datapoint used in a timeseries. - :param date_time_utc: The DateTime of the Timeseries data point in UTC. - :type date_time_utc: str - :param value: The Value of the Timeseries data point. - :type value: float + :ivar date_time_utc: The DateTime of the Timeseries data point in UTC. + :vartype date_time_utc: str + :ivar value: The Value of the Timeseries data point. + :vartype value: float """ _attribute_map = { @@ -3639,6 +4474,12 @@ def __init__( value: Optional[float] = None, **kwargs ): + """ + :keyword date_time_utc: The DateTime of the Timeseries data point in UTC. + :paramtype date_time_utc: str + :keyword value: The Value of the Timeseries data point. + :paramtype value: float + """ super(TimeseriesDataPoint, self).__init__(**kwargs) self.date_time_utc = date_time_utc self.value = value @@ -3649,8 +4490,8 @@ class ValidateCustomDomainInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param host_name: Required. The host name of the custom domain. Must be a domain name. - :type host_name: str + :ivar host_name: Required. The host name of the custom domain. Must be a domain name. + :vartype host_name: str """ _validation = { @@ -3667,6 +4508,10 @@ def __init__( host_name: str, **kwargs ): + """ + :keyword host_name: Required. The host name of the custom domain. Must be a domain name. + :paramtype host_name: str + """ super(ValidateCustomDomainInput, self).__init__(**kwargs) self.host_name = host_name @@ -3700,6 +4545,8 @@ def __init__( self, **kwargs ): + """ + """ super(ValidateCustomDomainOutput, self).__init__(**kwargs) self.custom_domain_validated = None self.reason = None @@ -3717,21 +4564,21 @@ class WebApplicationFirewallPolicy(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param etag: Gets a unique read-only string that changes whenever the resource is updated. - :type etag: str - :param sku: The pricing tier of web application firewall policy. Defaults to + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar etag: Gets a unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar sku: The pricing tier of web application firewall policy. Defaults to Classic_AzureFrontDoor if not specified. - :type sku: ~azure.mgmt.frontdoor.models.Sku - :param policy_settings: Describes settings for the policy. - :type policy_settings: ~azure.mgmt.frontdoor.models.PolicySettings - :param custom_rules: Describes custom rules inside the policy. - :type custom_rules: ~azure.mgmt.frontdoor.models.CustomRuleList - :param managed_rules: Describes managed rules inside the policy. - :type managed_rules: ~azure.mgmt.frontdoor.models.ManagedRuleSetList + :vartype sku: ~azure.mgmt.frontdoor.models.Sku + :ivar policy_settings: Describes settings for the policy. + :vartype policy_settings: ~azure.mgmt.frontdoor.models.PolicySettings + :ivar custom_rules: Describes custom rules inside the policy. + :vartype custom_rules: ~azure.mgmt.frontdoor.models.CustomRuleList + :ivar managed_rules: Describes managed rules inside the policy. + :vartype managed_rules: ~azure.mgmt.frontdoor.models.ManagedRuleSetList :ivar frontend_endpoint_links: Describes Frontend Endpoints associated with this Web Application Firewall policy. :vartype frontend_endpoint_links: list[~azure.mgmt.frontdoor.models.FrontendEndpointLink] @@ -3789,6 +4636,23 @@ def __init__( managed_rules: Optional["ManagedRuleSetList"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword etag: Gets a unique read-only string that changes whenever the resource is updated. + :paramtype etag: str + :keyword sku: The pricing tier of web application firewall policy. Defaults to + Classic_AzureFrontDoor if not specified. + :paramtype sku: ~azure.mgmt.frontdoor.models.Sku + :keyword policy_settings: Describes settings for the policy. + :paramtype policy_settings: ~azure.mgmt.frontdoor.models.PolicySettings + :keyword custom_rules: Describes custom rules inside the policy. + :paramtype custom_rules: ~azure.mgmt.frontdoor.models.CustomRuleList + :keyword managed_rules: Describes managed rules inside the policy. + :paramtype managed_rules: ~azure.mgmt.frontdoor.models.ManagedRuleSetList + """ super(WebApplicationFirewallPolicy, self).__init__(location=location, tags=tags, **kwargs) self.etag = etag self.sku = sku @@ -3809,9 +4673,9 @@ class WebApplicationFirewallPolicyList(msrest.serialization.Model): :ivar value: List of WebApplicationFirewallPolicies within a resource group. :vartype value: list[~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicy] - :param next_link: URL to get the next set of WebApplicationFirewallPolicy objects if there are + :ivar next_link: URL to get the next set of WebApplicationFirewallPolicy objects if there are any. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -3829,6 +4693,11 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of WebApplicationFirewallPolicy objects if there + are any. + :paramtype next_link: str + """ super(WebApplicationFirewallPolicyList, self).__init__(**kwargs) self.value = None self.next_link = next_link diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_endpoints_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_endpoints_operations.py index 6c9c81ef1f217..34ba2249654af 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_endpoints_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_endpoints_operations.py @@ -5,24 +5,71 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_purge_content_request_initial( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/purge') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class EndpointsOperations(object): """EndpointsOperations operations. @@ -48,64 +95,53 @@ def __init__(self, client, config, serializer, deserializer): def _purge_content_initial( self, - resource_group_name, # type: str - front_door_name, # type: str - content_file_paths, # type: "_models.PurgeParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + front_door_name: str, + content_file_paths: "_models.PurgeParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._purge_content_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(content_file_paths, 'PurgeParameters') + + request = build_purge_content_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + content_type=content_type, + json=_json, + template_url=self._purge_content_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(content_file_paths, 'PurgeParameters') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _purge_content_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/purge'} # type: ignore + + @distributed_trace def begin_purge_content( self, - resource_group_name, # type: str - front_door_name, # type: str - content_file_paths, # type: "_models.PurgeParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + front_door_name: str, + content_file_paths: "_models.PurgeParameters", + **kwargs: Any + ) -> LROPoller[None]: """Removes a content from Front Door. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -118,15 +154,18 @@ def begin_purge_content( :type content_file_paths: ~azure.mgmt.frontdoor.models.PurgeParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -138,24 +177,18 @@ def begin_purge_content( resource_group_name=resource_group_name, front_door_name=front_door_name, content_file_paths=content_file_paths, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -167,4 +200,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_content.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/purge'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_experiments_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_experiments_operations.py index 1c53b3924b0b4..3496c9423f589 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_experiments_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_experiments_operations.py @@ -5,25 +5,229 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_profile_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + experiment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + profile_name: str, + experiment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + profile_name: str, + experiment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + profile_name: str, + experiment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExperimentsOperations(object): """ExperimentsOperations operations. @@ -47,13 +251,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_profile( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExperimentList"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.ExperimentList"]: """Gets a list of Experiments. Gets a list of Experiments. @@ -72,36 +276,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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_profile.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self.list_by_profile.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExperimentList', pipeline_response) + deserialized = self._deserialize("ExperimentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,25 +315,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - experiment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Experiment" + resource_group_name: str, + profile_name: str, + experiment_name: str, + **kwargs: Any + ) -> "_models.Experiment": """Gets an Experiment by ExperimentName. Gets an Experiment by ExperimentName. @@ -153,34 +355,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Experiment', pipeline_response) @@ -189,56 +381,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - experiment_name, # type: str - parameters, # type: "_models.Experiment" - **kwargs # type: Any - ): - # type: (...) -> "_models.Experiment" + resource_group_name: str, + profile_name: str, + experiment_name: str, + parameters: "_models.Experiment", + **kwargs: Any + ) -> "_models.Experiment": cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Experiment') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Experiment') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Experiment', pipeline_response) @@ -253,17 +435,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - profile_name, # type: str - experiment_name, # type: str - parameters, # type: "_models.Experiment" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Experiment"] + resource_group_name: str, + profile_name: str, + experiment_name: str, + parameters: "_models.Experiment", + **kwargs: Any + ) -> LROPoller["_models.Experiment"]: """Creates or updates an Experiment. Creates or updates an Experiment. @@ -278,15 +462,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.frontdoor.models.Experiment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Experiment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.frontdoor.models.Experiment] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,28 +486,21 @@ def begin_create_or_update( profile_name=profile_name, experiment_name=experiment_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Experiment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -332,56 +512,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - experiment_name, # type: str - parameters, # type: "_models.ExperimentUpdateModel" - **kwargs # type: Any - ): - # type: (...) -> "_models.Experiment" + resource_group_name: str, + profile_name: str, + experiment_name: str, + parameters: "_models.ExperimentUpdateModel", + **kwargs: Any + ) -> "_models.Experiment": cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ExperimentUpdateModel') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ExperimentUpdateModel') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Experiment', pipeline_response) @@ -393,17 +562,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - experiment_name, # type: str - parameters, # type: "_models.ExperimentUpdateModel" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Experiment"] + resource_group_name: str, + profile_name: str, + experiment_name: str, + parameters: "_models.ExperimentUpdateModel", + **kwargs: Any + ) -> LROPoller["_models.Experiment"]: """Updates an Experiment by Experiment id. Updates an Experiment. @@ -418,15 +589,18 @@ def begin_update( :type parameters: ~azure.mgmt.frontdoor.models.ExperimentUpdateModel :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Experiment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.frontdoor.models.Experiment] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] lro_delay = kwargs.pop( 'polling_interval', @@ -439,28 +613,21 @@ def begin_update( profile_name=profile_name, experiment_name=experiment_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Experiment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -472,64 +639,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - experiment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + experiment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - experiment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + experiment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an Experiment. Deletes an Experiment. @@ -542,15 +699,17 @@ def begin_delete( :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -565,22 +724,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -592,4 +743,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_door_name_availability_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_door_name_availability_operations.py index 658a96064294a..cab322232a75e 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_door_name_availability_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_door_name_availability_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Network/checkFrontDoorNameAvailability') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class FrontDoorNameAvailabilityOperations(object): """FrontDoorNameAvailabilityOperations operations. @@ -44,16 +81,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check( self, - check_front_door_name_availability_input, # type: "_models.CheckNameAvailabilityInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityOutput" + check_front_door_name_availability_input: "_models.CheckNameAvailabilityInput", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityOutput": """Check the availability of a Front Door resource name. :param check_front_door_name_availability_input: Input to check. - :type check_front_door_name_availability_input: ~azure.mgmt.frontdoor.models.CheckNameAvailabilityInput + :type check_front_door_name_availability_input: + ~azure.mgmt.frontdoor.models.CheckNameAvailabilityInput :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput, or the result of cls(response) :rtype: ~azure.mgmt.frontdoor.models.CheckNameAvailabilityOutput @@ -64,32 +102,25 @@ def check( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check.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(check_front_door_name_availability_input, 'CheckNameAvailabilityInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_front_door_name_availability_input, 'CheckNameAvailabilityInput') + + request = build_check_request( + content_type=content_type, + json=_json, + template_url=self.check.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) @@ -98,4 +129,6 @@ def check( return cls(pipeline_response, deserialized, {}) return deserialized + check.metadata = {'url': '/providers/Microsoft.Network/checkFrontDoorNameAvailability'} # type: ignore + diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_door_name_availability_with_subscription_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_door_name_availability_with_subscription_operations.py index 6d8417932a57f..a55ae369d5163 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_door_name_availability_with_subscription_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_door_name_availability_with_subscription_operations.py @@ -5,22 +5,65 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class FrontDoorNameAvailabilityWithSubscriptionOperations(object): """FrontDoorNameAvailabilityWithSubscriptionOperations operations. @@ -44,16 +87,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check( self, - check_front_door_name_availability_input, # type: "_models.CheckNameAvailabilityInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityOutput" + check_front_door_name_availability_input: "_models.CheckNameAvailabilityInput", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityOutput": """Check the availability of a Front Door subdomain. :param check_front_door_name_availability_input: Input to check. - :type check_front_door_name_availability_input: ~azure.mgmt.frontdoor.models.CheckNameAvailabilityInput + :type check_front_door_name_availability_input: + ~azure.mgmt.frontdoor.models.CheckNameAvailabilityInput :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput, or the result of cls(response) :rtype: ~azure.mgmt.frontdoor.models.CheckNameAvailabilityOutput @@ -64,36 +108,26 @@ def check( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(check_front_door_name_availability_input, 'CheckNameAvailabilityInput') + + request = build_check_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(check_front_door_name_availability_input, 'CheckNameAvailabilityInput') - 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) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) @@ -102,4 +136,6 @@ def check( return cls(pipeline_response, deserialized, {}) return deserialized + check.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability'} # type: ignore + diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_doors_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_doors_operations.py index a83d3b3d52d5f..49893e351dbda 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_doors_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_front_doors_operations.py @@ -5,25 +5,250 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/frontDoors') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_custom_domain_request( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/validateCustomDomain') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class FrontDoorsOperations(object): """FrontDoorsOperations operations. @@ -47,11 +272,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FrontDoorListResult"] + **kwargs: Any + ) -> Iterable["_models.FrontDoorListResult"]: """Lists all of the Front Doors within an Azure subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -64,34 +289,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FrontDoorListResult', pipeline_response) + deserialized = self._deserialize("FrontDoorListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,23 +324,24 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/frontDoors'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FrontDoorListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.FrontDoorListResult"]: """Lists all of the Front Doors within a resource group under a subscription. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -135,35 +356,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FrontDoorListResult', pipeline_response) + deserialized = self._deserialize("FrontDoorListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -176,24 +393,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - front_door_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FrontDoor" + resource_group_name: str, + front_door_name: str, + **kwargs: Any + ) -> "_models.FrontDoor": """Gets a Front Door with the specified Front Door name under the specified subscription and resource group. @@ -211,33 +429,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FrontDoor', pipeline_response) @@ -246,54 +454,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - front_door_name, # type: str - front_door_parameters, # type: "_models.FrontDoor" - **kwargs # type: Any - ): - # type: (...) -> "_models.FrontDoor" + resource_group_name: str, + front_door_name: str, + front_door_parameters: "_models.FrontDoor", + **kwargs: Any + ) -> "_models.FrontDoor": cls = kwargs.pop('cls', None) # type: ClsType["_models.FrontDoor"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(front_door_parameters, 'FrontDoor') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(front_door_parameters, 'FrontDoor') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('FrontDoor', pipeline_response) @@ -308,16 +506,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - front_door_name, # type: str - front_door_parameters, # type: "_models.FrontDoor" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FrontDoor"] + resource_group_name: str, + front_door_name: str, + front_door_parameters: "_models.FrontDoor", + **kwargs: Any + ) -> LROPoller["_models.FrontDoor"]: """Creates a new Front Door with a Front Door name under the specified subscription and resource group. @@ -329,15 +529,18 @@ def begin_create_or_update( :type front_door_parameters: ~azure.mgmt.frontdoor.models.FrontDoor :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either FrontDoor or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.frontdoor.models.FrontDoor] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FrontDoor"] lro_delay = kwargs.pop( 'polling_interval', @@ -349,27 +552,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, front_door_name=front_door_name, front_door_parameters=front_door_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FrontDoor', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -381,61 +578,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - front_door_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + front_door_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - front_door_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + front_door_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing Front Door with the specified parameters. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -444,15 +631,17 @@ def begin_delete( :type front_door_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -466,21 +655,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -492,16 +674,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}'} # type: ignore + @distributed_trace def validate_custom_domain( self, - resource_group_name, # type: str - front_door_name, # type: str - custom_domain_properties, # type: "_models.ValidateCustomDomainInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.ValidateCustomDomainOutput" + resource_group_name: str, + front_door_name: str, + custom_domain_properties: "_models.ValidateCustomDomainInput", + **kwargs: Any + ) -> "_models.ValidateCustomDomainOutput": """Validates the custom domain mapping to ensure it maps to the correct Front Door endpoint in DNS. @@ -521,38 +704,28 @@ def validate_custom_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_custom_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_validate_custom_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + content_type=content_type, + json=_json, + template_url=self.validate_custom_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') - 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) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ValidateCustomDomainOutput', pipeline_response) @@ -561,4 +734,6 @@ def validate_custom_domain( return cls(pipeline_response, deserialized, {}) return deserialized + validate_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/validateCustomDomain'} # type: ignore + diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_frontend_endpoints_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_frontend_endpoints_operations.py index 367d61b90c654..190b4a65c03b9 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_frontend_endpoints_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_frontend_endpoints_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_front_door_request( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + frontend_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + "frontendEndpointName": _SERIALIZER.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_enable_https_request_initial( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + frontend_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/enableHttps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + "frontendEndpointName": _SERIALIZER.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_disable_https_request_initial( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + frontend_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/disableHttps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + "frontendEndpointName": _SERIALIZER.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class FrontendEndpointsOperations(object): """FrontendEndpointsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_front_door( self, - resource_group_name, # type: str - front_door_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FrontendEndpointsListResult"] + resource_group_name: str, + front_door_name: str, + **kwargs: Any + ) -> Iterable["_models.FrontendEndpointsListResult"]: """Lists all of the frontend endpoints within a Front Door. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -61,7 +219,8 @@ def list_by_front_door( :param front_door_name: Name of the Front Door which is globally unique. :type front_door_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FrontendEndpointsListResult or the result of cls(response) + :return: An iterator like instance of either FrontendEndpointsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.frontdoor.models.FrontendEndpointsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +229,33 @@ def list_by_front_door( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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_front_door.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_front_door_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=self.list_by_front_door.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_front_door_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FrontendEndpointsListResult', pipeline_response) + deserialized = self._deserialize("FrontendEndpointsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +268,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_front_door.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - front_door_name, # type: str - frontend_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FrontendEndpoint" + resource_group_name: str, + front_door_name: str, + frontend_endpoint_name: str, + **kwargs: Any + ) -> "_models.FrontendEndpoint": """Gets a Frontend endpoint with the specified name within the specified Front Door. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -150,34 +307,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'frontendEndpointName': self._serialize.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + frontend_endpoint_name=frontend_endpoint_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FrontendEndpoint', pipeline_response) @@ -186,71 +333,62 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}'} # type: ignore + def _enable_https_initial( self, - resource_group_name, # type: str - front_door_name, # type: str - frontend_endpoint_name, # type: str - custom_https_configuration, # type: "_models.CustomHttpsConfiguration" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + front_door_name: str, + frontend_endpoint_name: str, + custom_https_configuration: "_models.CustomHttpsConfiguration", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._enable_https_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'frontendEndpointName': self._serialize.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(custom_https_configuration, 'CustomHttpsConfiguration') + + request = build_enable_https_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + frontend_endpoint_name=frontend_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._enable_https_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(custom_https_configuration, 'CustomHttpsConfiguration') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _enable_https_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/enableHttps'} # type: ignore + + @distributed_trace def begin_enable_https( self, - resource_group_name, # type: str - front_door_name, # type: str - frontend_endpoint_name, # type: str - custom_https_configuration, # type: "_models.CustomHttpsConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + front_door_name: str, + frontend_endpoint_name: str, + custom_https_configuration: "_models.CustomHttpsConfiguration", + **kwargs: Any + ) -> LROPoller[None]: """Enables a frontendEndpoint for HTTPS traffic. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -264,15 +402,18 @@ def begin_enable_https( :type custom_https_configuration: ~azure.mgmt.frontdoor.models.CustomHttpsConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -285,25 +426,18 @@ def begin_enable_https( front_door_name=front_door_name, frontend_endpoint_name=frontend_endpoint_name, custom_https_configuration=custom_https_configuration, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'frontendEndpointName': self._serialize.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -315,64 +449,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_enable_https.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/enableHttps'} # type: ignore def _disable_https_initial( self, - resource_group_name, # type: str - front_door_name, # type: str - frontend_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + front_door_name: str, + frontend_endpoint_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self._disable_https_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'frontendEndpointName': self._serialize.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_https_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + frontend_endpoint_name=frontend_endpoint_name, + template_url=self._disable_https_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _disable_https_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/disableHttps'} # type: ignore + + @distributed_trace def begin_disable_https( self, - resource_group_name, # type: str - front_door_name, # type: str - frontend_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + front_door_name: str, + frontend_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Disables a frontendEndpoint for HTTPS traffic. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -384,15 +508,17 @@ def begin_disable_https( :type frontend_endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -407,22 +533,14 @@ def begin_disable_https( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'frontendEndpointName': self._serialize.url("frontend_endpoint_name", frontend_endpoint_name, 'str', max_length=255, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -434,4 +552,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_disable_https.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/disableHttps'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_managed_rule_sets_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_managed_rule_sets_operations.py index fe870cfb39256..517bcf02dc925 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_managed_rule_sets_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_managed_rule_sets_operations.py @@ -5,23 +5,56 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallManagedRuleSets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ManagedRuleSetsOperations(object): """ManagedRuleSetsOperations operations. @@ -45,15 +78,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ManagedRuleSetDefinitionList"] + **kwargs: Any + ) -> Iterable["_models.ManagedRuleSetDefinitionList"]: """Lists all available managed rule sets. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedRuleSetDefinitionList or the result of cls(response) + :return: An iterator like instance of either ManagedRuleSetDefinitionList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.frontdoor.models.ManagedRuleSetDefinitionList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -62,34 +96,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-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.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedRuleSetDefinitionList', pipeline_response) + deserialized = self._deserialize("ManagedRuleSetDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,12 +131,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_network_experiment_profiles_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_network_experiment_profiles_operations.py index 2fc4c792de3be..b207ef91c72b3 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_network_experiment_profiles_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_network_experiment_profiles_operations.py @@ -5,25 +5,250 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Network/NetworkExperimentProfiles') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + profile_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}') + path_format_arguments = { + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + profile_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + profile_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NetworkExperimentProfilesOperations(object): """NetworkExperimentProfilesOperations operations. @@ -47,11 +272,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProfileList"] + **kwargs: Any + ) -> Iterable["_models.ProfileList"]: """Gets a list of Network Experiment Profiles under a subscription. Gets a list of Network Experiment Profiles under a subscription. @@ -66,34 +291,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProfileList', pipeline_response) + deserialized = self._deserialize("ProfileList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,23 +326,24 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Network/NetworkExperimentProfiles'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProfileList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ProfileList"]: """Gets a list of Network Experiment Profiles within a resource group under a subscription. Gets a list of Network Experiment Profiles within a resource group under a subscription. @@ -139,35 +360,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProfileList', pipeline_response) + deserialized = self._deserialize("ProfileList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,24 +397,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Profile" + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> "_models.Profile": """Gets an NetworkExperiment Profile by ProfileName. Gets an NetworkExperiment Profile by ProfileName. @@ -216,33 +434,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Profile', pipeline_response) @@ -251,54 +459,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore + def _create_or_update_initial( self, - profile_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.Profile" - **kwargs # type: Any - ): - # type: (...) -> "_models.Profile" + profile_name: str, + resource_group_name: str, + parameters: "_models.Profile", + **kwargs: Any + ) -> "_models.Profile": 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 = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Profile') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + profile_name=profile_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Profile', pipeline_response) @@ -313,16 +511,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - profile_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.Profile" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Profile"] + profile_name: str, + resource_group_name: str, + parameters: "_models.Profile", + **kwargs: Any + ) -> LROPoller["_models.Profile"]: """Creates an NetworkExperiment Profile. Creates an NetworkExperiment Profile. @@ -335,15 +535,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.frontdoor.models.Profile :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Profile or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.frontdoor.models.Profile] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] lro_delay = kwargs.pop( 'polling_interval', @@ -355,27 +558,21 @@ def begin_create_or_update( profile_name=profile_name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Profile', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -387,54 +584,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - parameters, # type: "_models.ProfileUpdateModel" - **kwargs # type: Any - ): - # type: (...) -> "_models.Profile" + resource_group_name: str, + profile_name: str, + parameters: "_models.ProfileUpdateModel", + **kwargs: Any + ) -> "_models.Profile": 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 = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProfileUpdateModel') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ProfileUpdateModel') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Profile', pipeline_response) @@ -446,16 +632,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - parameters, # type: "_models.ProfileUpdateModel" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Profile"] + resource_group_name: str, + profile_name: str, + parameters: "_models.ProfileUpdateModel", + **kwargs: Any + ) -> LROPoller["_models.Profile"]: """Updates an NetworkExperimentProfiles by NetworkExperimentProfile name. Updates an NetworkExperimentProfiles. @@ -468,15 +656,18 @@ def begin_update( :type parameters: ~azure.mgmt.frontdoor.models.ProfileUpdateModel :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Profile or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.frontdoor.models.Profile] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] lro_delay = kwargs.pop( 'polling_interval', @@ -488,27 +679,21 @@ def begin_update( resource_group_name=resource_group_name, profile_name=profile_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Profile', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -520,61 +705,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an NetworkExperiment Profile by ProfileName. Deletes an NetworkExperiment Profile by ProfileName. @@ -585,15 +760,17 @@ def begin_delete( :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -607,21 +784,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -633,4 +803,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_policies_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_policies_operations.py index 1491aa3dd09d4..c4c1e3371c2b4 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_policies_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_policies_operations.py @@ -5,25 +5,169 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + policy_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "policyName": _SERIALIZER.url("policy_name", policy_name, 'str', max_length=128, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + policy_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "policyName": _SERIALIZER.url("policy_name", policy_name, 'str', max_length=128, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + policy_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-11-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "policyName": _SERIALIZER.url("policy_name", policy_name, 'str', max_length=128, min_length=0), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class PoliciesOperations(object): """PoliciesOperations operations. @@ -47,19 +191,21 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WebApplicationFirewallPolicyList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.WebApplicationFirewallPolicyList"]: """Lists all of the protection policies within a resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. :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 WebApplicationFirewallPolicyList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicyList] + :return: An iterator like instance of either WebApplicationFirewallPolicyList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicyList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WebApplicationFirewallPolicyList"] @@ -67,35 +213,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-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.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WebApplicationFirewallPolicyList', pipeline_response) + deserialized = self._deserialize("WebApplicationFirewallPolicyList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,24 +250,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WebApplicationFirewallPolicy" + resource_group_name: str, + policy_name: str, + **kwargs: Any + ) -> "_models.WebApplicationFirewallPolicy": """Retrieve protection policy with specified name within a resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -142,33 +285,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128, min_length=0), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + policy_name=policy_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WebApplicationFirewallPolicy', pipeline_response) @@ -177,54 +310,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - policy_name, # type: str - parameters, # type: "_models.WebApplicationFirewallPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.WebApplicationFirewallPolicy" + resource_group_name: str, + policy_name: str, + parameters: "_models.WebApplicationFirewallPolicy", + **kwargs: Any + ) -> "_models.WebApplicationFirewallPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.WebApplicationFirewallPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128, min_length=0), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'WebApplicationFirewallPolicy') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + policy_name=policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'WebApplicationFirewallPolicy') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('WebApplicationFirewallPolicy', pipeline_response) @@ -239,16 +362,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - policy_name, # type: str - parameters, # type: "_models.WebApplicationFirewallPolicy" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WebApplicationFirewallPolicy"] + resource_group_name: str, + policy_name: str, + parameters: "_models.WebApplicationFirewallPolicy", + **kwargs: Any + ) -> LROPoller["_models.WebApplicationFirewallPolicy"]: """Create or update policy with specified rule set name within a resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -259,15 +384,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicy :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WebApplicationFirewallPolicy or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WebApplicationFirewallPolicy or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.frontdoor.models.WebApplicationFirewallPolicy] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WebApplicationFirewallPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,27 +409,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, policy_name=policy_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('WebApplicationFirewallPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128, min_length=0), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -311,39 +435,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + policy_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128, min_length=0), - '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] + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + policy_name=policy_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -356,13 +472,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + policy_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes Policy. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -371,15 +488,17 @@ def begin_delete( :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,21 +512,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'policyName': self._serialize.url("policy_name", policy_name, 'str', max_length=128, min_length=0), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -419,4 +531,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}'} # type: ignore diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_preconfigured_endpoints_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_preconfigured_endpoints_operations.py index 041c2326a186f..c96f8a5ebef96 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_preconfigured_endpoints_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_preconfigured_endpoints_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/PreconfiguredEndpoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PreconfiguredEndpointsOperations(object): """PreconfiguredEndpointsOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PreconfiguredEndpointList"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.PreconfiguredEndpointList"]: """Gets a list of Preconfigured Endpoints. Gets a list of Preconfigured Endpoints. @@ -61,7 +98,8 @@ def list( :param profile_name: The Profile identifier associated with the Tenant and Partner. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PreconfiguredEndpointList or the result of cls(response) + :return: An iterator like instance of either PreconfiguredEndpointList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.frontdoor.models.PreconfiguredEndpointList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +108,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-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.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PreconfiguredEndpointList', pipeline_response) + deserialized = self._deserialize("PreconfiguredEndpointList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,12 +147,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_reports_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_reports_operations.py index ac9090bb1377e..7450bb551ea41 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_reports_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_reports_operations.py @@ -6,22 +6,122 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_get_latency_scorecards_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + experiment_name: str, + *, + aggregation_interval: Union[str, "_models.LatencyScorecardAggregationInterval"], + end_date_time_utc: Optional[str] = None, + country: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/LatencyScorecard') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if end_date_time_utc is not None: + query_parameters['endDateTimeUTC'] = _SERIALIZER.query("end_date_time_utc", end_date_time_utc, 'str') + if country is not None: + query_parameters['country'] = _SERIALIZER.query("country", country, 'str') + query_parameters['aggregationInterval'] = _SERIALIZER.query("aggregation_interval", aggregation_interval, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_timeseries_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + experiment_name: str, + *, + start_date_time_utc: datetime.datetime, + end_date_time_utc: datetime.datetime, + aggregation_interval: Union[str, "_models.TimeseriesAggregationInterval"], + timeseries_type: Union[str, "_models.TimeseriesType"], + endpoint: Optional[str] = None, + country: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/Timeseries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['startDateTimeUTC'] = _SERIALIZER.query("start_date_time_utc", start_date_time_utc, 'iso-8601') + query_parameters['endDateTimeUTC'] = _SERIALIZER.query("end_date_time_utc", end_date_time_utc, 'iso-8601') + query_parameters['aggregationInterval'] = _SERIALIZER.query("aggregation_interval", aggregation_interval, 'str') + query_parameters['timeseriesType'] = _SERIALIZER.query("timeseries_type", timeseries_type, 'str') + if endpoint is not None: + query_parameters['endpoint'] = _SERIALIZER.query("endpoint", endpoint, 'str') + if country is not None: + query_parameters['country'] = _SERIALIZER.query("country", country, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ReportsOperations(object): """ReportsOperations operations. @@ -45,17 +145,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_latency_scorecards( self, - resource_group_name, # type: str - profile_name, # type: str - experiment_name, # type: str - aggregation_interval, # type: Union[str, "_models.LatencyScorecardAggregationInterval"] - end_date_time_utc=None, # type: Optional[str] - country=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.LatencyScorecard" + resource_group_name: str, + profile_name: str, + experiment_name: str, + aggregation_interval: Union[str, "_models.LatencyScorecardAggregationInterval"], + end_date_time_utc: Optional[str] = None, + country: Optional[str] = None, + **kwargs: Any + ) -> "_models.LatencyScorecard": """Gets a Latency Scorecard for a given Experiment. Gets a Latency Scorecard for a given Experiment. @@ -67,7 +167,8 @@ def get_latency_scorecards( :param experiment_name: The Experiment identifier associated with the Experiment. :type experiment_name: str :param aggregation_interval: The aggregation interval of the Latency Scorecard. - :type aggregation_interval: str or ~azure.mgmt.frontdoor.models.LatencyScorecardAggregationInterval + :type aggregation_interval: str or + ~azure.mgmt.frontdoor.models.LatencyScorecardAggregationInterval :param end_date_time_utc: The end DateTime of the Latency Scorecard in UTC. :type end_date_time_utc: str :param country: The country associated with the Latency Scorecard. Values are country ISO codes @@ -83,39 +184,27 @@ def get_latency_scorecards( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get_latency_scorecards.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if end_date_time_utc is not None: - query_parameters['endDateTimeUTC'] = self._serialize.query("end_date_time_utc", end_date_time_utc, 'str') - if country is not None: - query_parameters['country'] = self._serialize.query("country", country, 'str') - query_parameters['aggregationInterval'] = self._serialize.query("aggregation_interval", aggregation_interval, '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) + + + request = build_get_latency_scorecards_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + aggregation_interval=aggregation_interval, + end_date_time_utc=end_date_time_utc, + country=country, + template_url=self.get_latency_scorecards.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LatencyScorecard', pipeline_response) @@ -124,22 +213,24 @@ def get_latency_scorecards( return cls(pipeline_response, deserialized, {}) return deserialized + get_latency_scorecards.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/LatencyScorecard'} # type: ignore + + @distributed_trace def get_timeseries( self, - resource_group_name, # type: str - profile_name, # type: str - experiment_name, # type: str - start_date_time_utc, # type: datetime.datetime - end_date_time_utc, # type: datetime.datetime - aggregation_interval, # type: Union[str, "_models.TimeseriesAggregationInterval"] - timeseries_type, # type: Union[str, "_models.TimeseriesType"] - endpoint=None, # type: Optional[str] - country=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Timeseries" + resource_group_name: str, + profile_name: str, + experiment_name: str, + start_date_time_utc: datetime.datetime, + end_date_time_utc: datetime.datetime, + aggregation_interval: Union[str, "_models.TimeseriesAggregationInterval"], + timeseries_type: Union[str, "_models.TimeseriesType"], + endpoint: Optional[str] = None, + country: Optional[str] = None, + **kwargs: Any + ) -> "_models.Timeseries": """Gets a Timeseries for a given Experiment. Gets a Timeseries for a given Experiment. @@ -173,42 +264,30 @@ def get_timeseries( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get_timeseries.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['startDateTimeUTC'] = self._serialize.query("start_date_time_utc", start_date_time_utc, 'iso-8601') - query_parameters['endDateTimeUTC'] = self._serialize.query("end_date_time_utc", end_date_time_utc, 'iso-8601') - query_parameters['aggregationInterval'] = self._serialize.query("aggregation_interval", aggregation_interval, 'str') - query_parameters['timeseriesType'] = self._serialize.query("timeseries_type", timeseries_type, 'str') - if endpoint is not None: - query_parameters['endpoint'] = self._serialize.query("endpoint", endpoint, 'str') - if country is not None: - query_parameters['country'] = self._serialize.query("country", country, '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) + + + request = build_get_timeseries_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + experiment_name=experiment_name, + start_date_time_utc=start_date_time_utc, + end_date_time_utc=end_date_time_utc, + aggregation_interval=aggregation_interval, + timeseries_type=timeseries_type, + endpoint=endpoint, + country=country, + template_url=self.get_timeseries.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Timeseries', pipeline_response) @@ -217,4 +296,6 @@ def get_timeseries( return cls(pipeline_response, deserialized, {}) return deserialized + get_timeseries.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/Timeseries'} # type: ignore + diff --git a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_rules_engines_operations.py b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_rules_engines_operations.py index a2371619b1399..03fb0f12cf3a2 100644 --- a/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_rules_engines_operations.py +++ b/sdk/network/azure-mgmt-frontdoor/azure/mgmt/frontdoor/operations/_rules_engines_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_front_door_request( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + rules_engine_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + "rulesEngineName": _SERIALIZER.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + rules_engine_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + "rulesEngineName": _SERIALIZER.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + front_door_name: str, + rules_engine_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-05-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), + "frontDoorName": _SERIALIZER.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), + "rulesEngineName": _SERIALIZER.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RulesEnginesOperations(object): """RulesEnginesOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_front_door( self, - resource_group_name, # type: str - front_door_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RulesEngineListResult"] + resource_group_name: str, + front_door_name: str, + **kwargs: Any + ) -> Iterable["_models.RulesEngineListResult"]: """Lists all of the Rules Engine Configurations within a Front Door. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -61,7 +219,8 @@ def list_by_front_door( :param front_door_name: Name of the Front Door which is globally unique. :type front_door_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RulesEngineListResult or the result of cls(response) + :return: An iterator like instance of either RulesEngineListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.frontdoor.models.RulesEngineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +229,33 @@ def list_by_front_door( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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_front_door.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_front_door_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=self.list_by_front_door.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_front_door_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RulesEngineListResult', pipeline_response) + deserialized = self._deserialize("RulesEngineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +268,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_front_door.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - front_door_name, # type: str - rules_engine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RulesEngine" + resource_group_name: str, + front_door_name: str, + rules_engine_name: str, + **kwargs: Any + ) -> "_models.RulesEngine": """Gets a Rules Engine Configuration with the specified name within the specified Front Door. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -149,34 +306,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-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', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'rulesEngineName': self._serialize.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + rules_engine_name=rules_engine_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RulesEngine', pipeline_response) @@ -185,56 +332,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - front_door_name, # type: str - rules_engine_name, # type: str - rules_engine_parameters, # type: "_models.RulesEngine" - **kwargs # type: Any - ): - # type: (...) -> "_models.RulesEngine" + resource_group_name: str, + front_door_name: str, + rules_engine_name: str, + rules_engine_parameters: "_models.RulesEngine", + **kwargs: Any + ) -> "_models.RulesEngine": cls = kwargs.pop('cls', None) # type: ClsType["_models.RulesEngine"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'rulesEngineName': self._serialize.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(rules_engine_parameters, 'RulesEngine') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + rules_engine_name=rules_engine_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(rules_engine_parameters, 'RulesEngine') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('RulesEngine', pipeline_response) @@ -249,17 +386,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - front_door_name, # type: str - rules_engine_name, # type: str - rules_engine_parameters, # type: "_models.RulesEngine" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RulesEngine"] + resource_group_name: str, + front_door_name: str, + rules_engine_name: str, + rules_engine_parameters: "_models.RulesEngine", + **kwargs: Any + ) -> LROPoller["_models.RulesEngine"]: """Creates a new Rules Engine Configuration with the specified name within the specified Front Door. @@ -274,15 +413,19 @@ def begin_create_or_update( :type rules_engine_parameters: ~azure.mgmt.frontdoor.models.RulesEngine :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RulesEngine or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RulesEngine or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.frontdoor.models.RulesEngine] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RulesEngine"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,28 +438,21 @@ def begin_create_or_update( front_door_name=front_door_name, rules_engine_name=rules_engine_name, rules_engine_parameters=rules_engine_parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RulesEngine', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'rulesEngineName': self._serialize.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -328,64 +464,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - front_door_name, # type: str - rules_engine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + front_door_name: str, + rules_engine_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-05-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'rulesEngineName': self._serialize.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + front_door_name=front_door_name, + rules_engine_name=rules_engine_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - front_door_name, # type: str - rules_engine_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + front_door_name: str, + rules_engine_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing Rules Engine Configuration with the specified parameters. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -396,15 +522,17 @@ def begin_delete( :type rules_engine_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -419,22 +547,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=80, min_length=1, pattern=r'^[a-zA-Z0-9_\-\(\)\.]*[^\.]$'), - 'frontDoorName': self._serialize.url("front_door_name", front_door_name, 'str', max_length=64, min_length=5, pattern=r'^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$'), - 'rulesEngineName': self._serialize.url("rules_engine_name", rules_engine_name, 'str', max_length=90, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -446,4 +566,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}'} # type: ignore