diff --git a/sdk/cdn/azure-mgmt-cdn/_meta.json b/sdk/cdn/azure-mgmt-cdn/_meta.json new file mode 100644 index 000000000000..6134549c0690 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "46ad97970c9c2050396de6d1d0f586166b8d0417", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/cdn/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/cdn/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/__init__.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/__init__.py index ec6b2a4b1417..841aa3a2f926 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/__init__.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['CdnManagementClient'] -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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_cdn_management_client.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_cdn_management_client.py index f61aa97cc6d1..edc0139f5e71 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_cdn_management_client.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_cdn_management_client.py @@ -6,63 +6,24 @@ # 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 CdnManagementClientConfiguration +from .operations import AFDCustomDomainsOperations, AFDEndpointsOperations, AFDOriginGroupsOperations, AFDOriginsOperations, AFDProfilesOperations, CdnManagementClientOperationsMixin, CustomDomainsOperations, EdgeNodesOperations, EndpointsOperations, LogAnalyticsOperations, ManagedRuleSetsOperations, Operations, OriginGroupsOperations, OriginsOperations, PoliciesOperations, ProfilesOperations, ResourceUsageOperations, RoutesOperations, RuleSetsOperations, RulesOperations, SecretsOperations, SecurityPoliciesOperations, ValidateOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential -from ._configuration import CdnManagementClientConfiguration -from .operations import ProfilesOperations -from .operations import EndpointsOperations -from .operations import OriginsOperations -from .operations import OriginGroupsOperations -from .operations import CustomDomainsOperations -from .operations import CdnManagementClientOperationsMixin -from .operations import ResourceUsageOperations -from .operations import Operations -from .operations import EdgeNodesOperations -from .operations import AFDProfilesOperations -from .operations import AFDCustomDomainsOperations -from .operations import AFDEndpointsOperations -from .operations import AFDOriginGroupsOperations -from .operations import AFDOriginsOperations -from .operations import RoutesOperations -from .operations import RuleSetsOperations -from .operations import RulesOperations -from .operations import SecurityPoliciesOperations -from .operations import SecretsOperations -from .operations import ValidateOperations -from .operations import LogAnalyticsOperations -from .operations import PoliciesOperations -from .operations import ManagedRuleSetsOperations -from . import models - - class CdnManagementClient(CdnManagementClientOperationsMixin): """Cdn Management Client. - :ivar profiles: ProfilesOperations operations - :vartype profiles: azure.mgmt.cdn.operations.ProfilesOperations - :ivar endpoints: EndpointsOperations operations - :vartype endpoints: azure.mgmt.cdn.operations.EndpointsOperations - :ivar origins: OriginsOperations operations - :vartype origins: azure.mgmt.cdn.operations.OriginsOperations - :ivar origin_groups: OriginGroupsOperations operations - :vartype origin_groups: azure.mgmt.cdn.operations.OriginGroupsOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.cdn.operations.CustomDomainsOperations - :ivar resource_usage: ResourceUsageOperations operations - :vartype resource_usage: azure.mgmt.cdn.operations.ResourceUsageOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.cdn.operations.Operations - :ivar edge_nodes: EdgeNodesOperations operations - :vartype edge_nodes: azure.mgmt.cdn.operations.EdgeNodesOperations :ivar afd_profiles: AFDProfilesOperations operations :vartype afd_profiles: azure.mgmt.cdn.operations.AFDProfilesOperations :ivar afd_custom_domains: AFDCustomDomainsOperations operations @@ -87,6 +48,22 @@ class CdnManagementClient(CdnManagementClientOperationsMixin): :vartype validate: azure.mgmt.cdn.operations.ValidateOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.cdn.operations.LogAnalyticsOperations + :ivar profiles: ProfilesOperations operations + :vartype profiles: azure.mgmt.cdn.operations.ProfilesOperations + :ivar endpoints: EndpointsOperations operations + :vartype endpoints: azure.mgmt.cdn.operations.EndpointsOperations + :ivar origins: OriginsOperations operations + :vartype origins: azure.mgmt.cdn.operations.OriginsOperations + :ivar origin_groups: OriginGroupsOperations operations + :vartype origin_groups: azure.mgmt.cdn.operations.OriginGroupsOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: azure.mgmt.cdn.operations.CustomDomainsOperations + :ivar resource_usage: ResourceUsageOperations operations + :vartype resource_usage: azure.mgmt.cdn.operations.ResourceUsageOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.cdn.operations.Operations + :ivar edge_nodes: EdgeNodesOperations operations + :vartype edge_nodes: azure.mgmt.cdn.operations.EdgeNodesOperations :ivar policies: PoliciesOperations operations :vartype policies: azure.mgmt.cdn.operations.PoliciesOperations :ivar managed_rule_sets: ManagedRuleSetsOperations operations @@ -95,72 +72,75 @@ class CdnManagementClient(CdnManagementClientOperationsMixin): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Azure Subscription ID. :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 = CdnManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = CdnManagementClientConfiguration(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.afd_profiles = AFDProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.afd_custom_domains = AFDCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.afd_endpoints = AFDEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.afd_origin_groups = AFDOriginGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.afd_origins = AFDOriginsOperations(self._client, self._config, self._serialize, self._deserialize) + self.routes = RoutesOperations(self._client, self._config, self._serialize, self._deserialize) + self.rule_sets = RuleSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.security_policies = SecurityPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.validate = ValidateOperations(self._client, self._config, self._serialize, self._deserialize) + self.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) + self.profiles = ProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.origins = OriginsOperations(self._client, self._config, self._serialize, self._deserialize) + self.origin_groups = OriginGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.resource_usage = ResourceUsageOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.edge_nodes = EdgeNodesOperations(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.profiles = ProfilesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.endpoints = EndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.origins = OriginsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.origin_groups = OriginGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.resource_usage = ResourceUsageOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.edge_nodes = EdgeNodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.afd_profiles = AFDProfilesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.afd_custom_domains = AFDCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.afd_endpoints = AFDEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.afd_origin_groups = AFDOriginGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.afd_origins = AFDOriginsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.routes = RoutesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rule_sets = RuleSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.security_policies = SecurityPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.validate = ValidateOperations( - self._client, self._config, self._serialize, self._deserialize) - self.log_analytics = LogAnalyticsOperations( - 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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_configuration.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_configuration.py index 5edde19c7eca..b4fbf8293010 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_configuration.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_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,20 +33,19 @@ class CdnManagementClientConfiguration(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(CdnManagementClientConfiguration, 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(CdnManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-09-01" + self.api_version = "2021-06-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-cdn/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_metadata.json b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_metadata.json index 383e91c8a295..495c497787ea 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_metadata.json +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_metadata.json @@ -1,15 +1,17 @@ { - "chosen_version": "2020-09-01", - "total_api_version_list": ["2020-09-01"], + "chosen_version": "2021-06-01", + "total_api_version_list": ["2021-06-01"], "client": { "name": "CdnManagementClient", "filename": "_cdn_management_client", "description": "Cdn Management 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\": [\"CdnManagementClientConfiguration\"], \"._operations_mixin\": [\"CdnManagementClientOperationsMixin\"]}}, \"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\": [\"CdnManagementClientConfiguration\"], \"._operations_mixin\": [\"CdnManagementClientOperationsMixin\"]}}, \"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": "Azure Subscription ID.", "docstring_type": "str", "required": true @@ -42,24 +44,59 @@ }, "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": { - "profiles": "ProfilesOperations", - "endpoints": "EndpointsOperations", - "origins": "OriginsOperations", - "origin_groups": "OriginGroupsOperations", - "custom_domains": "CustomDomainsOperations", - "resource_usage": "ResourceUsageOperations", - "operations": "Operations", - "edge_nodes": "EdgeNodesOperations", "afd_profiles": "AFDProfilesOperations", "afd_custom_domains": "AFDCustomDomainsOperations", "afd_endpoints": "AFDEndpointsOperations", @@ -72,47 +109,69 @@ "secrets": "SecretsOperations", "validate": "ValidateOperations", "log_analytics": "LogAnalyticsOperations", + "profiles": "ProfilesOperations", + "endpoints": "EndpointsOperations", + "origins": "OriginsOperations", + "origin_groups": "OriginGroupsOperations", + "custom_domains": "CustomDomainsOperations", + "resource_usage": "ResourceUsageOperations", + "operations": "Operations", + "edge_nodes": "EdgeNodesOperations", "policies": "PoliciesOperations", "managed_rule_sets": "ManagedRuleSetsOperations" }, "operation_mixins": { - "check_name_availability" : { - "sync": { - "signature": "def check_name_availability(\n self,\n check_name_availability_input, # type: \"_models.CheckNameAvailabilityInput\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Check the availability of a resource name. This is needed for resources where name is globally\nunique, such as a CDN endpoint.\n\n:param check_name_availability_input: Input to check.\n:type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckNameAvailabilityOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "operations": { + "check_endpoint_name_availability" : { + "sync": { + "signature": "def check_endpoint_name_availability(\n self,\n resource_group_name, # type: str\n check_endpoint_name_availability_input, # type: \"_models.CheckEndpointNameAvailabilityInput\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.CheckEndpointNameAvailabilityOutput\"\n", + "doc": "\"\"\"Check the availability of a resource name. This is needed for resources where name is globally\nunique, such as a afdx endpoint.\n\n:param resource_group_name: Name of the Resource group within the Azure subscription.\n:type resource_group_name: str\n:param check_endpoint_name_availability_input: Input to check.\n:type check_endpoint_name_availability_input:\n ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckEndpointNameAvailabilityOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def check_endpoint_name_availability(\n self,\n resource_group_name: str,\n check_endpoint_name_availability_input: \"_models.CheckEndpointNameAvailabilityInput\",\n **kwargs: Any\n) -\u003e \"_models.CheckEndpointNameAvailabilityOutput\":\n", + "doc": "\"\"\"Check the availability of a resource name. This is needed for resources where name is globally\nunique, such as a afdx endpoint.\n\n:param resource_group_name: Name of the Resource group within the Azure subscription.\n:type resource_group_name: str\n:param check_endpoint_name_availability_input: Input to check.\n:type check_endpoint_name_availability_input:\n ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckEndpointNameAvailabilityOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, check_endpoint_name_availability_input" }, - "async": { - "coroutine": true, - "signature": "async def check_name_availability(\n self,\n check_name_availability_input: \"_models.CheckNameAvailabilityInput\",\n **kwargs\n) -\u003e \"_models.CheckNameAvailabilityOutput\":\n", - "doc": "\"\"\"Check the availability of a resource name. This is needed for resources where name is globally\nunique, such as a CDN endpoint.\n\n:param check_name_availability_input: Input to check.\n:type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckNameAvailabilityOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "check_name_availability" : { + "sync": { + "signature": "def check_name_availability(\n self,\n check_name_availability_input, # type: \"_models.CheckNameAvailabilityInput\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.CheckNameAvailabilityOutput\"\n", + "doc": "\"\"\"Check the availability of a resource name. This is needed for resources where name is globally\nunique, such as a CDN endpoint.\n\n:param check_name_availability_input: Input to check.\n:type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckNameAvailabilityOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def check_name_availability(\n self,\n check_name_availability_input: \"_models.CheckNameAvailabilityInput\",\n **kwargs: Any\n) -\u003e \"_models.CheckNameAvailabilityOutput\":\n", + "doc": "\"\"\"Check the availability of a resource name. This is needed for resources where name is globally\nunique, such as a CDN endpoint.\n\n:param check_name_availability_input: Input to check.\n:type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckNameAvailabilityOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "check_name_availability_input" }, - "call": "check_name_availability_input" - }, - "check_name_availability_with_subscription" : { - "sync": { - "signature": "def check_name_availability_with_subscription(\n self,\n check_name_availability_input, # type: \"_models.CheckNameAvailabilityInput\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Check the availability of a resource name. This is needed for resources where name is globally\nunique, such as a CDN endpoint.\n\n:param check_name_availability_input: Input to check.\n:type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckNameAvailabilityOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + "check_name_availability_with_subscription" : { + "sync": { + "signature": "def check_name_availability_with_subscription(\n self,\n check_name_availability_input, # type: \"_models.CheckNameAvailabilityInput\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.CheckNameAvailabilityOutput\"\n", + "doc": "\"\"\"Check the availability of a resource name. This is needed for resources where name is globally\nunique, such as a CDN endpoint.\n\n:param check_name_availability_input: Input to check.\n:type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckNameAvailabilityOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def check_name_availability_with_subscription(\n self,\n check_name_availability_input: \"_models.CheckNameAvailabilityInput\",\n **kwargs: Any\n) -\u003e \"_models.CheckNameAvailabilityOutput\":\n", + "doc": "\"\"\"Check the availability of a resource name. This is needed for resources where name is globally\nunique, such as a CDN endpoint.\n\n:param check_name_availability_input: Input to check.\n:type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckNameAvailabilityOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "check_name_availability_input" }, - "async": { - "coroutine": true, - "signature": "async def check_name_availability_with_subscription(\n self,\n check_name_availability_input: \"_models.CheckNameAvailabilityInput\",\n **kwargs\n) -\u003e \"_models.CheckNameAvailabilityOutput\":\n", - "doc": "\"\"\"Check the availability of a resource name. This is needed for resources where name is globally\nunique, such as a CDN endpoint.\n\n:param check_name_availability_input: Input to check.\n:type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckNameAvailabilityOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "check_name_availability_input" - }, - "validate_probe" : { - "sync": { - "signature": "def validate_probe(\n self,\n validate_probe_input, # type: \"_models.ValidateProbeInput\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Check if the probe path is a valid path and the file can be accessed. Probe path is the path to\na file hosted on the origin server to help accelerate the delivery of dynamic content via the\nCDN endpoint. This path is relative to the origin path specified in the endpoint configuration.\n\n:param validate_probe_input: Input to check.\n:type validate_probe_input: ~azure.mgmt.cdn.models.ValidateProbeInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ValidateProbeOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.ValidateProbeOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "async": { - "coroutine": true, - "signature": "async def validate_probe(\n self,\n validate_probe_input: \"_models.ValidateProbeInput\",\n **kwargs\n) -\u003e \"_models.ValidateProbeOutput\":\n", - "doc": "\"\"\"Check if the probe path is a valid path and the file can be accessed. Probe path is the path to\na file hosted on the origin server to help accelerate the delivery of dynamic content via the\nCDN endpoint. This path is relative to the origin path specified in the endpoint configuration.\n\n:param validate_probe_input: Input to check.\n:type validate_probe_input: ~azure.mgmt.cdn.models.ValidateProbeInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ValidateProbeOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.ValidateProbeOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "validate_probe_input" + "validate_probe" : { + "sync": { + "signature": "def validate_probe(\n self,\n validate_probe_input, # type: \"_models.ValidateProbeInput\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.ValidateProbeOutput\"\n", + "doc": "\"\"\"Check if the probe path is a valid path and the file can be accessed. Probe path is the path to\na file hosted on the origin server to help accelerate the delivery of dynamic content via the\nCDN endpoint. This path is relative to the origin path specified in the endpoint configuration.\n\n:param validate_probe_input: Input to check.\n:type validate_probe_input: ~azure.mgmt.cdn.models.ValidateProbeInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ValidateProbeOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.ValidateProbeOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def validate_probe(\n self,\n validate_probe_input: \"_models.ValidateProbeInput\",\n **kwargs: Any\n) -\u003e \"_models.ValidateProbeOutput\":\n", + "doc": "\"\"\"Check if the probe path is a valid path and the file can be accessed. Probe path is the path to\na file hosted on the origin server to help accelerate the delivery of dynamic content via the\nCDN endpoint. This path is relative to the origin path specified in the endpoint configuration.\n\n:param validate_probe_input: Input to check.\n:type validate_probe_input: ~azure.mgmt.cdn.models.ValidateProbeInput\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ValidateProbeOutput, or the result of cls(response)\n:rtype: ~azure.mgmt.cdn.models.ValidateProbeOutput\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "validate_probe_input" + } } - }, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" + } } \ No newline at end of file diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_patch.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_vendor.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_version.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_version.py index ae876c37f272..48944bf3938a 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_version.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "11.0.0" +VERSION = "2.0.0" diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/__init__.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/__init__.py index 490addf95e3d..682168cbad37 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/__init__.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/__init__.py @@ -8,3 +8,8 @@ from ._cdn_management_client import CdnManagementClient __all__ = ['CdnManagementClient'] + +# `._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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_cdn_management_client.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_cdn_management_client.py index f5e372c51d5f..91402cea5f4c 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_cdn_management_client.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_cdn_management_client.py @@ -6,61 +6,24 @@ # 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 CdnManagementClientConfiguration +from .operations import AFDCustomDomainsOperations, AFDEndpointsOperations, AFDOriginGroupsOperations, AFDOriginsOperations, AFDProfilesOperations, CdnManagementClientOperationsMixin, CustomDomainsOperations, EdgeNodesOperations, EndpointsOperations, LogAnalyticsOperations, ManagedRuleSetsOperations, Operations, OriginGroupsOperations, OriginsOperations, PoliciesOperations, ProfilesOperations, ResourceUsageOperations, RoutesOperations, RuleSetsOperations, RulesOperations, SecretsOperations, SecurityPoliciesOperations, ValidateOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import CdnManagementClientConfiguration -from .operations import ProfilesOperations -from .operations import EndpointsOperations -from .operations import OriginsOperations -from .operations import OriginGroupsOperations -from .operations import CustomDomainsOperations -from .operations import CdnManagementClientOperationsMixin -from .operations import ResourceUsageOperations -from .operations import Operations -from .operations import EdgeNodesOperations -from .operations import AFDProfilesOperations -from .operations import AFDCustomDomainsOperations -from .operations import AFDEndpointsOperations -from .operations import AFDOriginGroupsOperations -from .operations import AFDOriginsOperations -from .operations import RoutesOperations -from .operations import RuleSetsOperations -from .operations import RulesOperations -from .operations import SecurityPoliciesOperations -from .operations import SecretsOperations -from .operations import ValidateOperations -from .operations import LogAnalyticsOperations -from .operations import PoliciesOperations -from .operations import ManagedRuleSetsOperations -from .. import models - - class CdnManagementClient(CdnManagementClientOperationsMixin): """Cdn Management Client. - :ivar profiles: ProfilesOperations operations - :vartype profiles: azure.mgmt.cdn.aio.operations.ProfilesOperations - :ivar endpoints: EndpointsOperations operations - :vartype endpoints: azure.mgmt.cdn.aio.operations.EndpointsOperations - :ivar origins: OriginsOperations operations - :vartype origins: azure.mgmt.cdn.aio.operations.OriginsOperations - :ivar origin_groups: OriginGroupsOperations operations - :vartype origin_groups: azure.mgmt.cdn.aio.operations.OriginGroupsOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.cdn.aio.operations.CustomDomainsOperations - :ivar resource_usage: ResourceUsageOperations operations - :vartype resource_usage: azure.mgmt.cdn.aio.operations.ResourceUsageOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.cdn.aio.operations.Operations - :ivar edge_nodes: EdgeNodesOperations operations - :vartype edge_nodes: azure.mgmt.cdn.aio.operations.EdgeNodesOperations :ivar afd_profiles: AFDProfilesOperations operations :vartype afd_profiles: azure.mgmt.cdn.aio.operations.AFDProfilesOperations :ivar afd_custom_domains: AFDCustomDomainsOperations operations @@ -85,6 +48,22 @@ class CdnManagementClient(CdnManagementClientOperationsMixin): :vartype validate: azure.mgmt.cdn.aio.operations.ValidateOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.cdn.aio.operations.LogAnalyticsOperations + :ivar profiles: ProfilesOperations operations + :vartype profiles: azure.mgmt.cdn.aio.operations.ProfilesOperations + :ivar endpoints: EndpointsOperations operations + :vartype endpoints: azure.mgmt.cdn.aio.operations.EndpointsOperations + :ivar origins: OriginsOperations operations + :vartype origins: azure.mgmt.cdn.aio.operations.OriginsOperations + :ivar origin_groups: OriginGroupsOperations operations + :vartype origin_groups: azure.mgmt.cdn.aio.operations.OriginGroupsOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: azure.mgmt.cdn.aio.operations.CustomDomainsOperations + :ivar resource_usage: ResourceUsageOperations operations + :vartype resource_usage: azure.mgmt.cdn.aio.operations.ResourceUsageOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.cdn.aio.operations.Operations + :ivar edge_nodes: EdgeNodesOperations operations + :vartype edge_nodes: azure.mgmt.cdn.aio.operations.EdgeNodesOperations :ivar policies: PoliciesOperations operations :vartype policies: azure.mgmt.cdn.aio.operations.PoliciesOperations :ivar managed_rule_sets: ManagedRuleSetsOperations operations @@ -93,71 +72,75 @@ class CdnManagementClient(CdnManagementClientOperationsMixin): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Azure Subscription ID. :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 = CdnManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = CdnManagementClientConfiguration(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.afd_profiles = AFDProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.afd_custom_domains = AFDCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.afd_endpoints = AFDEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.afd_origin_groups = AFDOriginGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.afd_origins = AFDOriginsOperations(self._client, self._config, self._serialize, self._deserialize) + self.routes = RoutesOperations(self._client, self._config, self._serialize, self._deserialize) + self.rule_sets = RuleSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.security_policies = SecurityPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.validate = ValidateOperations(self._client, self._config, self._serialize, self._deserialize) + self.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) + self.profiles = ProfilesOperations(self._client, self._config, self._serialize, self._deserialize) + self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.origins = OriginsOperations(self._client, self._config, self._serialize, self._deserialize) + self.origin_groups = OriginGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.resource_usage = ResourceUsageOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.edge_nodes = EdgeNodesOperations(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.profiles = ProfilesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.endpoints = EndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.origins = OriginsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.origin_groups = OriginGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.resource_usage = ResourceUsageOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.edge_nodes = EdgeNodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.afd_profiles = AFDProfilesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.afd_custom_domains = AFDCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.afd_endpoints = AFDEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.afd_origin_groups = AFDOriginGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.afd_origins = AFDOriginsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.routes = RoutesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rule_sets = RuleSetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.security_policies = SecurityPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.validate = ValidateOperations( - self._client, self._config, self._serialize, self._deserialize) - self.log_analytics = LogAnalyticsOperations( - 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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_configuration.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_configuration.py index b2553bc99e4d..b06ebb45dcfd 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_configuration.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/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,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(CdnManagementClientConfiguration, 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(CdnManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-09-01" + self.api_version = "2021-06-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-cdn/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_patch.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/__init__.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/__init__.py index 17011eacfb60..02659c9dab5c 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/__init__.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/__init__.py @@ -6,15 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._profiles_operations import ProfilesOperations -from ._endpoints_operations import EndpointsOperations -from ._origins_operations import OriginsOperations -from ._origin_groups_operations import OriginGroupsOperations -from ._custom_domains_operations import CustomDomainsOperations from ._cdn_management_client_operations import CdnManagementClientOperationsMixin -from ._resource_usage_operations import ResourceUsageOperations -from ._operations import Operations -from ._edge_nodes_operations import EdgeNodesOperations from ._afd_profiles_operations import AFDProfilesOperations from ._afd_custom_domains_operations import AFDCustomDomainsOperations from ._afd_endpoints_operations import AFDEndpointsOperations @@ -27,19 +19,19 @@ from ._secrets_operations import SecretsOperations from ._validate_operations import ValidateOperations from ._log_analytics_operations import LogAnalyticsOperations +from ._profiles_operations import ProfilesOperations +from ._endpoints_operations import EndpointsOperations +from ._origins_operations import OriginsOperations +from ._origin_groups_operations import OriginGroupsOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._resource_usage_operations import ResourceUsageOperations +from ._operations import Operations +from ._edge_nodes_operations import EdgeNodesOperations from ._policies_operations import PoliciesOperations from ._managed_rule_sets_operations import ManagedRuleSetsOperations __all__ = [ - 'ProfilesOperations', - 'EndpointsOperations', - 'OriginsOperations', - 'OriginGroupsOperations', - 'CustomDomainsOperations', 'CdnManagementClientOperationsMixin', - 'ResourceUsageOperations', - 'Operations', - 'EdgeNodesOperations', 'AFDProfilesOperations', 'AFDCustomDomainsOperations', 'AFDEndpointsOperations', @@ -52,6 +44,14 @@ 'SecretsOperations', 'ValidateOperations', 'LogAnalyticsOperations', + 'ProfilesOperations', + 'EndpointsOperations', + 'OriginsOperations', + 'OriginGroupsOperations', + 'CustomDomainsOperations', + 'ResourceUsageOperations', + 'Operations', + 'EdgeNodesOperations', 'PoliciesOperations', 'ManagedRuleSetsOperations', ] diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_custom_domains_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_custom_domains_operations.py index 7003721bb73b..2ea47d0bcba8 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_custom_domains_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_custom_domains_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._afd_custom_domains_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_profile_request, build_refresh_validation_token_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,17 +48,19 @@ 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.AFDDomainListResult"]: """Lists existing AzureFrontDoor domains. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + or CDN profile which is unique within the resource group. :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 AFDDomainListResult or the result of cls(response) @@ -65,36 +72,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('AFDDomainListResult', pipeline_response) + deserialized = self._deserialize("AFDDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,30 +111,33 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/customDomains'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, custom_domain_name: str, - **kwargs + **kwargs: Any ) -> "_models.AFDDomain": """Gets an existing AzureFrontDoor domain with the specified domain name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. :type custom_domain_name: str @@ -144,34 +151,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + custom_domain_name=custom_domain_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AFDDomain', pipeline_response) @@ -180,55 +177,46 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, profile_name: str, custom_domain_name: str, custom_domain: "_models.AFDDomain", - **kwargs + **kwargs: Any ) -> "_models.AFDDomain": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomain"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(custom_domain, 'AFDDomain') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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_domain, 'AFDDomain') - 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.AfdErrorResponse, 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('AFDDomain', pipeline_response) @@ -243,21 +231,25 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, profile_name: str, custom_domain_name: str, custom_domain: "_models.AFDDomain", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.AFDDomain"]: """Creates a new domain within the specified profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. :type custom_domain_name: str @@ -265,15 +257,19 @@ async def begin_create( :type custom_domain: ~azure.mgmt.cdn.models.AFDDomain :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 AFDDomain 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 AFDDomain or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDDomain] - :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.AFDDomain"] lro_delay = kwargs.pop( 'polling_interval', @@ -286,28 +282,21 @@ async def begin_create( profile_name=profile_name, custom_domain_name=custom_domain_name, custom_domain=custom_domain, + 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('AFDDomain', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -319,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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore async def _update_initial( @@ -327,47 +317,36 @@ async def _update_initial( profile_name: str, custom_domain_name: str, custom_domain_update_properties: "_models.AFDDomainUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.AFDDomain": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomain"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(custom_domain_update_properties, 'AFDDomainUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + 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(custom_domain_update_properties, 'AFDDomainUpdateParameters') - 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.AfdErrorResponse, 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('AFDDomain', pipeline_response) @@ -379,21 +358,25 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, profile_name: str, custom_domain_name: str, custom_domain_update_properties: "_models.AFDDomainUpdateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.AFDDomain"]: """Updates an existing domain within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. :type custom_domain_name: str @@ -401,15 +384,19 @@ async def begin_update( :type custom_domain_update_properties: ~azure.mgmt.cdn.models.AFDDomainUpdateParameters :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 AFDDomain 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 AFDDomain or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDDomain] - :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.AFDDomain"] lro_delay = kwargs.pop( 'polling_interval', @@ -422,28 +409,21 @@ async def begin_update( profile_name=profile_name, custom_domain_name=custom_domain_name, custom_domain_update_properties=custom_domain_update_properties, + 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('AFDDomain', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -455,6 +435,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.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore async def _delete_initial( @@ -462,75 +443,69 @@ async def _delete_initial( resource_group_name: str, profile_name: str, custom_domain_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + custom_domain_name=custom_domain_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, custom_domain_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing AzureFrontDoor domain with the specified domain name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. :type custom_domain_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', @@ -545,22 +520,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -572,6 +539,7 @@ 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.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore async def _refresh_validation_token_initial( @@ -579,78 +547,69 @@ async def _refresh_validation_token_initial( resource_group_name: str, profile_name: str, custom_domain_name: str, - **kwargs - ) -> "_models.ValidationToken": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidationToken"] + **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-09-01" - accept = "application/json" - - # Construct URL - url = self._refresh_validation_token_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_validation_token_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + template_url=self._refresh_validation_token_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]: + 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.AfdErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ValidationToken', pipeline_response) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized _refresh_validation_token_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken'} # type: ignore + + @distributed_trace_async async def begin_refresh_validation_token( self, resource_group_name: str, profile_name: str, custom_domain_name: str, - **kwargs - ) -> AsyncLROPoller["_models.ValidationToken"]: + **kwargs: Any + ) -> AsyncLROPoller[None]: """Updates the domain validation token. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. :type custom_domain_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. - :return: An instance of AsyncLROPoller that returns either ValidationToken or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.ValidationToken] - :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidationToken"] + 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', self._config.polling_interval @@ -664,25 +623,14 @@ async def begin_refresh_validation_token( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ValidationToken', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -694,4 +642,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh_validation_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_endpoints_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_endpoints_operations.py index bb9f129209a1..43f7e6c59532 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_endpoints_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_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._afd_endpoints_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_profile_request, build_list_resource_usage_request, build_purge_content_request_initial, build_update_request_initial, build_validate_custom_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,20 +48,23 @@ 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.AFDEndpointListResult"]: """Lists existing AzureFrontDoor endpoints. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :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 AFDEndpointListResult or the result of cls(response) + :return: An iterator like instance of either AFDEndpointListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.AFDEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -65,36 +73,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('AFDEndpointListResult', pipeline_response) + deserialized = self._deserialize("AFDEndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,30 +112,33 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/afdEndpoints'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> "_models.AFDEndpoint": """Gets an existing AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -144,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AFDEndpoint', pipeline_response) @@ -180,55 +178,46 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, endpoint: "_models.AFDEndpoint", - **kwargs + **kwargs: Any ) -> "_models.AFDEndpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(endpoint, 'AFDEndpoint') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(endpoint, 'AFDEndpoint') - 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.AfdErrorResponse, 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('AFDEndpoint', pipeline_response) @@ -243,22 +232,26 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, profile_name: str, endpoint_name: str, endpoint: "_models.AFDEndpoint", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.AFDEndpoint"]: """Creates a new AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -266,15 +259,19 @@ async def begin_create( :type endpoint: ~azure.mgmt.cdn.models.AFDEndpoint :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 AFDEndpoint 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 AFDEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDEndpoint] - :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.AFDEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +284,21 @@ async def begin_create( profile_name=profile_name, endpoint_name=endpoint_name, endpoint=endpoint, + 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('AFDEndpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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 +310,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore async def _update_initial( @@ -328,47 +319,36 @@ async def _update_initial( profile_name: str, endpoint_name: str, endpoint_update_properties: "_models.AFDEndpointUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.AFDEndpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(endpoint_update_properties, 'AFDEndpointUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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(endpoint_update_properties, 'AFDEndpointUpdateParameters') - 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.AfdErrorResponse, 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('AFDEndpoint', pipeline_response) @@ -380,15 +360,18 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, profile_name: str, endpoint_name: str, endpoint_update_properties: "_models.AFDEndpointUpdateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.AFDEndpoint"]: """Updates an existing AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, resource group and profile. Only tags can be updated after creating an @@ -397,7 +380,8 @@ async def begin_update( :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -405,15 +389,19 @@ async def begin_update( :type endpoint_update_properties: ~azure.mgmt.cdn.models.AFDEndpointUpdateParameters :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 AFDEndpoint 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 AFDEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDEndpoint] - :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.AFDEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -426,28 +414,21 @@ async def begin_update( profile_name=profile_name, endpoint_name=endpoint_name, endpoint_update_properties=endpoint_update_properties, + 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('AFDEndpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -459,6 +440,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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore async def _delete_initial( @@ -466,75 +448,69 @@ async def _delete_initial( resource_group_name: str, profile_name: str, 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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type 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', @@ -549,22 +525,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -576,6 +544,7 @@ 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore async def _purge_content_initial( @@ -584,66 +553,58 @@ async def _purge_content_initial( profile_name: str, endpoint_name: str, contents: "_models.AfdPurgeParameters", - **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-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(contents, 'AfdPurgeParameters') - # 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_purge_content_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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(contents, 'AfdPurgeParameters') - 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_content( self, resource_group_name: str, profile_name: str, endpoint_name: str, contents: "_models.AfdPurgeParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Removes a content from AzureFrontDoor. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -653,15 +614,18 @@ async def begin_purge_content( :type contents: ~azure.mgmt.cdn.models.AfdPurgeParameters :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', @@ -674,25 +638,18 @@ async def begin_purge_content( profile_name=profile_name, endpoint_name=endpoint_name, contents=contents, + 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -704,20 +661,23 @@ 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge'} # type: ignore + @distributed_trace def list_resource_usage( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UsagesListResult"]: """Checks the quota and actual usage of endpoints under the given CDN profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -731,37 +691,35 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('UsagesListResult', pipeline_response) + deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -774,30 +732,33 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/usages'} # type: ignore + @distributed_trace_async async def validate_custom_domain( self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_properties: "_models.ValidateCustomDomainInput", - **kwargs + **kwargs: Any ) -> "_models.ValidateCustomDomainOutput": """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -813,39 +774,29 @@ async def validate_custom_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') + + request = build_validate_custom_domain_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ValidateCustomDomainOutput', pipeline_response) @@ -854,4 +805,6 @@ async def validate_custom_domain( return cls(pipeline_response, deserialized, {}) return deserialized + validate_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/validateCustomDomain'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_origin_groups_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_origin_groups_operations.py index feef02f7a4bd..e0d3b01bd317 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_origin_groups_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_origin_groups_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._afd_origin_groups_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_profile_request, build_list_resource_usage_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,21 +48,25 @@ 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.AFDOriginGroupListResult"]: """Lists all of the existing origin groups within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :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 AFDOriginGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.AFDOriginGroupListResult] + :return: An iterator like instance of either AFDOriginGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.AFDOriginGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroupListResult"] @@ -65,36 +74,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('AFDOriginGroupListResult', pipeline_response) + deserialized = self._deserialize("AFDOriginGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,29 +113,32 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/originGroups'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, origin_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.AFDOriginGroup": """Gets an existing origin group within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. :type origin_group_name: str @@ -143,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AFDOriginGroup', pipeline_response) @@ -179,55 +178,46 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, profile_name: str, origin_group_name: str, origin_group: "_models.AFDOriginGroup", - **kwargs + **kwargs: Any ) -> "_models.AFDOriginGroup": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(origin_group, 'AFDOriginGroup') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(origin_group, 'AFDOriginGroup') - 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.AfdErrorResponse, 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('AFDOriginGroup', pipeline_response) @@ -242,21 +232,25 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, profile_name: str, origin_group_name: str, origin_group: "_models.AFDOriginGroup", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.AFDOriginGroup"]: """Creates a new origin group within the specified profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. :type origin_group_name: str @@ -264,15 +258,19 @@ async def begin_create( :type origin_group: ~azure.mgmt.cdn.models.AFDOriginGroup :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 AFDOriginGroup 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 AFDOriginGroup or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] - :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.AFDOriginGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +283,21 @@ async def begin_create( profile_name=profile_name, origin_group_name=origin_group_name, origin_group=origin_group, + 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('AFDOriginGroup', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -318,6 +309,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore async def _update_initial( @@ -326,47 +318,36 @@ async def _update_initial( profile_name: str, origin_group_name: str, origin_group_update_properties: "_models.AFDOriginGroupUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.AFDOriginGroup": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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(origin_group_update_properties, 'AFDOriginGroupUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + 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(origin_group_update_properties, 'AFDOriginGroupUpdateParameters') - 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.AfdErrorResponse, 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('AFDOriginGroup', pipeline_response) @@ -378,21 +359,25 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, profile_name: str, origin_group_name: str, origin_group_update_properties: "_models.AFDOriginGroupUpdateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.AFDOriginGroup"]: """Updates an existing origin group within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -400,15 +385,19 @@ async def begin_update( :type origin_group_update_properties: ~azure.mgmt.cdn.models.AFDOriginGroupUpdateParameters :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 AFDOriginGroup 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 AFDOriginGroup or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] - :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.AFDOriginGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -421,28 +410,21 @@ async def begin_update( profile_name=profile_name, origin_group_name=origin_group_name, origin_group_update_properties=origin_group_update_properties, + 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('AFDOriginGroup', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -454,6 +436,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.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore async def _delete_initial( @@ -461,74 +444,68 @@ async def _delete_initial( resource_group_name: str, profile_name: str, origin_group_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, origin_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing origin group within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_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', @@ -543,22 +520,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -570,20 +539,23 @@ 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.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + @distributed_trace def list_resource_usage( self, resource_group_name: str, profile_name: str, origin_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UsagesListResult"]: """Checks the quota and actual usage of endpoints under the given CDN profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. :type origin_group_name: str @@ -597,37 +569,35 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_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('UsagesListResult', pipeline_response) + deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -640,12 +610,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_origins_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_origins_operations.py index 03e3cf733365..13a605a92939 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_origins_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_origins_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._afd_origins_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_origin_group_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,18 +48,20 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_origin_group( self, resource_group_name: str, profile_name: str, origin_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.AFDOriginListResult"]: """Lists all of the existing origins within an origin group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -68,37 +75,35 @@ def list_by_origin_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_origin_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_origin_group_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_origin_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_origin_group_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_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('AFDOriginListResult', pipeline_response) + deserialized = self._deserialize("AFDOriginListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,30 +116,33 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_origin_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, origin_group_name: str, origin_name: str, - **kwargs + **kwargs: Any ) -> "_models.AFDOrigin": """Gets an existing origin within an origin group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -150,35 +158,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + origin_name=origin_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AFDOrigin', pipeline_response) @@ -187,8 +185,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -196,48 +196,37 @@ async def _create_initial( origin_group_name: str, origin_name: str, origin: "_models.AFDOrigin", - **kwargs + **kwargs: Any ) -> "_models.AFDOrigin": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOrigin"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(origin, 'AFDOrigin') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + origin_name=origin_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(origin, 'AFDOrigin') - 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.AfdErrorResponse, 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('AFDOrigin', pipeline_response) @@ -252,8 +241,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -261,13 +253,14 @@ async def begin_create( origin_group_name: str, origin_name: str, origin: "_models.AFDOrigin", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.AFDOrigin"]: """Creates a new origin within the specified origin group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -277,15 +270,19 @@ async def begin_create( :type origin: ~azure.mgmt.cdn.models.AFDOrigin :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 AFDOrigin 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 AFDOrigin or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOrigin] - :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.AFDOrigin"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +296,21 @@ async def begin_create( origin_group_name=origin_group_name, origin_name=origin_name, origin=origin, + 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('AFDOrigin', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -333,6 +322,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore async def _update_initial( @@ -342,48 +332,37 @@ async def _update_initial( origin_group_name: str, origin_name: str, origin_update_properties: "_models.AFDOriginUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.AFDOrigin": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOrigin"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(origin_update_properties, 'AFDOriginUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + origin_name=origin_name, + subscription_id=self._config.subscription_id, + 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(origin_update_properties, 'AFDOriginUpdateParameters') - 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.AfdErrorResponse, 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('AFDOrigin', pipeline_response) @@ -395,8 +374,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -404,13 +386,14 @@ async def begin_update( origin_group_name: str, origin_name: str, origin_update_properties: "_models.AFDOriginUpdateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.AFDOrigin"]: """Updates an existing origin within an origin group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -420,15 +403,19 @@ async def begin_update( :type origin_update_properties: ~azure.mgmt.cdn.models.AFDOriginUpdateParameters :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 AFDOrigin 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 AFDOrigin or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOrigin] - :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.AFDOrigin"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,29 +429,21 @@ async def begin_update( origin_group_name=origin_group_name, origin_name=origin_name, origin_update_properties=origin_update_properties, + 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('AFDOrigin', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -476,6 +455,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.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore async def _delete_initial( @@ -484,62 +464,54 @@ async def _delete_initial( profile_name: str, origin_group_name: str, origin_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + origin_name=origin_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, origin_group_name: str, origin_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing origin within an origin group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -547,15 +519,17 @@ async def begin_delete( :type origin_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', @@ -571,23 +545,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -599,4 +564,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.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_profiles_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_profiles_operations.py index 6df4d71edc95..e347634a1873 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_profiles_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_afd_profiles_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar 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._afd_profiles_operations import build_check_host_name_availability_request, build_list_resource_usage_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,17 +46,19 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_resource_usage( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UsagesListResult"]: """Checks the quota and actual usage of endpoints under the given CDN profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :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 UsagesListResult or the result of cls(response) @@ -63,36 +70,33 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_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('UsagesListResult', pipeline_response) + deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,80 +109,75 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages'} # type: ignore + @distributed_trace_async async def check_host_name_availability( self, resource_group_name: str, profile_name: str, - check_host_name_availability_input: "_models.ValidateCustomDomainInput", - **kwargs - ) -> "_models.ValidateCustomDomainOutput": + check_host_name_availability_input: "_models.CheckHostNameAvailabilityInput", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityOutput": """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :type profile_name: str :param check_host_name_availability_input: Custom domain to be validated. - :type check_host_name_availability_input: ~azure.mgmt.cdn.models.ValidateCustomDomainInput + :type check_host_name_availability_input: ~azure.mgmt.cdn.models.CheckHostNameAvailabilityInput :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateCustomDomainOutput, or the result of cls(response) - :rtype: ~azure.mgmt.cdn.models.ValidateCustomDomainOutput + :return: CheckNameAvailabilityOutput, or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateCustomDomainOutput"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityOutput"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_host_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_host_name_availability_input, 'CheckHostNameAvailabilityInput') - # 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_host_name_availability_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_host_name_availability.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_host_name_availability_input, '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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ValidateCustomDomainOutput', pipeline_response) + deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized + check_host_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkHostNameAvailability'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_cdn_management_client_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_cdn_management_client_operations.py index 8e1b0d1e19bf..135698d3838f 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_cdn_management_client_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_cdn_management_client_operations.py @@ -5,25 +5,88 @@ # 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._cdn_management_client_operations import build_check_endpoint_name_availability_request, build_check_name_availability_request, build_check_name_availability_with_subscription_request, build_validate_probe_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class CdnManagementClientOperationsMixin: + @distributed_trace_async + async def check_endpoint_name_availability( + self, + resource_group_name: str, + check_endpoint_name_availability_input: "_models.CheckEndpointNameAvailabilityInput", + **kwargs: Any + ) -> "_models.CheckEndpointNameAvailabilityOutput": + """Check the availability of a resource name. This is needed for resources where name is globally + unique, such as a afdx endpoint. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param check_endpoint_name_availability_input: Input to check. + :type check_endpoint_name_availability_input: + ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckEndpointNameAvailabilityOutput, or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityOutput + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckEndpointNameAvailabilityOutput"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_endpoint_name_availability_input, 'CheckEndpointNameAvailabilityInput') + + request = build_check_endpoint_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.check_endpoint_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckEndpointNameAvailabilityOutput', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_endpoint_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability'} # type: ignore + + + @distributed_trace_async async def check_name_availability( self, check_name_availability_input: "_models.CheckNameAvailabilityInput", - **kwargs + **kwargs: Any ) -> "_models.CheckNameAvailabilityOutput": """Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. @@ -40,32 +103,25 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(check_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_name_availability_input, 'CheckNameAvailabilityInput') + + request = build_check_name_availability_request( + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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) @@ -74,12 +130,15 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/providers/Microsoft.Cdn/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def check_name_availability_with_subscription( self, check_name_availability_input: "_models.CheckNameAvailabilityInput", - **kwargs + **kwargs: Any ) -> "_models.CheckNameAvailabilityOutput": """Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. @@ -96,36 +155,26 @@ async def check_name_availability_with_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability_with_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_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_name_availability_with_subscription_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability_with_subscription.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_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) @@ -134,12 +183,15 @@ async def check_name_availability_with_subscription( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability_with_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def validate_probe( self, validate_probe_input: "_models.ValidateProbeInput", - **kwargs + **kwargs: Any ) -> "_models.ValidateProbeOutput": """Check if the probe path is a valid path and the file can be accessed. Probe path is the path to a file hosted on the origin server to help accelerate the delivery of dynamic content via the @@ -157,36 +209,26 @@ async def validate_probe( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_probe.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(validate_probe_input, 'ValidateProbeInput') - # 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_probe_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.validate_probe.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(validate_probe_input, 'ValidateProbeInput') - 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('ValidateProbeOutput', pipeline_response) @@ -195,4 +237,6 @@ async def validate_probe( return cls(pipeline_response, deserialized, {}) return deserialized + validate_probe.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_custom_domains_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_custom_domains_operations.py index 9e9d9944c14f..111c3ffb8a46 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_custom_domains_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_custom_domains_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._custom_domains_operations import build_create_request_initial, build_delete_request_initial, build_disable_custom_https_request, build_enable_custom_https_request, build_get_request, build_list_by_endpoint_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_endpoint( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.CustomDomainListResult"]: """Lists all of the existing custom domains within an endpoint. @@ -59,7 +65,8 @@ def list_by_endpoint( :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainListResult or the result of cls(response) + :return: An iterator like instance of either CustomDomainListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.CustomDomainListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -68,37 +75,35 @@ def list_by_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_endpoint.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_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('CustomDomainListResult', pipeline_response) + deserialized = self._deserialize("CustomDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,24 +116,26 @@ 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_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, - **kwargs + **kwargs: Any ) -> "_models.CustomDomain": """Gets an existing custom domain within an endpoint. @@ -150,35 +157,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_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('CustomDomain', pipeline_response) @@ -187,8 +184,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -196,48 +195,37 @@ async def _create_initial( endpoint_name: str, custom_domain_name: str, custom_domain_properties: "_models.CustomDomainParameters", - **kwargs + **kwargs: Any ) -> "_models.CustomDomain": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomain"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(custom_domain_properties, 'CustomDomainParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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_domain_properties, 'CustomDomainParameters') - 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('CustomDomain', pipeline_response) @@ -252,8 +240,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -261,7 +252,7 @@ async def begin_create( endpoint_name: str, custom_domain_name: str, custom_domain_properties: "_models.CustomDomainParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.CustomDomain"]: """Creates a new custom domain within an endpoint. @@ -277,15 +268,19 @@ async def begin_create( :type custom_domain_properties: ~azure.mgmt.cdn.models.CustomDomainParameters :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 CustomDomain 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 CustomDomain or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CustomDomain] - :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.CustomDomain"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +294,21 @@ async def begin_create( endpoint_name=endpoint_name, custom_domain_name=custom_domain_name, custom_domain_properties=custom_domain_properties, + 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('CustomDomain', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - '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: @@ -333,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'} # type: ignore async def _delete_initial( @@ -341,43 +329,32 @@ async def _delete_initial( profile_name: str, endpoint_name: str, custom_domain_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.CustomDomain"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CustomDomain"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_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 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) deserialized = None if response.status_code == 202: @@ -387,15 +364,18 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.CustomDomain"]: """Deletes an existing custom domain within an endpoint. @@ -409,15 +389,18 @@ async def begin_delete( :type custom_domain_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. - :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: + :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 CustomDomain or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CustomDomain] + :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["_models.CustomDomain"] lro_delay = kwargs.pop( 'polling_interval', @@ -433,26 +416,17 @@ 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): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomain', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - '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: @@ -464,15 +438,17 @@ 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'} # type: ignore + @distributed_trace_async async def disable_custom_https( self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.CustomDomain"]: """Disable https delivery of the custom domain. @@ -494,35 +470,25 @@ async def disable_custom_https( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.disable_custom_https.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_custom_https_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + template_url=self.disable_custom_https.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -533,8 +499,11 @@ async def disable_custom_https( return cls(pipeline_response, deserialized, {}) return deserialized + disable_custom_https.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps'} # type: ignore + + @distributed_trace_async async def enable_custom_https( self, resource_group_name: str, @@ -542,7 +511,7 @@ async def enable_custom_https( endpoint_name: str, custom_domain_name: str, custom_domain_https_parameters: Optional["_models.CustomDomainHttpsParameters"] = None, - **kwargs + **kwargs: Any ) -> Optional["_models.CustomDomain"]: """Enable https delivery of the custom domain. @@ -568,43 +537,33 @@ async def enable_custom_https( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.enable_custom_https.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if custom_domain_https_parameters is not None: - body_content = self._serialize.body(custom_domain_https_parameters, 'CustomDomainHttpsParameters') + _json = self._serialize.body(custom_domain_https_parameters, 'CustomDomainHttpsParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_enable_custom_https_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.enable_custom_https.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, 202]: 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 = None @@ -615,4 +574,6 @@ async def enable_custom_https( return cls(pipeline_response, deserialized, {}) return deserialized + enable_custom_https.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_edge_nodes_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_edge_nodes_operations.py index f2be0f50db1a..56ff242e7dd0 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_edge_nodes_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_edge_nodes_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._edge_nodes_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EdgenodeResult"]: """Edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. @@ -58,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EdgenodeResult', pipeline_response) + deserialized = self._deserialize("EdgenodeResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,12 +97,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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_endpoints_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_endpoints_operations.py index cd7bbd4f49c2..ffc196bfb080 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_endpoints_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_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._endpoints_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_profile_request, build_list_resource_usage_request, build_load_content_request_initial, build_purge_content_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial, build_validate_custom_domain_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_profile( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EndpointListResult"]: """Lists existing CDN endpoints. @@ -65,36 +71,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('EndpointListResult', pipeline_response) + deserialized = self._deserialize("EndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,23 +110,25 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_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.Cdn/profiles/{profileName}/endpoints'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> "_models.Endpoint": """Gets an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. @@ -144,34 +149,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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('Endpoint', pipeline_response) @@ -180,55 +175,46 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, endpoint: "_models.Endpoint", - **kwargs + **kwargs: Any ) -> "_models.Endpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(endpoint, 'Endpoint') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(endpoint, 'Endpoint') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 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('Endpoint', pipeline_response) @@ -243,15 +229,18 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, profile_name: str, endpoint_name: str, endpoint: "_models.Endpoint", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Endpoint"]: """Creates a new CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. @@ -266,15 +255,19 @@ async def begin_create( :type endpoint: ~azure.mgmt.cdn.models.Endpoint :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 Endpoint 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 Endpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Endpoint] - :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.Endpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +280,21 @@ async def begin_create( profile_name=profile_name, endpoint_name=endpoint_name, endpoint=endpoint, + 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('Endpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -320,6 +306,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore async def _update_initial( @@ -328,47 +315,36 @@ async def _update_initial( profile_name: str, endpoint_name: str, endpoint_update_properties: "_models.EndpointUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.Endpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(endpoint_update_properties, 'EndpointUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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(endpoint_update_properties, 'EndpointUpdateParameters') - 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('Endpoint', pipeline_response) @@ -380,15 +356,18 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, profile_name: str, endpoint_name: str, endpoint_update_properties: "_models.EndpointUpdateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Endpoint"]: """Updates an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. Only tags can be updated after creating an endpoint. @@ -405,15 +384,19 @@ async def begin_update( :type endpoint_update_properties: ~azure.mgmt.cdn.models.EndpointUpdateParameters :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 Endpoint 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 Endpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Endpoint] - :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.Endpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -426,28 +409,21 @@ async def begin_update( profile_name=profile_name, endpoint_name=endpoint_name, endpoint_update_properties=endpoint_update_properties, + 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('Endpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -459,6 +435,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.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore async def _delete_initial( @@ -466,54 +443,45 @@ async def _delete_initial( resource_group_name: str, profile_name: str, 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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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 - if response.status_code not in [202, 204]: + 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.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. @@ -526,15 +494,17 @@ async def begin_delete( :type 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', @@ -549,22 +519,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -576,6 +538,7 @@ 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.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore async def _start_initial( @@ -583,42 +546,31 @@ async def _start_initial( resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> "_models.Endpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self._start_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 response.status_code == 200: deserialized = self._deserialize('Endpoint', pipeline_response) @@ -630,14 +582,17 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Endpoint"]: """Starts an existing CDN endpoint that is on a stopped state. @@ -649,15 +604,18 @@ async def begin_start( :type 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. - :return: An instance of AsyncLROPoller that returns either Endpoint 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 Endpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Endpoint] - :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["_models.Endpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -672,25 +630,17 @@ async def begin_start( 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('Endpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -702,6 +652,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start'} # type: ignore async def _stop_initial( @@ -709,42 +660,31 @@ async def _stop_initial( resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> "_models.Endpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self._stop_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 response.status_code == 200: deserialized = self._deserialize('Endpoint', pipeline_response) @@ -756,14 +696,17 @@ async def _stop_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Endpoint"]: """Stops an existing running CDN endpoint. @@ -775,15 +718,18 @@ async def begin_stop( :type 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. - :return: An instance of AsyncLROPoller that returns either Endpoint 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 Endpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Endpoint] - :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["_models.Endpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -798,25 +744,17 @@ async def begin_stop( 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('Endpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -828,6 +766,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop'} # type: ignore async def _purge_content_initial( @@ -836,60 +775,51 @@ async def _purge_content_initial( profile_name: str, endpoint_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-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(content_file_paths, 'PurgeParameters') + + request = build_purge_content_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_content( self, resource_group_name: str, profile_name: str, endpoint_name: str, content_file_paths: "_models.PurgeParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Removes a content from CDN. @@ -905,15 +835,18 @@ async def begin_purge_content( :type content_file_paths: ~azure.mgmt.cdn.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', @@ -926,25 +859,18 @@ async def begin_purge_content( profile_name=profile_name, endpoint_name=endpoint_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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -956,6 +882,7 @@ 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'} # type: ignore async def _load_content_initial( @@ -964,60 +891,51 @@ async def _load_content_initial( profile_name: str, endpoint_name: str, content_file_paths: "_models.LoadParameters", - **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-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._load_content_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(content_file_paths, 'LoadParameters') + + request = build_load_content_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._load_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, 'LoadParameters') - 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, {}) _load_content_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load'} # type: ignore + + @distributed_trace_async async def begin_load_content( self, resource_group_name: str, profile_name: str, endpoint_name: str, content_file_paths: "_models.LoadParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Pre-loads a content to CDN. Available for Verizon Profiles. @@ -1032,15 +950,18 @@ async def begin_load_content( :type content_file_paths: ~azure.mgmt.cdn.models.LoadParameters :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', @@ -1053,25 +974,18 @@ async def begin_load_content( profile_name=profile_name, endpoint_name=endpoint_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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -1083,15 +997,17 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_load_content.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load'} # type: ignore + @distributed_trace_async async def validate_custom_domain( self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_properties: "_models.ValidateCustomDomainInput", - **kwargs + **kwargs: Any ) -> "_models.ValidateCustomDomainOutput": """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. @@ -1113,39 +1029,29 @@ async def validate_custom_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') + + request = build_validate_custom_domain_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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) @@ -1154,14 +1060,17 @@ async def validate_custom_domain( return cls(pipeline_response, deserialized, {}) return deserialized + validate_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain'} # type: ignore + + @distributed_trace def list_resource_usage( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ResourceUsageListResult"]: """Checks the quota and usage of geo filters and custom domains under the given endpoint. @@ -1172,7 +1081,8 @@ def list_resource_usage( :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceUsageListResult or the result of cls(response) + :return: An iterator like instance of either ResourceUsageListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1181,37 +1091,35 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('ResourceUsageListResult', pipeline_response) + deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1224,12 +1132,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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_log_analytics_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_log_analytics_operations.py index c6d2f59635c3..58e90f654a83 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_log_analytics_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_log_analytics_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, List, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.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._log_analytics_operations import build_get_log_analytics_locations_request, build_get_log_analytics_metrics_request, build_get_log_analytics_rankings_request, build_get_log_analytics_resources_request, build_get_waf_log_analytics_metrics_request, build_get_waf_log_analytics_rankings_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_log_analytics_metrics( self, resource_group_name: str, @@ -54,13 +59,14 @@ async def get_log_analytics_metrics( group_by: Optional[List[Union[str, "_models.LogMetricsGroupBy"]]] = None, continents: Optional[List[str]] = None, country_or_regions: Optional[List[str]] = None, - **kwargs + **kwargs: Any ) -> "_models.MetricsResponse": """Get log report for AFD profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :param metrics: :type metrics: list[str or ~azure.mgmt.cdn.models.LogMetric] @@ -90,45 +96,32 @@ async def get_log_analytics_metrics( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_log_analytics_metrics.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['metrics'] = [self._serialize.query("metrics", q, 'str') if q is not None else '' for q in metrics] - query_parameters['dateTimeBegin'] = self._serialize.query("date_time_begin", date_time_begin, 'iso-8601') - query_parameters['dateTimeEnd'] = self._serialize.query("date_time_end", date_time_end, 'iso-8601') - query_parameters['granularity'] = self._serialize.query("granularity", granularity, 'str') - if group_by is not None: - query_parameters['groupBy'] = [self._serialize.query("group_by", q, 'str') if q is not None else '' for q in group_by] - if continents is not None: - query_parameters['continents'] = [self._serialize.query("continents", q, 'str') if q is not None else '' for q in continents] - if country_or_regions is not None: - query_parameters['countryOrRegions'] = [self._serialize.query("country_or_regions", q, 'str') if q is not None else '' for q in country_or_regions] - query_parameters['customDomains'] = [self._serialize.query("custom_domains", q, 'str') if q is not None else '' for q in custom_domains] - query_parameters['protocols'] = [self._serialize.query("protocols", q, 'str') if q is not None else '' for q in protocols] - - # 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_log_analytics_metrics_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + metrics=metrics, + date_time_begin=date_time_begin, + date_time_end=date_time_end, + granularity=granularity, + custom_domains=custom_domains, + protocols=protocols, + group_by=group_by, + continents=continents, + country_or_regions=country_or_regions, + template_url=self.get_log_analytics_metrics.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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricsResponse', pipeline_response) @@ -137,8 +130,11 @@ async def get_log_analytics_metrics( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_analytics_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsMetrics'} # type: ignore + + @distributed_trace_async async def get_log_analytics_rankings( self, resource_group_name: str, @@ -149,13 +145,14 @@ async def get_log_analytics_rankings( date_time_begin: datetime.datetime, date_time_end: datetime.datetime, custom_domains: Optional[List[str]] = None, - **kwargs + **kwargs: Any ) -> "_models.RankingsResponse": """Get log analytics ranking report for AFD profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :param rankings: :type rankings: list[str or ~azure.mgmt.cdn.models.LogRanking] @@ -179,40 +176,29 @@ async def get_log_analytics_rankings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_log_analytics_rankings.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['rankings'] = [self._serialize.query("rankings", q, 'str') if q is not None else '' for q in rankings] - query_parameters['metrics'] = [self._serialize.query("metrics", q, 'str') if q is not None else '' for q in metrics] - query_parameters['maxRanking'] = self._serialize.query("max_ranking", max_ranking, 'int') - query_parameters['dateTimeBegin'] = self._serialize.query("date_time_begin", date_time_begin, 'iso-8601') - query_parameters['dateTimeEnd'] = self._serialize.query("date_time_end", date_time_end, 'iso-8601') - if custom_domains is not None: - query_parameters['customDomains'] = [self._serialize.query("custom_domains", q, 'str') if q is not None else '' for q in custom_domains] - - # 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_log_analytics_rankings_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + rankings=rankings, + metrics=metrics, + max_ranking=max_ranking, + date_time_begin=date_time_begin, + date_time_end=date_time_end, + custom_domains=custom_domains, + template_url=self.get_log_analytics_rankings.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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RankingsResponse', pipeline_response) @@ -221,19 +207,23 @@ async def get_log_analytics_rankings( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_analytics_rankings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsRankings'} # type: ignore + + @distributed_trace_async async def get_log_analytics_locations( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> "_models.ContinentsResponse": """Get all available location names for AFD log analytics report. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ContinentsResponse, or the result of cls(response) @@ -245,33 +235,23 @@ async def get_log_analytics_locations( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_log_analytics_locations.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_log_analytics_locations_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self.get_log_analytics_locations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ContinentsResponse', pipeline_response) @@ -280,19 +260,23 @@ async def get_log_analytics_locations( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_analytics_locations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsLocations'} # type: ignore + + @distributed_trace_async async def get_log_analytics_resources( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> "_models.ResourcesResponse": """Get all endpoints and custom domains available for AFD log report. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ResourcesResponse, or the result of cls(response) @@ -304,33 +288,23 @@ async def get_log_analytics_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_log_analytics_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_log_analytics_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self.get_log_analytics_resources.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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ResourcesResponse', pipeline_response) @@ -339,8 +313,11 @@ async def get_log_analytics_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_analytics_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsResources'} # type: ignore + + @distributed_trace_async async def get_waf_log_analytics_metrics( self, resource_group_name: str, @@ -352,13 +329,14 @@ async def get_waf_log_analytics_metrics( actions: Optional[List[Union[str, "_models.WafAction"]]] = None, group_by: Optional[List[Union[str, "_models.WafRankingGroupBy"]]] = None, rule_types: Optional[List[Union[str, "_models.WafRuleType"]]] = None, - **kwargs + **kwargs: Any ) -> "_models.WafMetricsResponse": """Get Waf related log analytics report for AFD profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :param metrics: :type metrics: list[str or ~azure.mgmt.cdn.models.WafMetric] @@ -384,43 +362,30 @@ async def get_waf_log_analytics_metrics( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_waf_log_analytics_metrics.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['metrics'] = [self._serialize.query("metrics", q, 'str') if q is not None else '' for q in metrics] - query_parameters['dateTimeBegin'] = self._serialize.query("date_time_begin", date_time_begin, 'iso-8601') - query_parameters['dateTimeEnd'] = self._serialize.query("date_time_end", date_time_end, 'iso-8601') - query_parameters['granularity'] = self._serialize.query("granularity", granularity, 'str') - if actions is not None: - query_parameters['actions'] = [self._serialize.query("actions", q, 'str') if q is not None else '' for q in actions] - if group_by is not None: - query_parameters['groupBy'] = [self._serialize.query("group_by", q, 'str') if q is not None else '' for q in group_by] - if rule_types is not None: - query_parameters['ruleTypes'] = [self._serialize.query("rule_types", q, 'str') if q is not None else '' for q in rule_types] - - # 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_waf_log_analytics_metrics_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + metrics=metrics, + date_time_begin=date_time_begin, + date_time_end=date_time_end, + granularity=granularity, + actions=actions, + group_by=group_by, + rule_types=rule_types, + template_url=self.get_waf_log_analytics_metrics.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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WafMetricsResponse', pipeline_response) @@ -429,8 +394,11 @@ async def get_waf_log_analytics_metrics( return cls(pipeline_response, deserialized, {}) return deserialized + get_waf_log_analytics_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsMetrics'} # type: ignore + + @distributed_trace_async async def get_waf_log_analytics_rankings( self, resource_group_name: str, @@ -442,13 +410,14 @@ async def get_waf_log_analytics_rankings( rankings: List[Union[str, "_models.WafRankingType"]], actions: Optional[List[Union[str, "_models.WafAction"]]] = None, rule_types: Optional[List[Union[str, "_models.WafRuleType"]]] = None, - **kwargs + **kwargs: Any ) -> "_models.WafRankingsResponse": """Get WAF log analytics charts for AFD profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :param metrics: :type metrics: list[str or ~azure.mgmt.cdn.models.WafMetric] @@ -474,42 +443,30 @@ async def get_waf_log_analytics_rankings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_waf_log_analytics_rankings.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['metrics'] = [self._serialize.query("metrics", q, 'str') if q is not None else '' for q in metrics] - query_parameters['dateTimeBegin'] = self._serialize.query("date_time_begin", date_time_begin, 'iso-8601') - query_parameters['dateTimeEnd'] = self._serialize.query("date_time_end", date_time_end, 'iso-8601') - query_parameters['maxRanking'] = self._serialize.query("max_ranking", max_ranking, 'int') - query_parameters['rankings'] = [self._serialize.query("rankings", q, 'str') if q is not None else '' for q in rankings] - if actions is not None: - query_parameters['actions'] = [self._serialize.query("actions", q, 'str') if q is not None else '' for q in actions] - if rule_types is not None: - query_parameters['ruleTypes'] = [self._serialize.query("rule_types", q, 'str') if q is not None else '' for q in rule_types] - - # 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_waf_log_analytics_rankings_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + metrics=metrics, + date_time_begin=date_time_begin, + date_time_end=date_time_end, + max_ranking=max_ranking, + rankings=rankings, + actions=actions, + rule_types=rule_types, + template_url=self.get_waf_log_analytics_rankings.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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WafRankingsResponse', pipeline_response) @@ -518,4 +475,6 @@ async def get_waf_log_analytics_rankings( return cls(pipeline_response, deserialized, {}) return deserialized + get_waf_log_analytics_rankings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsRankings'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_managed_rule_sets_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_managed_rule_sets_operations.py index 3730b2536a4e..e8c78d01cae7 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_managed_rule_sets_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/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.cdn.models.ManagedRuleSetDefinitionList] + :return: An iterator like instance of either ManagedRuleSetDefinitionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.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-09-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,13 +100,14 @@ 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.Cdn/CdnWebApplicationFirewallManagedRuleSets'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_operations.py index 2f41fde63587..41d99b3e97e5 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,14 +46,16 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationsListResult"]: """Lists all of the available CDN REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationsListResult or the result of cls(response) + :return: An iterator like instance of either OperationsListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.OperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsListResult', pipeline_response) + deserialized = self._deserialize("OperationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +97,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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_origin_groups_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_origin_groups_operations.py index ece5546c8d43..f7863319e416 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_origin_groups_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_origin_groups_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._origin_groups_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_endpoint_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_endpoint( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OriginGroupListResult"]: """Lists all of the existing origin groups within an endpoint. @@ -59,7 +65,8 @@ def list_by_endpoint( :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OriginGroupListResult or the result of cls(response) + :return: An iterator like instance of either OriginGroupListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.OriginGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -68,37 +75,35 @@ def list_by_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_endpoint.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_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('OriginGroupListResult', pipeline_response) + deserialized = self._deserialize("OriginGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,24 +116,26 @@ 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_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, endpoint_name: str, origin_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.OriginGroup": """Gets an existing origin group within an endpoint. @@ -150,35 +157,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_group_name=origin_group_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('OriginGroup', pipeline_response) @@ -187,8 +184,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -196,48 +195,37 @@ async def _create_initial( endpoint_name: str, origin_group_name: str, origin_group: "_models.OriginGroup", - **kwargs + **kwargs: Any ) -> "_models.OriginGroup": cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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(origin_group, 'OriginGroup') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(origin_group, 'OriginGroup') - 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('OriginGroup', pipeline_response) @@ -252,8 +240,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -261,7 +252,7 @@ async def begin_create( endpoint_name: str, origin_group_name: str, origin_group: "_models.OriginGroup", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.OriginGroup"]: """Creates a new origin group within the specified endpoint. @@ -277,15 +268,19 @@ async def begin_create( :type origin_group: ~azure.mgmt.cdn.models.OriginGroup :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 OriginGroup 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 OriginGroup or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.OriginGroup] - :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.OriginGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +294,21 @@ async def begin_create( endpoint_name=endpoint_name, origin_group_name=origin_group_name, origin_group=origin_group, + 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('OriginGroup', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - '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: @@ -333,6 +320,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore async def _update_initial( @@ -342,48 +330,37 @@ async def _update_initial( endpoint_name: str, origin_group_name: str, origin_group_update_properties: "_models.OriginGroupUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.OriginGroup": cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(origin_group_update_properties, 'OriginGroupUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + 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(origin_group_update_properties, 'OriginGroupUpdateParameters') - 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('OriginGroup', pipeline_response) @@ -395,8 +372,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -404,7 +384,7 @@ async def begin_update( endpoint_name: str, origin_group_name: str, origin_group_update_properties: "_models.OriginGroupUpdateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.OriginGroup"]: """Updates an existing origin group within an endpoint. @@ -420,15 +400,19 @@ async def begin_update( :type origin_group_update_properties: ~azure.mgmt.cdn.models.OriginGroupUpdateParameters :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 OriginGroup 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 OriginGroup or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.OriginGroup] - :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.OriginGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,29 +426,21 @@ async def begin_update( endpoint_name=endpoint_name, origin_group_name=origin_group_name, origin_group_update_properties=origin_group_update_properties, + 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('OriginGroup', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - '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: @@ -476,6 +452,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.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore async def _delete_initial( @@ -484,56 +461,47 @@ async def _delete_initial( profile_name: str, endpoint_name: str, origin_group_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_group_name=origin_group_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 - if response.status_code not in [202, 204]: + 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, endpoint_name: str, origin_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing origin group within an endpoint. @@ -547,15 +515,17 @@ async def begin_delete( :type origin_group_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', @@ -571,23 +541,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - '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: @@ -599,4 +560,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.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_origins_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_origins_operations.py index 7f17a17a07d5..e128b86100f5 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_origins_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_origins_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._origins_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_endpoint_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_endpoint( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OriginListResult"]: """Lists all of the existing origins within an endpoint. @@ -68,37 +74,35 @@ def list_by_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_endpoint.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_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('OriginListResult', pipeline_response) + deserialized = self._deserialize("OriginListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,24 +115,26 @@ 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_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, endpoint_name: str, origin_name: str, - **kwargs + **kwargs: Any ) -> "_models.Origin": """Gets an existing origin within an endpoint. @@ -150,35 +156,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_name=origin_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('Origin', pipeline_response) @@ -187,8 +183,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -196,48 +194,37 @@ async def _create_initial( endpoint_name: str, origin_name: str, origin: "_models.Origin", - **kwargs + **kwargs: Any ) -> "_models.Origin": cls = kwargs.pop('cls', None) # type: ClsType["_models.Origin"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(origin, 'Origin') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_name=origin_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(origin, 'Origin') - 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('Origin', pipeline_response) @@ -252,8 +239,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -261,7 +251,7 @@ async def begin_create( endpoint_name: str, origin_name: str, origin: "_models.Origin", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Origin"]: """Creates a new origin within the specified endpoint. @@ -277,15 +267,19 @@ async def begin_create( :type origin: ~azure.mgmt.cdn.models.Origin :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 Origin 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 Origin or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Origin] - :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.Origin"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +293,21 @@ async def begin_create( endpoint_name=endpoint_name, origin_name=origin_name, origin=origin, + 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('Origin', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - '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: @@ -333,6 +319,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore async def _update_initial( @@ -342,48 +329,37 @@ async def _update_initial( endpoint_name: str, origin_name: str, origin_update_properties: "_models.OriginUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.Origin": cls = kwargs.pop('cls', None) # type: ClsType["_models.Origin"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(origin_update_properties, 'OriginUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_name=origin_name, + subscription_id=self._config.subscription_id, + 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(origin_update_properties, 'OriginUpdateParameters') - 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('Origin', pipeline_response) @@ -395,8 +371,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -404,7 +383,7 @@ async def begin_update( endpoint_name: str, origin_name: str, origin_update_properties: "_models.OriginUpdateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Origin"]: """Updates an existing origin within an endpoint. @@ -420,15 +399,19 @@ async def begin_update( :type origin_update_properties: ~azure.mgmt.cdn.models.OriginUpdateParameters :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 Origin 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 Origin or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Origin] - :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.Origin"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,29 +425,21 @@ async def begin_update( endpoint_name=endpoint_name, origin_name=origin_name, origin_update_properties=origin_update_properties, + 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('Origin', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - '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: @@ -476,6 +451,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.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore async def _delete_initial( @@ -484,56 +460,47 @@ async def _delete_initial( profile_name: str, endpoint_name: str, origin_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_name=origin_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 - if response.status_code not in [202, 204]: + 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, endpoint_name: str, origin_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing origin within an endpoint. @@ -547,15 +514,17 @@ async def begin_delete( :type origin_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', @@ -571,23 +540,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - '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: @@ -599,4 +559,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.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_policies_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_policies_operations.py index d9f50420f06f..73e268ced93d 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_policies_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/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, build_get_request, build_list_request, build_update_request_initial 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.CdnWebApplicationFirewallPolicyList"]: """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 CdnWebApplicationFirewallPolicyList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyList] + :return: An iterator like instance of either CdnWebApplicationFirewallPolicyList or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicyList"] @@ -62,35 +70,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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('CdnWebApplicationFirewallPolicyList', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicyList", 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.Cdn/CdnWebApplicationFirewallPolicies'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, policy_name: str, - **kwargs + **kwargs: Any ) -> "_models.CdnWebApplicationFirewallPolicy": """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-09-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('CdnWebApplicationFirewallPolicy', 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.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, policy_name: str, cdn_web_application_firewall_policy: "_models.CdnWebApplicationFirewallPolicy", - **kwargs + **kwargs: Any ) -> "_models.CdnWebApplicationFirewallPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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(cdn_web_application_firewall_policy, 'CdnWebApplicationFirewallPolicy') + + 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(cdn_web_application_firewall_policy, 'CdnWebApplicationFirewallPolicy') - 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('CdnWebApplicationFirewallPolicy', 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.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, policy_name: str, cdn_web_application_firewall_policy: "_models.CdnWebApplicationFirewallPolicy", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.CdnWebApplicationFirewallPolicy"]: """Create or update policy with specified rule set name within a resource group. @@ -248,18 +238,24 @@ async def begin_create_or_update( :param policy_name: The name of the CdnWebApplicationFirewallPolicy. :type policy_name: str :param cdn_web_application_firewall_policy: Policy to be created. - :type cdn_web_application_firewall_policy: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy + :type cdn_web_application_firewall_policy: + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy :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 CdnWebApplicationFirewallPolicy or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] - :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 CdnWebApplicationFirewallPolicy or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + :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.CdnWebApplicationFirewallPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,27 +267,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy=cdn_web_application_firewall_policy, + 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('CdnWebApplicationFirewallPolicy', 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,53 +293,43 @@ 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.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore async def _update_initial( self, resource_group_name: str, policy_name: str, cdn_web_application_firewall_policy_patch_parameters: "_models.CdnWebApplicationFirewallPolicyPatchParameters", - **kwargs + **kwargs: Any ) -> "_models.CdnWebApplicationFirewallPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - '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(cdn_web_application_firewall_policy_patch_parameters, 'CdnWebApplicationFirewallPolicyPatchParameters') + + request = build_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._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(cdn_web_application_firewall_policy_patch_parameters, 'CdnWebApplicationFirewallPolicyPatchParameters') - 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('CdnWebApplicationFirewallPolicy', pipeline_response) @@ -361,14 +341,17 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, policy_name: str, cdn_web_application_firewall_policy_patch_parameters: "_models.CdnWebApplicationFirewallPolicyPatchParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.CdnWebApplicationFirewallPolicy"]: """Update an existing CdnWebApplicationFirewallPolicy with the specified policy name under the specified subscription and resource group. @@ -379,18 +362,24 @@ async def begin_update( :type policy_name: str :param cdn_web_application_firewall_policy_patch_parameters: CdnWebApplicationFirewallPolicy parameters to be patched. - :type cdn_web_application_firewall_policy_patch_parameters: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters + :type cdn_web_application_firewall_policy_patch_parameters: + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters :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 CdnWebApplicationFirewallPolicy or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] - :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 CdnWebApplicationFirewallPolicy or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + :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.CdnWebApplicationFirewallPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -402,27 +391,21 @@ async def begin_update( resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy_patch_parameters=cdn_web_application_firewall_policy_patch_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('CdnWebApplicationFirewallPolicy', 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: @@ -434,13 +417,15 @@ 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.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, policy_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes Policy. @@ -458,33 +443,27 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - - # Construct URL - url = self.delete.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( + resource_group_name=resource_group_name, + policy_name=policy_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_profiles_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_profiles_operations.py index 87b279328779..cfe604df6ed0 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_profiles_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_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._profiles_operations import build_create_request_initial, build_delete_request_initial, build_generate_sso_uri_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_list_resource_usage_request, build_list_supported_optimization_types_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ProfileListResult"]: - """Lists all of the CDN profiles within an Azure subscription. + """Lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles 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 ProfileListResult or the result of cls(response) @@ -59,34 +66,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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('ProfileListResult', pipeline_response) + deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,23 +101,26 @@ 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.Cdn/profiles'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ProfileListResult"]: - """Lists all of the CDN profiles within a resource group. + """Lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles within a + resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str @@ -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-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProfileListResult', pipeline_response) + deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -170,29 +171,32 @@ 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.Cdn/profiles'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> "_models.Profile": - """Gets a CDN profile with the specified profile name under the specified subscription and - resource group. + """Gets an Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified + profile name under the specified subscription and resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Profile, or the result of cls(response) @@ -204,33 +208,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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) @@ -239,53 +233,44 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, profile_name: str, profile: "_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 = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(profile, 'Profile') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(profile, '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) @@ -300,35 +285,43 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, profile_name: str, profile: "_models.Profile", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Profile"]: - """Creates a new CDN profile with a profile name under the specified subscription and resource - group. + """Creates a new Azure Front Door Standard or Azure Front Door Premium or CDN profile with a + profile name under the specified subscription and resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :type profile_name: str :param profile: Profile properties needed to create a new profile. :type profile: ~azure.mgmt.cdn.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.cdn.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', @@ -340,27 +333,21 @@ async def begin_create( resource_group_name=resource_group_name, profile_name=profile_name, profile=profile, + 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - '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: @@ -372,6 +359,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore async def _update_initial( @@ -379,46 +367,35 @@ async def _update_initial( resource_group_name: str, profile_name: str, profile_update_parameters: "_models.ProfileUpdateParameters", - **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 = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(profile_update_parameters, 'ProfileUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_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(profile_update_parameters, 'ProfileUpdateParameters') - 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) @@ -430,35 +407,43 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, profile_name: str, profile_update_parameters: "_models.ProfileUpdateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Profile"]: - """Updates an existing CDN profile with the specified profile name under the specified - subscription and resource group. + """Updates an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with + the specified profile name under the specified subscription and resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :type profile_name: str :param profile_update_parameters: Profile properties needed to update an existing profile. :type profile_update_parameters: ~azure.mgmt.cdn.models.ProfileUpdateParameters :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.cdn.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', @@ -470,27 +455,21 @@ async def begin_update( resource_group_name=resource_group_name, profile_name=profile_name, profile_update_parameters=profile_update_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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - '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: @@ -502,77 +481,73 @@ 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.Cdn/profiles/{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 = "2020-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_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 - if response.status_code not in [202, 204]: + 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.Cdn/profiles/{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 existing CDN profile with the specified parameters. Deleting a profile will result - in the deletion of all of the sub-resources including endpoints, origins and custom domains. + """Deletes an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with + the specified parameters. Deleting a profile will result in the deletion of all of the + sub-resources including endpoints, origins and custom domains. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :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', @@ -586,21 +561,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - '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: @@ -612,13 +580,15 @@ 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.Cdn/profiles/{profileName}'} # type: ignore + @distributed_trace_async async def generate_sso_uri( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> "_models.SsoUri": """Generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemental portal is used to configure advanced feature capabilities that are not yet available in the Azure @@ -640,33 +610,23 @@ async def generate_sso_uri( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.generate_sso_uri.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_sso_uri_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_sso_uri.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SsoUri', pipeline_response) @@ -675,20 +635,24 @@ async def generate_sso_uri( return cls(pipeline_response, deserialized, {}) return deserialized + generate_sso_uri.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri'} # type: ignore + + @distributed_trace_async async def list_supported_optimization_types( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> "_models.SupportedOptimizationTypesListResult": """Gets the supported optimization types for the current profile. A user can create an endpoint with an optimization type from the listed values. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportedOptimizationTypesListResult, or the result of cls(response) @@ -700,33 +664,23 @@ async def list_supported_optimization_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.list_supported_optimization_types.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_supported_optimization_types_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + template_url=self.list_supported_optimization_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SupportedOptimizationTypesListResult', pipeline_response) @@ -735,22 +689,28 @@ async def list_supported_optimization_types( return cls(pipeline_response, deserialized, {}) return deserialized + list_supported_optimization_types.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getSupportedOptimizationTypes'} # type: ignore + + @distributed_trace def list_resource_usage( self, resource_group_name: str, profile_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ResourceUsageListResult"]: - """Checks the quota and actual usage of endpoints under the given CDN profile. + """Checks the quota and actual usage of endpoints under the given Azure Front Door Standard or + Azure Front Door Premium or CDN profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :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 ResourceUsageListResult or the result of cls(response) + :return: An iterator like instance of either ResourceUsageListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -759,36 +719,33 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_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('ResourceUsageListResult', pipeline_response) + deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -801,12 +758,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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_resource_usage_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_resource_usage_operations.py index 907309022416..dcf2f6ce22ff 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_resource_usage_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_resource_usage_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._resource_usage_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,14 +46,16 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ResourceUsageListResult"]: """Check the quota and actual usage of the CDN profiles under the given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceUsageListResult or the result of cls(response) + :return: An iterator like instance of either ResourceUsageListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -57,34 +64,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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.post(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('ResourceUsageListResult', pipeline_response) + deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,12 +99,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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_routes_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_routes_operations.py index 9a6f742b53d3..51b0e10500ee 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_routes_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_routes_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._routes_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_endpoint_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,18 +48,20 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_endpoint( self, resource_group_name: str, profile_name: str, endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RouteListResult"]: """Lists all of the existing origins within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -68,37 +75,35 @@ def list_by_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_endpoint.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_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('RouteListResult', pipeline_response) + deserialized = self._deserialize("RouteListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,31 +116,34 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, endpoint_name: str, route_name: str, - **kwargs + **kwargs: Any ) -> "_models.Route": """Gets an existing route with the specified route name under the specified subscription, resource group, profile, and AzureFrontDoor endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -151,35 +159,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + route_name=route_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Route', pipeline_response) @@ -188,8 +186,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -197,48 +197,37 @@ async def _create_initial( endpoint_name: str, route_name: str, route: "_models.Route", - **kwargs + **kwargs: Any ) -> "_models.Route": cls = kwargs.pop('cls', None) # type: ClsType["_models.Route"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(route, 'Route') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + route_name=route_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(route, 'Route') - 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.AfdErrorResponse, 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('Route', pipeline_response) @@ -253,8 +242,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -262,14 +254,15 @@ async def begin_create( endpoint_name: str, route_name: str, route: "_models.Route", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Route"]: """Creates a new route with the specified route name under the specified subscription, resource group, profile, and AzureFrontDoor endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -279,15 +272,18 @@ async def begin_create( :type route: ~azure.mgmt.cdn.models.Route :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 Route or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Route] - :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.Route"] lro_delay = kwargs.pop( 'polling_interval', @@ -301,29 +297,21 @@ async def begin_create( endpoint_name=endpoint_name, route_name=route_name, route=route, + 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('Route', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -335,6 +323,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore async def _update_initial( @@ -344,48 +333,37 @@ async def _update_initial( endpoint_name: str, route_name: str, route_update_properties: "_models.RouteUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.Route": cls = kwargs.pop('cls', None) # type: ClsType["_models.Route"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(route_update_properties, 'RouteUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + route_name=route_name, + subscription_id=self._config.subscription_id, + 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(route_update_properties, 'RouteUpdateParameters') - 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.AfdErrorResponse, 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('Route', pipeline_response) @@ -397,8 +375,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -406,14 +387,15 @@ async def begin_update( endpoint_name: str, route_name: str, route_update_properties: "_models.RouteUpdateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Route"]: """Updates an existing route with the specified route name under the specified subscription, resource group, profile, and AzureFrontDoor endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -423,15 +405,18 @@ async def begin_update( :type route_update_properties: ~azure.mgmt.cdn.models.RouteUpdateParameters :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 Route or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Route] - :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.Route"] lro_delay = kwargs.pop( 'polling_interval', @@ -445,29 +430,21 @@ async def begin_update( endpoint_name=endpoint_name, route_name=route_name, route_update_properties=route_update_properties, + 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('Route', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -479,6 +456,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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore async def _delete_initial( @@ -487,63 +465,55 @@ async def _delete_initial( profile_name: str, endpoint_name: str, route_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + route_name=route_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, endpoint_name: str, route_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing route with the specified route name under the specified subscription, resource group, profile, and AzureFrontDoor endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -551,15 +521,17 @@ async def begin_delete( :type route_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', @@ -575,23 +547,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -603,4 +566,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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_rule_sets_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_rule_sets_operations.py index 1ea7a78b877d..a77865353740 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_rule_sets_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_rule_sets_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._rule_sets_operations import build_create_request, build_delete_request_initial, build_get_request, build_list_by_profile_request, build_list_resource_usage_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,17 +48,19 @@ 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.RuleSetListResult"]: """Lists existing AzureFrontDoor rule sets within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :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 RuleSetListResult or the result of cls(response) @@ -65,36 +72,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('RuleSetListResult', pipeline_response) + deserialized = self._deserialize("RuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,30 +111,33 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/ruleSets'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, rule_set_name: str, - **kwargs + **kwargs: Any ) -> "_models.RuleSet": """Gets an existing AzureFrontDoor rule set with the specified rule set name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. :type rule_set_name: str @@ -144,34 +151,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RuleSet', pipeline_response) @@ -180,48 +177,55 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore - async def _create_initial( + + @distributed_trace_async + async def create( self, resource_group_name: str, profile_name: str, rule_set_name: str, - **kwargs + **kwargs: Any ) -> "_models.RuleSet": + """Creates a new rule set within the specified profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. + :type profile_name: str + :param rule_set_name: Name of the rule set under the profile which is unique globally. + :type rule_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.RuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + subscription_id=self._config.subscription_id, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -230,161 +234,82 @@ async def _create_initial( if response.status_code == 201: deserialized = self._deserialize('RuleSet', pipeline_response) - if response.status_code == 202: - deserialized = self._deserialize('RuleSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore - async def begin_create( - self, - resource_group_name: str, - profile_name: str, - rule_set_name: str, - **kwargs - ) -> AsyncLROPoller["_models.RuleSet"]: - """Creates a new rule set within the specified profile. + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore - :param resource_group_name: Name of the Resource group within the Azure subscription. - :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. - :type profile_name: str - :param rule_set_name: Name of the rule set under the profile which is unique globally. - :type rule_set_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 - :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 RuleSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.RuleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleSet"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - profile_name=profile_name, - rule_set_name=rule_set_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RuleSet', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore async def _delete_initial( self, resource_group_name: str, profile_name: str, rule_set_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_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 - if response.status_code not in [200, 204]: + 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, rule_set_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing AzureFrontDoor rule set with the specified rule set name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. :type rule_set_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', @@ -399,22 +324,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -426,20 +343,23 @@ 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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore + @distributed_trace def list_resource_usage( self, resource_group_name: str, profile_name: str, rule_set_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.UsagesListResult"]: """Checks the quota and actual usage of endpoints under the given CDN profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. :type rule_set_name: str @@ -453,37 +373,35 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_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('UsagesListResult', pipeline_response) + deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -496,12 +414,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_rules_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_rules_operations.py index 78e90becd401..b89b96e70296 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_rules_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_rules_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_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_rule_set_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,18 +48,20 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_rule_set( self, resource_group_name: str, profile_name: str, rule_set_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RuleListResult"]: """Lists all of the existing delivery rules within a rule set. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile. :type rule_set_name: str @@ -68,37 +75,35 @@ def list_by_rule_set( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_rule_set.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_rule_set_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_rule_set.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_rule_set_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_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('RuleListResult', pipeline_response) + deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,30 +116,33 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, rule_set_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> "_models.Rule": """Gets an existing delivery rule within a rule set. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile. :type rule_set_name: str @@ -150,35 +158,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + rule_name=rule_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Rule', pipeline_response) @@ -187,8 +185,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -196,48 +196,37 @@ async def _create_initial( rule_set_name: str, rule_name: str, rule: "_models.Rule", - **kwargs + **kwargs: Any ) -> "_models.Rule": cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(rule, 'Rule') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(rule, 'Rule') - 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.AfdErrorResponse, 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('Rule', pipeline_response) @@ -252,8 +241,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -261,13 +253,14 @@ async def begin_create( rule_set_name: str, rule_name: str, rule: "_models.Rule", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Rule"]: """Creates a new delivery rule within the specified rule set. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile. :type rule_set_name: str @@ -277,15 +270,18 @@ async def begin_create( :type rule: ~azure.mgmt.cdn.models.Rule :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 Rule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Rule] - :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.Rule"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +295,21 @@ async def begin_create( rule_set_name=rule_set_name, rule_name=rule_name, rule=rule, + 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('Rule', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -333,6 +321,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore async def _update_initial( @@ -342,48 +331,37 @@ async def _update_initial( rule_set_name: str, rule_name: str, rule_update_properties: "_models.RuleUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.Rule": cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(rule_update_properties, 'RuleUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + 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(rule_update_properties, 'RuleUpdateParameters') - 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.AfdErrorResponse, 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('Rule', pipeline_response) @@ -395,8 +373,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -404,13 +385,14 @@ async def begin_update( rule_set_name: str, rule_name: str, rule_update_properties: "_models.RuleUpdateParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Rule"]: """Updates an existing delivery rule within a rule set. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile. :type rule_set_name: str @@ -420,15 +402,18 @@ async def begin_update( :type rule_update_properties: ~azure.mgmt.cdn.models.RuleUpdateParameters :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 Rule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Rule] - :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.Rule"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,29 +427,21 @@ async def begin_update( rule_set_name=rule_set_name, rule_name=rule_name, rule_update_properties=rule_update_properties, + 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('Rule', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -476,6 +453,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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore async def _delete_initial( @@ -484,62 +462,54 @@ async def _delete_initial( profile_name: str, rule_set_name: str, rule_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + rule_name=rule_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, rule_set_name: str, rule_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing delivery rule within a rule set. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile. :type rule_set_name: str @@ -547,15 +517,17 @@ async def begin_delete( :type rule_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', @@ -571,23 +543,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -599,4 +562,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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_secrets_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_secrets_operations.py index aeb5d3cfa5de..1995bbf31bcc 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_secrets_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_secrets_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._secrets_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_profile_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,17 +48,19 @@ 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.SecretListResult"]: """Lists existing AzureFrontDoor secrets. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :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 SecretListResult or the result of cls(response) @@ -65,36 +72,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('SecretListResult', pipeline_response) + deserialized = self._deserialize("SecretListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,29 +111,32 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/secrets'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, secret_name: str, - **kwargs + **kwargs: Any ) -> "_models.Secret": """Gets an existing Secret within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param secret_name: Name of the Secret under the profile. :type secret_name: str @@ -143,34 +150,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + secret_name=secret_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Secret', 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.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, profile_name: str, secret_name: str, secret: "_models.Secret", - **kwargs + **kwargs: Any ) -> "_models.Secret": cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(secret, 'Secret') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(secret, 'Secret') - 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.AfdErrorResponse, 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('Secret', pipeline_response) @@ -242,21 +230,25 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, profile_name: str, secret_name: str, secret: "_models.Secret", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.Secret"]: """Creates a new Secret within the specified profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param secret_name: Name of the Secret under the profile. :type secret_name: str @@ -264,15 +256,19 @@ async def begin_create( :type secret: ~azure.mgmt.cdn.models.Secret :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 Secret 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 Secret or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Secret] - :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.Secret"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +281,21 @@ async def begin_create( profile_name=profile_name, secret_name=secret_name, secret=secret, + 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('Secret', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -318,217 +307,76 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - profile_name: str, - secret_name: str, - secret_properties: "_models.SecretProperties", - **kwargs - ) -> "_models.Secret": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(secret_properties, 'SecretProperties') - 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.AfdErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Secret', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('Secret', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore - - async def begin_update( - self, - resource_group_name: str, - profile_name: str, - secret_name: str, - secret_properties: "_models.SecretProperties", - **kwargs - ) -> AsyncLROPoller["_models.Secret"]: - """Updates an existing Secret within a profile. - - :param resource_group_name: Name of the Resource group within the Azure subscription. - :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. - :type profile_name: str - :param secret_name: Name of the Secret under the profile. - :type secret_name: str - :param secret_properties: Secret properties. - :type secret_properties: ~azure.mgmt.cdn.models.SecretProperties - :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 - :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 Secret or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Secret] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - profile_name=profile_name, - secret_name=secret_name, - secret_properties=secret_properties, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Secret', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore async def _delete_initial( self, resource_group_name: str, profile_name: str, secret_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + secret_name=secret_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, secret_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing Secret within profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param secret_name: Name of the Secret under the profile. :type secret_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', @@ -543,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -570,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.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_security_policies_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_security_policies_operations.py index bad11f55a082..58a4f718fde5 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_security_policies_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_security_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._security_policies_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_profile_request, build_patch_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,21 +48,25 @@ 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.SecurityPolicyListResult"]: """Lists security policies associated with the profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :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 SecurityPolicyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.SecurityPolicyListResult] + :return: An iterator like instance of either SecurityPolicyListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.SecurityPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicyListResult"] @@ -65,36 +74,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('SecurityPolicyListResult', pipeline_response) + deserialized = self._deserialize("SecurityPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,29 +113,32 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/securityPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, profile_name: str, security_policy_name: str, - **kwargs + **kwargs: Any ) -> "_models.SecurityPolicy": """Gets an existing security policy within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param security_policy_name: Name of the security policy under the profile. :type security_policy_name: str @@ -143,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + security_policy_name=security_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SecurityPolicy', pipeline_response) @@ -179,55 +178,46 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, profile_name: str, security_policy_name: str, security_policy: "_models.SecurityPolicy", - **kwargs + **kwargs: Any ) -> "_models.SecurityPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_policy, 'SecurityPolicy') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + security_policy_name=security_policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(security_policy, 'SecurityPolicy') - 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.AfdErrorResponse, 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('SecurityPolicy', pipeline_response) @@ -242,21 +232,25 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, profile_name: str, security_policy_name: str, security_policy: "_models.SecurityPolicy", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.SecurityPolicy"]: """Creates a new security policy within the specified profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param security_policy_name: Name of the security policy under the profile. :type security_policy_name: str @@ -264,15 +258,19 @@ async def begin_create( :type security_policy: ~azure.mgmt.cdn.models.SecurityPolicy :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 SecurityPolicy 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 SecurityPolicy or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.SecurityPolicy] - :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.SecurityPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +283,21 @@ async def begin_create( profile_name=profile_name, security_policy_name=security_policy_name, security_policy=security_policy, + 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('SecurityPolicy', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -318,6 +309,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore async def _patch_initial( @@ -325,48 +317,37 @@ async def _patch_initial( resource_group_name: str, profile_name: str, security_policy_name: str, - security_policy_properties: "_models.SecurityPolicyProperties", - **kwargs + security_policy_update_properties: "_models.SecurityPolicyUpdateParameters", + **kwargs: Any ) -> "_models.SecurityPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_policy_update_properties, 'SecurityPolicyUpdateParameters') - # 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_patch_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + security_policy_name=security_policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._patch_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(security_policy_properties, 'SecurityPolicyProperties') - 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.AfdErrorResponse, 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('SecurityPolicy', pipeline_response) @@ -378,37 +359,45 @@ async def _patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_patch( self, resource_group_name: str, profile_name: str, security_policy_name: str, - security_policy_properties: "_models.SecurityPolicyProperties", - **kwargs + security_policy_update_properties: "_models.SecurityPolicyUpdateParameters", + **kwargs: Any ) -> AsyncLROPoller["_models.SecurityPolicy"]: - """Updates an existing Secret within a profile. + """Updates an existing security policy within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param security_policy_name: Name of the security policy under the profile. :type security_policy_name: str - :param security_policy_properties: Security policy update properties. - :type security_policy_properties: ~azure.mgmt.cdn.models.SecurityPolicyProperties + :param security_policy_update_properties: Security policy update properties. + :type security_policy_update_properties: ~azure.mgmt.cdn.models.SecurityPolicyUpdateParameters :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 SecurityPolicy 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 SecurityPolicy or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.SecurityPolicy] - :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.SecurityPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -420,29 +409,22 @@ async def begin_patch( resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, - security_policy_properties=security_policy_properties, + security_policy_update_properties=security_policy_update_properties, + 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('SecurityPolicy', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -454,6 +436,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore async def _delete_initial( @@ -461,74 +444,68 @@ async def _delete_initial( resource_group_name: str, profile_name: str, security_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + security_policy_name=security_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, profile_name: str, security_policy_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing security policy within profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str - :param security_policy_name: Name of the Secret under the profile. + :param security_policy_name: Name of the security policy under the profile. :type security_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', @@ -543,22 +520,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -570,4 +539,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.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_validate_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_validate_operations.py index 13208ac6a88a..21205ee09ac2 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_validate_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_validate_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._validate_operations import build_secret_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,10 +44,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def secret( self, validate_secret_input: "_models.ValidateSecretInput", - **kwargs + **kwargs: Any ) -> "_models.ValidateSecretOutput": """Validate a Secret in the profile. @@ -59,36 +64,26 @@ async def secret( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.secret.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(validate_secret_input, 'ValidateSecretInput') - # 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_secret_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.secret.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(validate_secret_input, 'ValidateSecretInput') - 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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ValidateSecretOutput', pipeline_response) @@ -97,4 +92,6 @@ async def secret( return cls(pipeline_response, deserialized, {}) return deserialized + secret.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py index ad3c0ac6c758..65c5bf240938 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py @@ -6,432 +6,250 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AFDDomain - from ._models_py3 import AFDDomainHttpsParameters - from ._models_py3 import AFDDomainListResult - from ._models_py3 import AFDDomainProperties - from ._models_py3 import AFDDomainUpdateParameters - from ._models_py3 import AFDDomainUpdatePropertiesParameters - from ._models_py3 import AFDEndpoint - from ._models_py3 import AFDEndpointListResult - from ._models_py3 import AFDEndpointProperties - from ._models_py3 import AFDEndpointPropertiesUpdateParameters - from ._models_py3 import AFDEndpointUpdateParameters - from ._models_py3 import AFDOrigin - from ._models_py3 import AFDOriginGroup - from ._models_py3 import AFDOriginGroupListResult - from ._models_py3 import AFDOriginGroupProperties - from ._models_py3 import AFDOriginGroupUpdateParameters - from ._models_py3 import AFDOriginGroupUpdatePropertiesParameters - from ._models_py3 import AFDOriginListResult - from ._models_py3 import AFDOriginProperties - from ._models_py3 import AFDOriginUpdateParameters - from ._models_py3 import AFDOriginUpdatePropertiesParameters - from ._models_py3 import AFDStateProperties - from ._models_py3 import AfdErrorResponse - from ._models_py3 import AfdPurgeParameters - from ._models_py3 import CacheExpirationActionParameters - from ._models_py3 import CacheKeyQueryStringActionParameters - from ._models_py3 import CdnCertificateSourceParameters - from ._models_py3 import CdnEndpoint - from ._models_py3 import CdnManagedHttpsParameters - from ._models_py3 import CdnWebApplicationFirewallPolicy - from ._models_py3 import CdnWebApplicationFirewallPolicyList - from ._models_py3 import CdnWebApplicationFirewallPolicyPatchParameters - from ._models_py3 import Certificate - from ._models_py3 import CheckNameAvailabilityInput - from ._models_py3 import CheckNameAvailabilityOutput - from ._models_py3 import CidrIpAddress - from ._models_py3 import Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems - from ._models_py3 import Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems - from ._models_py3 import ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems - from ._models_py3 import CompressionSettings - from ._models_py3 import ContinentsResponse - from ._models_py3 import ContinentsResponseContinentsItem - from ._models_py3 import ContinentsResponseCountryOrRegionsItem - from ._models_py3 import CookiesMatchConditionParameters - from ._models_py3 import CustomDomain - from ._models_py3 import CustomDomainHttpsParameters - from ._models_py3 import CustomDomainListResult - from ._models_py3 import CustomDomainParameters - from ._models_py3 import CustomRule - from ._models_py3 import CustomRuleList - from ._models_py3 import CustomerCertificate - from ._models_py3 import CustomerCertificateParameters - from ._models_py3 import DeepCreatedOrigin - from ._models_py3 import DeepCreatedOriginGroup - from ._models_py3 import DeliveryRule - from ._models_py3 import DeliveryRuleAction - from ._models_py3 import DeliveryRuleCacheExpirationAction - from ._models_py3 import DeliveryRuleCacheKeyQueryStringAction - from ._models_py3 import DeliveryRuleCondition - from ._models_py3 import DeliveryRuleCookiesCondition - from ._models_py3 import DeliveryRuleHttpVersionCondition - from ._models_py3 import DeliveryRuleIsDeviceCondition - from ._models_py3 import DeliveryRulePostArgsCondition - from ._models_py3 import DeliveryRuleQueryStringCondition - from ._models_py3 import DeliveryRuleRemoteAddressCondition - from ._models_py3 import DeliveryRuleRequestBodyCondition - from ._models_py3 import DeliveryRuleRequestHeaderAction - from ._models_py3 import DeliveryRuleRequestHeaderCondition - from ._models_py3 import DeliveryRuleRequestMethodCondition - from ._models_py3 import DeliveryRuleRequestSchemeCondition - from ._models_py3 import DeliveryRuleRequestUriCondition - from ._models_py3 import DeliveryRuleResponseHeaderAction - from ._models_py3 import DeliveryRuleUrlFileExtensionCondition - from ._models_py3 import DeliveryRuleUrlFileNameCondition - from ._models_py3 import DeliveryRuleUrlPathCondition - from ._models_py3 import DomainValidationProperties - from ._models_py3 import EdgeNode - from ._models_py3 import EdgenodeResult - from ._models_py3 import Endpoint - from ._models_py3 import EndpointListResult - from ._models_py3 import EndpointProperties - from ._models_py3 import EndpointPropertiesUpdateParameters - from ._models_py3 import EndpointPropertiesUpdateParametersDeliveryPolicy - from ._models_py3 import EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink - from ._models_py3 import EndpointUpdateParameters - from ._models_py3 import ErrorResponse - from ._models_py3 import GeoFilter - from ._models_py3 import HeaderActionParameters - from ._models_py3 import HealthProbeParameters - from ._models_py3 import HttpErrorRangeParameters - from ._models_py3 import HttpVersionMatchConditionParameters - from ._models_py3 import IpAddressGroup - from ._models_py3 import IsDeviceMatchConditionParameters - from ._models_py3 import KeyVaultCertificateSourceParameters - from ._models_py3 import KeyVaultSigningKeyParameters - from ._models_py3 import LoadBalancingSettingsParameters - from ._models_py3 import LoadParameters - from ._models_py3 import ManagedCertificate - from ._models_py3 import ManagedCertificateParameters - from ._models_py3 import ManagedRuleDefinition - 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 MetricsResponse - from ._models_py3 import MetricsResponseSeriesItem - from ._models_py3 import MetricsResponseSeriesPropertiesItemsItem - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationsListResult - from ._models_py3 import Origin - from ._models_py3 import OriginGroup - from ._models_py3 import OriginGroupListResult - from ._models_py3 import OriginGroupOverrideAction - from ._models_py3 import OriginGroupOverrideActionParameters - from ._models_py3 import OriginGroupProperties - from ._models_py3 import OriginGroupUpdateParameters - from ._models_py3 import OriginGroupUpdatePropertiesParameters - from ._models_py3 import OriginListResult - from ._models_py3 import OriginProperties - from ._models_py3 import OriginUpdateParameters - from ._models_py3 import OriginUpdatePropertiesParameters - from ._models_py3 import PolicySettings - from ._models_py3 import PostArgsMatchConditionParameters - from ._models_py3 import Profile - from ._models_py3 import ProfileListResult - from ._models_py3 import ProfileUpdateParameters - from ._models_py3 import ProxyResource - from ._models_py3 import PurgeParameters - from ._models_py3 import QueryStringMatchConditionParameters - from ._models_py3 import RankingsResponse - from ._models_py3 import RankingsResponseTablesItem - from ._models_py3 import RankingsResponseTablesPropertiesItemsItem - from ._models_py3 import RankingsResponseTablesPropertiesItemsMetricsItem - from ._models_py3 import RateLimitRule - from ._models_py3 import RateLimitRuleList - from ._models_py3 import RemoteAddressMatchConditionParameters - from ._models_py3 import RequestBodyMatchConditionParameters - from ._models_py3 import RequestHeaderMatchConditionParameters - from ._models_py3 import RequestMethodMatchConditionParameters - from ._models_py3 import RequestSchemeMatchConditionParameters - from ._models_py3 import RequestUriMatchConditionParameters - from ._models_py3 import Resource - from ._models_py3 import ResourceReference - from ._models_py3 import ResourceUsage - from ._models_py3 import ResourceUsageListResult - from ._models_py3 import ResourcesResponse - from ._models_py3 import ResourcesResponseCustomDomainsItem - from ._models_py3 import ResourcesResponseEndpointsItem - from ._models_py3 import ResourcesResponseEndpointsPropertiesItemsItem - from ._models_py3 import ResponseBasedOriginErrorDetectionParameters - from ._models_py3 import Route - from ._models_py3 import RouteListResult - from ._models_py3 import RouteProperties - from ._models_py3 import RouteUpdateParameters - from ._models_py3 import RouteUpdatePropertiesParameters - from ._models_py3 import Rule - from ._models_py3 import RuleListResult - from ._models_py3 import RuleProperties - from ._models_py3 import RuleSet - from ._models_py3 import RuleSetListResult - from ._models_py3 import RuleSetProperties - from ._models_py3 import RuleUpdateParameters - from ._models_py3 import RuleUpdatePropertiesParameters - from ._models_py3 import Secret - from ._models_py3 import SecretListResult - from ._models_py3 import SecretParameters - from ._models_py3 import SecretProperties - from ._models_py3 import SecurityPolicy - from ._models_py3 import SecurityPolicyListResult - from ._models_py3 import SecurityPolicyParameters - from ._models_py3 import SecurityPolicyProperties - from ._models_py3 import SecurityPolicyWebApplicationFirewallAssociation - from ._models_py3 import SecurityPolicyWebApplicationFirewallParameters - from ._models_py3 import SharedPrivateLinkResourceProperties - from ._models_py3 import Sku - from ._models_py3 import SsoUri - from ._models_py3 import SupportedOptimizationTypesListResult - from ._models_py3 import SystemData - from ._models_py3 import TrackedResource - from ._models_py3 import UrlFileExtensionMatchConditionParameters - from ._models_py3 import UrlFileNameMatchConditionParameters - from ._models_py3 import UrlPathMatchConditionParameters - from ._models_py3 import UrlRedirectAction - from ._models_py3 import UrlRedirectActionParameters - from ._models_py3 import UrlRewriteAction - from ._models_py3 import UrlRewriteActionParameters - from ._models_py3 import UrlSigningAction - from ._models_py3 import UrlSigningActionParameters - from ._models_py3 import UrlSigningKey - from ._models_py3 import UrlSigningKeyParameters - from ._models_py3 import UrlSigningParamIdentifier - from ._models_py3 import Usage - from ._models_py3 import UsageName - from ._models_py3 import UsagesListResult - from ._models_py3 import UserManagedHttpsParameters - from ._models_py3 import ValidateCustomDomainInput - from ._models_py3 import ValidateCustomDomainOutput - from ._models_py3 import ValidateProbeInput - from ._models_py3 import ValidateProbeOutput - from ._models_py3 import ValidateSecretInput - from ._models_py3 import ValidateSecretOutput - from ._models_py3 import ValidationToken - from ._models_py3 import WafMetricsResponse - from ._models_py3 import WafMetricsResponseSeriesItem - from ._models_py3 import WafMetricsResponseSeriesPropertiesItemsItem - from ._models_py3 import WafRankingsResponse - from ._models_py3 import WafRankingsResponseDataItem -except (SyntaxError, ImportError): - from ._models import AFDDomain # type: ignore - from ._models import AFDDomainHttpsParameters # type: ignore - from ._models import AFDDomainListResult # type: ignore - from ._models import AFDDomainProperties # type: ignore - from ._models import AFDDomainUpdateParameters # type: ignore - from ._models import AFDDomainUpdatePropertiesParameters # type: ignore - from ._models import AFDEndpoint # type: ignore - from ._models import AFDEndpointListResult # type: ignore - from ._models import AFDEndpointProperties # type: ignore - from ._models import AFDEndpointPropertiesUpdateParameters # type: ignore - from ._models import AFDEndpointUpdateParameters # type: ignore - from ._models import AFDOrigin # type: ignore - from ._models import AFDOriginGroup # type: ignore - from ._models import AFDOriginGroupListResult # type: ignore - from ._models import AFDOriginGroupProperties # type: ignore - from ._models import AFDOriginGroupUpdateParameters # type: ignore - from ._models import AFDOriginGroupUpdatePropertiesParameters # type: ignore - from ._models import AFDOriginListResult # type: ignore - from ._models import AFDOriginProperties # type: ignore - from ._models import AFDOriginUpdateParameters # type: ignore - from ._models import AFDOriginUpdatePropertiesParameters # type: ignore - from ._models import AFDStateProperties # type: ignore - from ._models import AfdErrorResponse # type: ignore - from ._models import AfdPurgeParameters # type: ignore - from ._models import CacheExpirationActionParameters # type: ignore - from ._models import CacheKeyQueryStringActionParameters # type: ignore - from ._models import CdnCertificateSourceParameters # type: ignore - from ._models import CdnEndpoint # type: ignore - from ._models import CdnManagedHttpsParameters # type: ignore - from ._models import CdnWebApplicationFirewallPolicy # type: ignore - from ._models import CdnWebApplicationFirewallPolicyList # type: ignore - from ._models import CdnWebApplicationFirewallPolicyPatchParameters # type: ignore - from ._models import Certificate # type: ignore - from ._models import CheckNameAvailabilityInput # type: ignore - from ._models import CheckNameAvailabilityOutput # type: ignore - from ._models import CidrIpAddress # type: ignore - from ._models import Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems # type: ignore - from ._models import Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems # type: ignore - from ._models import ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems # type: ignore - from ._models import CompressionSettings # type: ignore - from ._models import ContinentsResponse # type: ignore - from ._models import ContinentsResponseContinentsItem # type: ignore - from ._models import ContinentsResponseCountryOrRegionsItem # type: ignore - from ._models import CookiesMatchConditionParameters # type: ignore - from ._models import CustomDomain # type: ignore - from ._models import CustomDomainHttpsParameters # type: ignore - from ._models import CustomDomainListResult # type: ignore - from ._models import CustomDomainParameters # type: ignore - from ._models import CustomRule # type: ignore - from ._models import CustomRuleList # type: ignore - from ._models import CustomerCertificate # type: ignore - from ._models import CustomerCertificateParameters # type: ignore - from ._models import DeepCreatedOrigin # type: ignore - from ._models import DeepCreatedOriginGroup # type: ignore - from ._models import DeliveryRule # type: ignore - from ._models import DeliveryRuleAction # type: ignore - from ._models import DeliveryRuleCacheExpirationAction # type: ignore - from ._models import DeliveryRuleCacheKeyQueryStringAction # type: ignore - from ._models import DeliveryRuleCondition # type: ignore - from ._models import DeliveryRuleCookiesCondition # type: ignore - from ._models import DeliveryRuleHttpVersionCondition # type: ignore - from ._models import DeliveryRuleIsDeviceCondition # type: ignore - from ._models import DeliveryRulePostArgsCondition # type: ignore - from ._models import DeliveryRuleQueryStringCondition # type: ignore - from ._models import DeliveryRuleRemoteAddressCondition # type: ignore - from ._models import DeliveryRuleRequestBodyCondition # type: ignore - from ._models import DeliveryRuleRequestHeaderAction # type: ignore - from ._models import DeliveryRuleRequestHeaderCondition # type: ignore - from ._models import DeliveryRuleRequestMethodCondition # type: ignore - from ._models import DeliveryRuleRequestSchemeCondition # type: ignore - from ._models import DeliveryRuleRequestUriCondition # type: ignore - from ._models import DeliveryRuleResponseHeaderAction # type: ignore - from ._models import DeliveryRuleUrlFileExtensionCondition # type: ignore - from ._models import DeliveryRuleUrlFileNameCondition # type: ignore - from ._models import DeliveryRuleUrlPathCondition # type: ignore - from ._models import DomainValidationProperties # type: ignore - from ._models import EdgeNode # type: ignore - from ._models import EdgenodeResult # type: ignore - from ._models import Endpoint # type: ignore - from ._models import EndpointListResult # type: ignore - from ._models import EndpointProperties # type: ignore - from ._models import EndpointPropertiesUpdateParameters # type: ignore - from ._models import EndpointPropertiesUpdateParametersDeliveryPolicy # type: ignore - from ._models import EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink # type: ignore - from ._models import EndpointUpdateParameters # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import GeoFilter # type: ignore - from ._models import HeaderActionParameters # type: ignore - from ._models import HealthProbeParameters # type: ignore - from ._models import HttpErrorRangeParameters # type: ignore - from ._models import HttpVersionMatchConditionParameters # type: ignore - from ._models import IpAddressGroup # type: ignore - from ._models import IsDeviceMatchConditionParameters # type: ignore - from ._models import KeyVaultCertificateSourceParameters # type: ignore - from ._models import KeyVaultSigningKeyParameters # type: ignore - from ._models import LoadBalancingSettingsParameters # type: ignore - from ._models import LoadParameters # type: ignore - from ._models import ManagedCertificate # type: ignore - from ._models import ManagedCertificateParameters # type: ignore - from ._models import ManagedRuleDefinition # 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 MetricsResponse # type: ignore - from ._models import MetricsResponseSeriesItem # type: ignore - from ._models import MetricsResponseSeriesPropertiesItemsItem # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationsListResult # type: ignore - from ._models import Origin # type: ignore - from ._models import OriginGroup # type: ignore - from ._models import OriginGroupListResult # type: ignore - from ._models import OriginGroupOverrideAction # type: ignore - from ._models import OriginGroupOverrideActionParameters # type: ignore - from ._models import OriginGroupProperties # type: ignore - from ._models import OriginGroupUpdateParameters # type: ignore - from ._models import OriginGroupUpdatePropertiesParameters # type: ignore - from ._models import OriginListResult # type: ignore - from ._models import OriginProperties # type: ignore - from ._models import OriginUpdateParameters # type: ignore - from ._models import OriginUpdatePropertiesParameters # type: ignore - from ._models import PolicySettings # type: ignore - from ._models import PostArgsMatchConditionParameters # type: ignore - from ._models import Profile # type: ignore - from ._models import ProfileListResult # type: ignore - from ._models import ProfileUpdateParameters # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import PurgeParameters # type: ignore - from ._models import QueryStringMatchConditionParameters # type: ignore - from ._models import RankingsResponse # type: ignore - from ._models import RankingsResponseTablesItem # type: ignore - from ._models import RankingsResponseTablesPropertiesItemsItem # type: ignore - from ._models import RankingsResponseTablesPropertiesItemsMetricsItem # type: ignore - from ._models import RateLimitRule # type: ignore - from ._models import RateLimitRuleList # type: ignore - from ._models import RemoteAddressMatchConditionParameters # type: ignore - from ._models import RequestBodyMatchConditionParameters # type: ignore - from ._models import RequestHeaderMatchConditionParameters # type: ignore - from ._models import RequestMethodMatchConditionParameters # type: ignore - from ._models import RequestSchemeMatchConditionParameters # type: ignore - from ._models import RequestUriMatchConditionParameters # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceReference # type: ignore - from ._models import ResourceUsage # type: ignore - from ._models import ResourceUsageListResult # type: ignore - from ._models import ResourcesResponse # type: ignore - from ._models import ResourcesResponseCustomDomainsItem # type: ignore - from ._models import ResourcesResponseEndpointsItem # type: ignore - from ._models import ResourcesResponseEndpointsPropertiesItemsItem # type: ignore - from ._models import ResponseBasedOriginErrorDetectionParameters # type: ignore - from ._models import Route # type: ignore - from ._models import RouteListResult # type: ignore - from ._models import RouteProperties # type: ignore - from ._models import RouteUpdateParameters # type: ignore - from ._models import RouteUpdatePropertiesParameters # type: ignore - from ._models import Rule # type: ignore - from ._models import RuleListResult # type: ignore - from ._models import RuleProperties # type: ignore - from ._models import RuleSet # type: ignore - from ._models import RuleSetListResult # type: ignore - from ._models import RuleSetProperties # type: ignore - from ._models import RuleUpdateParameters # type: ignore - from ._models import RuleUpdatePropertiesParameters # type: ignore - from ._models import Secret # type: ignore - from ._models import SecretListResult # type: ignore - from ._models import SecretParameters # type: ignore - from ._models import SecretProperties # type: ignore - from ._models import SecurityPolicy # type: ignore - from ._models import SecurityPolicyListResult # type: ignore - from ._models import SecurityPolicyParameters # type: ignore - from ._models import SecurityPolicyProperties # type: ignore - from ._models import SecurityPolicyWebApplicationFirewallAssociation # type: ignore - from ._models import SecurityPolicyWebApplicationFirewallParameters # type: ignore - from ._models import SharedPrivateLinkResourceProperties # type: ignore - from ._models import Sku # type: ignore - from ._models import SsoUri # type: ignore - from ._models import SupportedOptimizationTypesListResult # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UrlFileExtensionMatchConditionParameters # type: ignore - from ._models import UrlFileNameMatchConditionParameters # type: ignore - from ._models import UrlPathMatchConditionParameters # type: ignore - from ._models import UrlRedirectAction # type: ignore - from ._models import UrlRedirectActionParameters # type: ignore - from ._models import UrlRewriteAction # type: ignore - from ._models import UrlRewriteActionParameters # type: ignore - from ._models import UrlSigningAction # type: ignore - from ._models import UrlSigningActionParameters # type: ignore - from ._models import UrlSigningKey # type: ignore - from ._models import UrlSigningKeyParameters # type: ignore - from ._models import UrlSigningParamIdentifier # type: ignore - from ._models import Usage # type: ignore - from ._models import UsageName # type: ignore - from ._models import UsagesListResult # type: ignore - from ._models import UserManagedHttpsParameters # type: ignore - from ._models import ValidateCustomDomainInput # type: ignore - from ._models import ValidateCustomDomainOutput # type: ignore - from ._models import ValidateProbeInput # type: ignore - from ._models import ValidateProbeOutput # type: ignore - from ._models import ValidateSecretInput # type: ignore - from ._models import ValidateSecretOutput # type: ignore - from ._models import ValidationToken # type: ignore - from ._models import WafMetricsResponse # type: ignore - from ._models import WafMetricsResponseSeriesItem # type: ignore - from ._models import WafMetricsResponseSeriesPropertiesItemsItem # type: ignore - from ._models import WafRankingsResponse # type: ignore - from ._models import WafRankingsResponseDataItem # type: ignore +from ._models_py3 import AFDDomain +from ._models_py3 import AFDDomainHttpsParameters +from ._models_py3 import AFDDomainListResult +from ._models_py3 import AFDDomainProperties +from ._models_py3 import AFDDomainUpdateParameters +from ._models_py3 import AFDDomainUpdatePropertiesParameters +from ._models_py3 import AFDEndpoint +from ._models_py3 import AFDEndpointListResult +from ._models_py3 import AFDEndpointProperties +from ._models_py3 import AFDEndpointPropertiesUpdateParameters +from ._models_py3 import AFDEndpointUpdateParameters +from ._models_py3 import AFDOrigin +from ._models_py3 import AFDOriginGroup +from ._models_py3 import AFDOriginGroupListResult +from ._models_py3 import AFDOriginGroupProperties +from ._models_py3 import AFDOriginGroupUpdateParameters +from ._models_py3 import AFDOriginGroupUpdatePropertiesParameters +from ._models_py3 import AFDOriginListResult +from ._models_py3 import AFDOriginProperties +from ._models_py3 import AFDOriginUpdateParameters +from ._models_py3 import AFDOriginUpdatePropertiesParameters +from ._models_py3 import AFDStateProperties +from ._models_py3 import ActivatedResourceReference +from ._models_py3 import AfdErrorResponse +from ._models_py3 import AfdPurgeParameters +from ._models_py3 import AfdRouteCacheConfiguration +from ._models_py3 import AzureFirstPartyManagedCertificate +from ._models_py3 import AzureFirstPartyManagedCertificateParameters +from ._models_py3 import CacheConfiguration +from ._models_py3 import CacheExpirationActionParameters +from ._models_py3 import CacheKeyQueryStringActionParameters +from ._models_py3 import CdnCertificateSourceParameters +from ._models_py3 import CdnEndpoint +from ._models_py3 import CdnManagedHttpsParameters +from ._models_py3 import CdnWebApplicationFirewallPolicy +from ._models_py3 import CdnWebApplicationFirewallPolicyList +from ._models_py3 import CdnWebApplicationFirewallPolicyPatchParameters +from ._models_py3 import Certificate +from ._models_py3 import CheckEndpointNameAvailabilityInput +from ._models_py3 import CheckEndpointNameAvailabilityOutput +from ._models_py3 import CheckHostNameAvailabilityInput +from ._models_py3 import CheckNameAvailabilityInput +from ._models_py3 import CheckNameAvailabilityOutput +from ._models_py3 import CidrIpAddress +from ._models_py3 import ClientPortMatchConditionParameters +from ._models_py3 import Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems +from ._models_py3 import Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems +from ._models_py3 import ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems +from ._models_py3 import CompressionSettings +from ._models_py3 import ContinentsResponse +from ._models_py3 import ContinentsResponseContinentsItem +from ._models_py3 import ContinentsResponseCountryOrRegionsItem +from ._models_py3 import CookiesMatchConditionParameters +from ._models_py3 import CustomDomain +from ._models_py3 import CustomDomainHttpsParameters +from ._models_py3 import CustomDomainListResult +from ._models_py3 import CustomDomainParameters +from ._models_py3 import CustomRule +from ._models_py3 import CustomRuleList +from ._models_py3 import CustomerCertificate +from ._models_py3 import CustomerCertificateParameters +from ._models_py3 import DeepCreatedOrigin +from ._models_py3 import DeepCreatedOriginGroup +from ._models_py3 import DeliveryRule +from ._models_py3 import DeliveryRuleAction +from ._models_py3 import DeliveryRuleCacheExpirationAction +from ._models_py3 import DeliveryRuleCacheKeyQueryStringAction +from ._models_py3 import DeliveryRuleClientPortCondition +from ._models_py3 import DeliveryRuleCondition +from ._models_py3 import DeliveryRuleCookiesCondition +from ._models_py3 import DeliveryRuleHostNameCondition +from ._models_py3 import DeliveryRuleHttpVersionCondition +from ._models_py3 import DeliveryRuleIsDeviceCondition +from ._models_py3 import DeliveryRulePostArgsCondition +from ._models_py3 import DeliveryRuleQueryStringCondition +from ._models_py3 import DeliveryRuleRemoteAddressCondition +from ._models_py3 import DeliveryRuleRequestBodyCondition +from ._models_py3 import DeliveryRuleRequestHeaderAction +from ._models_py3 import DeliveryRuleRequestHeaderCondition +from ._models_py3 import DeliveryRuleRequestMethodCondition +from ._models_py3 import DeliveryRuleRequestSchemeCondition +from ._models_py3 import DeliveryRuleRequestUriCondition +from ._models_py3 import DeliveryRuleResponseHeaderAction +from ._models_py3 import DeliveryRuleRouteConfigurationOverrideAction +from ._models_py3 import DeliveryRuleServerPortCondition +from ._models_py3 import DeliveryRuleSocketAddrCondition +from ._models_py3 import DeliveryRuleSslProtocolCondition +from ._models_py3 import DeliveryRuleUrlFileExtensionCondition +from ._models_py3 import DeliveryRuleUrlFileNameCondition +from ._models_py3 import DeliveryRuleUrlPathCondition +from ._models_py3 import DimensionProperties +from ._models_py3 import DomainValidationProperties +from ._models_py3 import EdgeNode +from ._models_py3 import EdgenodeResult +from ._models_py3 import Endpoint +from ._models_py3 import EndpointListResult +from ._models_py3 import EndpointProperties +from ._models_py3 import EndpointPropertiesUpdateParameters +from ._models_py3 import EndpointPropertiesUpdateParametersDeliveryPolicy +from ._models_py3 import EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink +from ._models_py3 import EndpointUpdateParameters +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import GeoFilter +from ._models_py3 import HeaderActionParameters +from ._models_py3 import HealthProbeParameters +from ._models_py3 import HostNameMatchConditionParameters +from ._models_py3 import HttpErrorRangeParameters +from ._models_py3 import HttpVersionMatchConditionParameters +from ._models_py3 import IpAddressGroup +from ._models_py3 import IsDeviceMatchConditionParameters +from ._models_py3 import KeyVaultCertificateSourceParameters +from ._models_py3 import KeyVaultSigningKeyParameters +from ._models_py3 import LoadBalancingSettingsParameters +from ._models_py3 import LoadParameters +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedCertificate +from ._models_py3 import ManagedCertificateParameters +from ._models_py3 import ManagedRuleDefinition +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 ManagedServiceIdentity +from ._models_py3 import MatchCondition +from ._models_py3 import MetricAvailability +from ._models_py3 import MetricSpecification +from ._models_py3 import MetricsResponse +from ._models_py3 import MetricsResponseSeriesItem +from ._models_py3 import MetricsResponseSeriesPropertiesItemsItem +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationsListResult +from ._models_py3 import Origin +from ._models_py3 import OriginGroup +from ._models_py3 import OriginGroupListResult +from ._models_py3 import OriginGroupOverride +from ._models_py3 import OriginGroupOverrideAction +from ._models_py3 import OriginGroupOverrideActionParameters +from ._models_py3 import OriginGroupProperties +from ._models_py3 import OriginGroupUpdateParameters +from ._models_py3 import OriginGroupUpdatePropertiesParameters +from ._models_py3 import OriginListResult +from ._models_py3 import OriginProperties +from ._models_py3 import OriginUpdateParameters +from ._models_py3 import OriginUpdatePropertiesParameters +from ._models_py3 import PolicySettings +from ._models_py3 import PostArgsMatchConditionParameters +from ._models_py3 import Profile +from ._models_py3 import ProfileListResult +from ._models_py3 import ProfileUpdateParameters +from ._models_py3 import ProxyResource +from ._models_py3 import PurgeParameters +from ._models_py3 import QueryStringMatchConditionParameters +from ._models_py3 import RankingsResponse +from ._models_py3 import RankingsResponseTablesItem +from ._models_py3 import RankingsResponseTablesPropertiesItemsItem +from ._models_py3 import RankingsResponseTablesPropertiesItemsMetricsItem +from ._models_py3 import RateLimitRule +from ._models_py3 import RateLimitRuleList +from ._models_py3 import RemoteAddressMatchConditionParameters +from ._models_py3 import RequestBodyMatchConditionParameters +from ._models_py3 import RequestHeaderMatchConditionParameters +from ._models_py3 import RequestMethodMatchConditionParameters +from ._models_py3 import RequestSchemeMatchConditionParameters +from ._models_py3 import RequestUriMatchConditionParameters +from ._models_py3 import Resource +from ._models_py3 import ResourceReference +from ._models_py3 import ResourceUsage +from ._models_py3 import ResourceUsageListResult +from ._models_py3 import ResourcesResponse +from ._models_py3 import ResourcesResponseCustomDomainsItem +from ._models_py3 import ResourcesResponseEndpointsItem +from ._models_py3 import ResourcesResponseEndpointsPropertiesItemsItem +from ._models_py3 import ResponseBasedOriginErrorDetectionParameters +from ._models_py3 import Route +from ._models_py3 import RouteConfigurationOverrideActionParameters +from ._models_py3 import RouteListResult +from ._models_py3 import RouteProperties +from ._models_py3 import RouteUpdateParameters +from ._models_py3 import RouteUpdatePropertiesParameters +from ._models_py3 import Rule +from ._models_py3 import RuleListResult +from ._models_py3 import RuleProperties +from ._models_py3 import RuleSet +from ._models_py3 import RuleSetListResult +from ._models_py3 import RuleSetProperties +from ._models_py3 import RuleUpdateParameters +from ._models_py3 import RuleUpdatePropertiesParameters +from ._models_py3 import Secret +from ._models_py3 import SecretListResult +from ._models_py3 import SecretParameters +from ._models_py3 import SecretProperties +from ._models_py3 import SecurityPolicy +from ._models_py3 import SecurityPolicyListResult +from ._models_py3 import SecurityPolicyProperties +from ._models_py3 import SecurityPolicyPropertiesParameters +from ._models_py3 import SecurityPolicyUpdateParameters +from ._models_py3 import SecurityPolicyWebApplicationFirewallAssociation +from ._models_py3 import SecurityPolicyWebApplicationFirewallParameters +from ._models_py3 import ServerPortMatchConditionParameters +from ._models_py3 import ServiceSpecification +from ._models_py3 import SharedPrivateLinkResourceProperties +from ._models_py3 import Sku +from ._models_py3 import SocketAddrMatchConditionParameters +from ._models_py3 import SslProtocolMatchConditionParameters +from ._models_py3 import SsoUri +from ._models_py3 import SupportedOptimizationTypesListResult +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UrlFileExtensionMatchConditionParameters +from ._models_py3 import UrlFileNameMatchConditionParameters +from ._models_py3 import UrlPathMatchConditionParameters +from ._models_py3 import UrlRedirectAction +from ._models_py3 import UrlRedirectActionParameters +from ._models_py3 import UrlRewriteAction +from ._models_py3 import UrlRewriteActionParameters +from ._models_py3 import UrlSigningAction +from ._models_py3 import UrlSigningActionParameters +from ._models_py3 import UrlSigningKey +from ._models_py3 import UrlSigningKeyParameters +from ._models_py3 import UrlSigningParamIdentifier +from ._models_py3 import Usage +from ._models_py3 import UsageName +from ._models_py3 import UsagesListResult +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserManagedHttpsParameters +from ._models_py3 import ValidateCustomDomainInput +from ._models_py3 import ValidateCustomDomainOutput +from ._models_py3 import ValidateProbeInput +from ._models_py3 import ValidateProbeOutput +from ._models_py3 import ValidateSecretInput +from ._models_py3 import ValidateSecretOutput +from ._models_py3 import ValidationToken +from ._models_py3 import WafMetricsResponse +from ._models_py3 import WafMetricsResponseSeriesItem +from ._models_py3 import WafMetricsResponseSeriesPropertiesItemsItem +from ._models_py3 import WafRankingsResponse +from ._models_py3 import WafRankingsResponseDataItem + from ._cdn_management_client_enums import ( AFDEndpointProtocols, @@ -441,10 +259,12 @@ AfdProvisioningState, AfdQueryStringCachingBehavior, Algorithm, + AutoGeneratedDomainNameLabelScope, CacheBehavior, CacheType, CertificateSource, CertificateType, + ClientPortOperator, CookiesOperator, CustomDomainResourceState, CustomHttpsProvisioningState, @@ -457,11 +277,11 @@ DomainValidationState, EnabledState, EndpointResourceState, - Enum46, ForwardingProtocol, GeoFilterActions, HeaderAction, HealthProbeRequestType, + HostNameOperator, HttpVersionOperator, HttpsRedirect, IdentityType, @@ -474,6 +294,7 @@ LogRanking, LogRankingMetric, ManagedRuleEnabledState, + ManagedServiceIdentityType, MatchProcessingBehavior, MatchVariable, MetricsResponseGranularity, @@ -487,6 +308,7 @@ PolicyEnabledState, PolicyMode, PolicyResourceState, + PolicySettingsDefaultCustomBlockResponseStatusCode, PostArgsOperator, PrivateEndpointStatus, ProbeProtocol, @@ -504,11 +326,19 @@ RequestMethodOperator, RequestSchemeMatchConditionParametersMatchValuesItem, RequestUriOperator, + ResourceType, ResponseBasedDetectedErrorTypes, + RuleCacheBehavior, + RuleIsCompressionEnabled, + RuleQueryStringCachingBehavior, SecretType, SecurityPolicyType, + ServerPortOperator, SharedPrivateLinkResourceStatus, SkuName, + SocketAddrOperator, + SslProtocol, + SslProtocolOperator, Status, Transform, TransformType, @@ -517,9 +347,9 @@ UrlFileNameOperator, UrlPathOperator, UsageUnit, - ValidateSecretType, WafAction, WafGranularity, + WafMatchVariable, WafMetric, WafMetricsResponseGranularity, WafRankingGroupBy, @@ -550,8 +380,13 @@ 'AFDOriginUpdateParameters', 'AFDOriginUpdatePropertiesParameters', 'AFDStateProperties', + 'ActivatedResourceReference', 'AfdErrorResponse', 'AfdPurgeParameters', + 'AfdRouteCacheConfiguration', + 'AzureFirstPartyManagedCertificate', + 'AzureFirstPartyManagedCertificateParameters', + 'CacheConfiguration', 'CacheExpirationActionParameters', 'CacheKeyQueryStringActionParameters', 'CdnCertificateSourceParameters', @@ -561,9 +396,13 @@ 'CdnWebApplicationFirewallPolicyList', 'CdnWebApplicationFirewallPolicyPatchParameters', 'Certificate', + 'CheckEndpointNameAvailabilityInput', + 'CheckEndpointNameAvailabilityOutput', + 'CheckHostNameAvailabilityInput', 'CheckNameAvailabilityInput', 'CheckNameAvailabilityOutput', 'CidrIpAddress', + 'ClientPortMatchConditionParameters', 'Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems', 'Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems', 'ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems', @@ -586,8 +425,10 @@ 'DeliveryRuleAction', 'DeliveryRuleCacheExpirationAction', 'DeliveryRuleCacheKeyQueryStringAction', + 'DeliveryRuleClientPortCondition', 'DeliveryRuleCondition', 'DeliveryRuleCookiesCondition', + 'DeliveryRuleHostNameCondition', 'DeliveryRuleHttpVersionCondition', 'DeliveryRuleIsDeviceCondition', 'DeliveryRulePostArgsCondition', @@ -600,9 +441,14 @@ 'DeliveryRuleRequestSchemeCondition', 'DeliveryRuleRequestUriCondition', 'DeliveryRuleResponseHeaderAction', + 'DeliveryRuleRouteConfigurationOverrideAction', + 'DeliveryRuleServerPortCondition', + 'DeliveryRuleSocketAddrCondition', + 'DeliveryRuleSslProtocolCondition', 'DeliveryRuleUrlFileExtensionCondition', 'DeliveryRuleUrlFileNameCondition', 'DeliveryRuleUrlPathCondition', + 'DimensionProperties', 'DomainValidationProperties', 'EdgeNode', 'EdgenodeResult', @@ -613,10 +459,13 @@ 'EndpointPropertiesUpdateParametersDeliveryPolicy', 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink', 'EndpointUpdateParameters', + 'ErrorAdditionalInfo', + 'ErrorDetail', 'ErrorResponse', 'GeoFilter', 'HeaderActionParameters', 'HealthProbeParameters', + 'HostNameMatchConditionParameters', 'HttpErrorRangeParameters', 'HttpVersionMatchConditionParameters', 'IpAddressGroup', @@ -625,6 +474,7 @@ 'KeyVaultSigningKeyParameters', 'LoadBalancingSettingsParameters', 'LoadParameters', + 'LogSpecification', 'ManagedCertificate', 'ManagedCertificateParameters', 'ManagedRuleDefinition', @@ -635,7 +485,10 @@ 'ManagedRuleSetDefinition', 'ManagedRuleSetDefinitionList', 'ManagedRuleSetList', + 'ManagedServiceIdentity', 'MatchCondition', + 'MetricAvailability', + 'MetricSpecification', 'MetricsResponse', 'MetricsResponseSeriesItem', 'MetricsResponseSeriesPropertiesItemsItem', @@ -645,6 +498,7 @@ 'Origin', 'OriginGroup', 'OriginGroupListResult', + 'OriginGroupOverride', 'OriginGroupOverrideAction', 'OriginGroupOverrideActionParameters', 'OriginGroupProperties', @@ -684,6 +538,7 @@ 'ResourcesResponseEndpointsPropertiesItemsItem', 'ResponseBasedOriginErrorDetectionParameters', 'Route', + 'RouteConfigurationOverrideActionParameters', 'RouteListResult', 'RouteProperties', 'RouteUpdateParameters', @@ -702,12 +557,17 @@ 'SecretProperties', 'SecurityPolicy', 'SecurityPolicyListResult', - 'SecurityPolicyParameters', 'SecurityPolicyProperties', + 'SecurityPolicyPropertiesParameters', + 'SecurityPolicyUpdateParameters', 'SecurityPolicyWebApplicationFirewallAssociation', 'SecurityPolicyWebApplicationFirewallParameters', + 'ServerPortMatchConditionParameters', + 'ServiceSpecification', 'SharedPrivateLinkResourceProperties', 'Sku', + 'SocketAddrMatchConditionParameters', + 'SslProtocolMatchConditionParameters', 'SsoUri', 'SupportedOptimizationTypesListResult', 'SystemData', @@ -727,6 +587,7 @@ 'Usage', 'UsageName', 'UsagesListResult', + 'UserAssignedIdentity', 'UserManagedHttpsParameters', 'ValidateCustomDomainInput', 'ValidateCustomDomainOutput', @@ -747,10 +608,12 @@ 'AfdProvisioningState', 'AfdQueryStringCachingBehavior', 'Algorithm', + 'AutoGeneratedDomainNameLabelScope', 'CacheBehavior', 'CacheType', 'CertificateSource', 'CertificateType', + 'ClientPortOperator', 'CookiesOperator', 'CustomDomainResourceState', 'CustomHttpsProvisioningState', @@ -763,11 +626,11 @@ 'DomainValidationState', 'EnabledState', 'EndpointResourceState', - 'Enum46', 'ForwardingProtocol', 'GeoFilterActions', 'HeaderAction', 'HealthProbeRequestType', + 'HostNameOperator', 'HttpVersionOperator', 'HttpsRedirect', 'IdentityType', @@ -780,6 +643,7 @@ 'LogRanking', 'LogRankingMetric', 'ManagedRuleEnabledState', + 'ManagedServiceIdentityType', 'MatchProcessingBehavior', 'MatchVariable', 'MetricsResponseGranularity', @@ -793,6 +657,7 @@ 'PolicyEnabledState', 'PolicyMode', 'PolicyResourceState', + 'PolicySettingsDefaultCustomBlockResponseStatusCode', 'PostArgsOperator', 'PrivateEndpointStatus', 'ProbeProtocol', @@ -810,11 +675,19 @@ 'RequestMethodOperator', 'RequestSchemeMatchConditionParametersMatchValuesItem', 'RequestUriOperator', + 'ResourceType', 'ResponseBasedDetectedErrorTypes', + 'RuleCacheBehavior', + 'RuleIsCompressionEnabled', + 'RuleQueryStringCachingBehavior', 'SecretType', 'SecurityPolicyType', + 'ServerPortOperator', 'SharedPrivateLinkResourceStatus', 'SkuName', + 'SocketAddrOperator', + 'SslProtocol', + 'SslProtocolOperator', 'Status', 'Transform', 'TransformType', @@ -823,9 +696,9 @@ 'UrlFileNameOperator', 'UrlPathOperator', 'UsageUnit', - 'ValidateSecretType', 'WafAction', 'WafGranularity', + 'WafMatchVariable', 'WafMetric', 'WafMetricsResponseGranularity', 'WafRankingGroupBy', diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_cdn_management_client_enums.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_cdn_management_client_enums.py index eda9072cd6d8..4921f9c8ad55 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_cdn_management_client_enums.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_cdn_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,29 @@ class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LOG = "Log" REDIRECT = "Redirect" -class AfdCertificateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AfdCertificateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines the source of the SSL certificate. """ CUSTOMER_CERTIFICATE = "CustomerCertificate" MANAGED_CERTIFICATE = "ManagedCertificate" + AZURE_FIRST_PARTY_MANAGED_CERTIFICATE = "AzureFirstPartyManagedCertificate" -class AFDEndpointProtocols(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AFDEndpointProtocols(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Supported protocols for the customer's endpoint. """ HTTP = "Http" HTTPS = "Https" -class AfdMinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AfdMinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """TLS protocol version that will be used for Https """ TLS10 = "TLS10" TLS12 = "TLS12" -class AfdProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AfdProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning status """ @@ -66,23 +52,33 @@ class AfdProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETING = "Deleting" CREATING = "Creating" -class AfdQueryStringCachingBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Defines how CDN caches requests that include query strings. You can ignore any query strings - when caching, bypass caching to prevent requests that contain query strings from being cached, - or cache every request with a unique URL. +class AfdQueryStringCachingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines how Frontdoor caches requests that include query strings. You can ignore any query + strings when caching, ignore specific query strings, cache every request with a unique URL, or + cache specific query strings. """ IGNORE_QUERY_STRING = "IgnoreQueryString" USE_QUERY_STRING = "UseQueryString" - NOT_SET = "NotSet" + IGNORE_SPECIFIED_QUERY_STRINGS = "IgnoreSpecifiedQueryStrings" + INCLUDE_SPECIFIED_QUERY_STRINGS = "IncludeSpecifiedQueryStrings" -class Algorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Algorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Algorithm to use for URL signing """ SHA256 = "SHA256" -class CacheBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AutoGeneratedDomainNameLabelScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates the endpoint name reuse scope. The default value is TenantReuse. + """ + + TENANT_REUSE = "TenantReuse" + SUBSCRIPTION_REUSE = "SubscriptionReuse" + RESOURCE_GROUP_REUSE = "ResourceGroupReuse" + NO_REUSE = "NoReuse" + +class CacheBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Caching behavior for the requests """ @@ -90,27 +86,27 @@ class CacheBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): OVERRIDE = "Override" SET_IF_MISSING = "SetIfMissing" -class CacheType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CacheType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level at which the content needs to be cached. """ ALL = "All" -class CertificateSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines the source of the SSL certificate. """ AZURE_KEY_VAULT = "AzureKeyVault" CDN = "Cdn" -class CertificateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of certificate used """ SHARED = "Shared" DEDICATED = "Dedicated" -class CookiesOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClientPortOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -125,7 +121,22 @@ class CookiesOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class CustomDomainResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CookiesOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Describes operator to be matched + """ + + ANY = "Any" + EQUAL = "Equal" + CONTAINS = "Contains" + BEGINS_WITH = "BeginsWith" + ENDS_WITH = "EndsWith" + LESS_THAN = "LessThan" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" + GREATER_THAN = "GreaterThan" + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + REG_EX = "RegEx" + +class CustomDomainResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource status of the custom domain. """ @@ -133,7 +144,7 @@ class CustomDomainResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, En ACTIVE = "Active" DELETING = "Deleting" -class CustomHttpsProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CustomHttpsProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning status of Custom Https of the custom domain. """ @@ -143,7 +154,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. """ @@ -159,7 +170,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. """ @@ -167,13 +178,13 @@ class CustomRuleEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) DISABLED = "Disabled" ENABLED = "Enabled" -class DeleteRule(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeleteRule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes the action that shall be taken when the certificate is removed from Key Vault. """ NO_ACTION = "NoAction" -class DeliveryRuleActionEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeliveryRuleActionEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The name of the action for the delivery rule. """ @@ -185,15 +196,16 @@ class DeliveryRuleActionEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) URL_REWRITE = "UrlRewrite" URL_SIGNING = "UrlSigning" ORIGIN_GROUP_OVERRIDE = "OriginGroupOverride" + ROUTE_CONFIGURATION_OVERRIDE = "RouteConfigurationOverride" -class DeploymentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NOT_STARTED = "NotStarted" IN_PROGRESS = "InProgress" SUCCEEDED = "Succeeded" FAILED = "Failed" -class DestinationProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DestinationProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Protocol to use for the redirect. The default value is MatchRequest """ @@ -201,7 +213,7 @@ class DestinationProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class DomainValidationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DomainValidationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. DCV stands for DomainControlValidation. """ @@ -209,18 +221,19 @@ class DomainValidationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) UNKNOWN = "Unknown" SUBMITTING = "Submitting" PENDING = "Pending" + REJECTED = "Rejected" TIMED_OUT = "TimedOut" PENDING_REVALIDATION = "PendingRevalidation" APPROVED = "Approved" -class EnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled' """ ENABLED = "Enabled" DISABLED = "Disabled" -class EndpointResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EndpointResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource status of the endpoint. """ @@ -231,18 +244,7 @@ class EndpointResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) STOPPED = "Stopped" STOPPING = "Stopping" -class Enum46(with_metaclass(_CaseInsensitiveEnumMeta, int, Enum)): - """If the action type is block, this field defines the default customer overridable http response - status code. - """ - - TWO_HUNDRED = 200 - FOUR_HUNDRED_THREE = 403 - FOUR_HUNDRED_FIVE = 405 - FOUR_HUNDRED_SIX = 406 - FOUR_HUNDRED_TWENTY_NINE = 429 - -class ForwardingProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ForwardingProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Protocol this rule will use when forwarding traffic to backends. """ @@ -250,14 +252,14 @@ class ForwardingProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTPS_ONLY = "HttpsOnly" MATCH_REQUEST = "MatchRequest" -class GeoFilterActions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoFilterActions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Action of the geo filter, i.e. allow or block access. """ BLOCK = "Block" ALLOW = "Allow" -class HeaderAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HeaderAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Action to perform """ @@ -265,7 +267,7 @@ class HeaderAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): OVERWRITE = "Overwrite" DELETE = "Delete" -class HealthProbeRequestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HealthProbeRequestType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of health probe request that is made. """ @@ -273,7 +275,22 @@ class HealthProbeRequestType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) GET = "GET" HEAD = "HEAD" -class HttpsRedirect(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostNameOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Describes operator to be matched + """ + + ANY = "Any" + EQUAL = "Equal" + CONTAINS = "Contains" + BEGINS_WITH = "BeginsWith" + ENDS_WITH = "EndsWith" + LESS_THAN = "LessThan" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" + GREATER_THAN = "GreaterThan" + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + REG_EX = "RegEx" + +class HttpsRedirect(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. """ @@ -281,13 +298,13 @@ class HttpsRedirect(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class HttpVersionOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpVersionOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ EQUAL = "Equal" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that creates/modifies resources """ @@ -296,25 +313,25 @@ class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "managedIdentity" KEY = "key" -class IsDeviceMatchConditionParametersMatchValuesItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IsDeviceMatchConditionParametersMatchValuesItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MOBILE = "Mobile" DESKTOP = "Desktop" -class IsDeviceOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IsDeviceOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ EQUAL = "Equal" -class LinkToDefaultDomain(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LinkToDefaultDomain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """whether this route will be linked to the default endpoint domain. """ ENABLED = "Enabled" DISABLED = "Disabled" -class LogMetric(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LogMetric(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CLIENT_REQUEST_COUNT = "clientRequestCount" CLIENT_REQUEST_TRAFFIC = "clientRequestTraffic" @@ -323,21 +340,21 @@ class LogMetric(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ORIGIN_REQUEST_BANDWIDTH = "originRequestBandwidth" TOTAL_LATENCY = "totalLatency" -class LogMetricsGranularity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LogMetricsGranularity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT5_M = "PT5M" PT1_H = "PT1H" P1_D = "P1D" -class LogMetricsGroupBy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LogMetricsGroupBy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): HTTP_STATUS_CODE = "httpStatusCode" PROTOCOL = "protocol" CACHE_STATUS = "cacheStatus" - COUNTRY = "country" + COUNTRY_OR_REGION = "countryOrRegion" CUSTOM_DOMAIN = "customDomain" -class LogRanking(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LogRanking(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): URL = "url" REFERRER = "referrer" @@ -345,7 +362,7 @@ class LogRanking(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_AGENT = "userAgent" COUNTRY_OR_REGION = "countryOrRegion" -class LogRankingMetric(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LogRankingMetric(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CLIENT_REQUEST_COUNT = "clientRequestCount" CLIENT_REQUEST_TRAFFIC = "clientRequestTraffic" @@ -354,7 +371,7 @@ class LogRankingMetric(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ERROR_COUNT = "userErrorCount" ERROR_COUNT = "errorCount" -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. Defaults to Disabled if not specified. """ @@ -362,7 +379,16 @@ class ManagedRuleEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum DISABLED = "Disabled" ENABLED = "Enabled" -class MatchProcessingBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +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. """ @@ -370,7 +396,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)): """The name of the condition for the delivery rule. """ @@ -388,22 +414,26 @@ class MatchVariable(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP_VERSION = "HttpVersion" COOKIES = "Cookies" IS_DEVICE = "IsDevice" - REMOTE_ADDR = "RemoteAddr" SOCKET_ADDR = "SocketAddr" + CLIENT_PORT = "ClientPort" + SERVER_PORT = "ServerPort" + HOST_NAME = "HostName" + SSL_PROTOCOL = "SslProtocol" -class MetricsResponseGranularity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricsResponseGranularity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT5_M = "PT5M" PT1_H = "PT1H" P1_D = "P1D" -class MetricsResponseSeriesItemUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricsResponseSeriesItemUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COUNT = "count" BYTES = "bytes" BITS_PER_SECOND = "bitsPerSecond" + MILLI_SECONDS = "milliSeconds" -class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """TLS protocol version that will be used for Https """ @@ -411,7 +441,7 @@ class MinimumTlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TLS10 = "TLS10" TLS12 = "TLS12" -class Operator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Operator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -428,7 +458,7 @@ class Operator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENDS_WITH = "EndsWith" REG_EX = "RegEx" -class OptimizationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OptimizationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies what scenario the customer wants this CDN endpoint to optimize, e.g. Download, Media services. With this information we can apply scenario driven optimization. """ @@ -439,7 +469,7 @@ class OptimizationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LARGE_FILE_DOWNLOAD = "LargeFileDownload" DYNAMIC_SITE_ACCELERATION = "DynamicSiteAcceleration" -class OriginGroupResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OriginGroupResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource status of the origin group. """ @@ -447,7 +477,7 @@ class OriginGroupResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu ACTIVE = "Active" DELETING = "Deleting" -class OriginResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OriginResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource status of the origin. """ @@ -455,7 +485,7 @@ class OriginResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACTIVE = "Active" DELETING = "Deleting" -class ParamIndicator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ParamIndicator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the purpose of the parameter """ @@ -463,21 +493,21 @@ class ParamIndicator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): KEY_ID = "KeyId" SIGNATURE = "Signature" -class PolicyEnabledState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """describes if the policy is in enabled state or disabled state """ 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 PolicyResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource status of the policy. """ @@ -488,7 +518,18 @@ class PolicyResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DISABLED = "Disabled" DELETING = "Deleting" -class PostArgsOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicySettingsDefaultCustomBlockResponseStatusCode(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): + """If the action type is block, this field defines the default customer overridable http response + status code. + """ + + TWO_HUNDRED = 200 + FOUR_HUNDRED_THREE = 403 + FOUR_HUNDRED_FIVE = 405 + FOUR_HUNDRED_SIX = 406 + FOUR_HUNDRED_TWENTY_NINE = 429 + +class PostArgsOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -503,7 +544,7 @@ class PostArgsOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class PrivateEndpointStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The approval status for the connection to the Private Link """ @@ -513,7 +554,7 @@ class PrivateEndpointStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) DISCONNECTED = "Disconnected" TIMEOUT = "Timeout" -class ProbeProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProbeProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Protocol to use for health probe. """ @@ -521,7 +562,7 @@ class ProbeProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "Http" HTTPS = "Https" -class ProfileResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProfileResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource status of the profile. """ @@ -530,14 +571,14 @@ class ProfileResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETING = "Deleting" DISABLED = "Disabled" -class ProtocolType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProtocolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines the TLS extension protocol that is used for secure delivery. """ SERVER_NAME_INDICATION = "ServerNameIndication" IP_BASED = "IPBased" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the WebApplicationFirewallPolicy. """ @@ -545,7 +586,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" FAILED = "Failed" -class QueryStringBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class QueryStringBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Caching behavior for the requests """ @@ -554,7 +595,7 @@ class QueryStringBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): EXCLUDE = "Exclude" EXCLUDE_ALL = "ExcludeAll" -class QueryStringCachingBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class QueryStringCachingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. @@ -565,7 +606,7 @@ class QueryStringCachingBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, E USE_QUERY_STRING = "UseQueryString" NOT_SET = "NotSet" -class QueryStringOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class QueryStringOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -580,7 +621,7 @@ class QueryStringOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class RedirectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RedirectType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The redirect type the rule will use when redirecting traffic. """ @@ -589,7 +630,7 @@ class RedirectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TEMPORARY_REDIRECT = "TemporaryRedirect" PERMANENT_REDIRECT = "PermanentRedirect" -class RemoteAddressOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RemoteAddressOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -597,7 +638,7 @@ class RemoteAddressOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) IP_MATCH = "IPMatch" GEO_MATCH = "GeoMatch" -class RequestBodyOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RequestBodyOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -612,7 +653,7 @@ class RequestBodyOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class RequestHeaderOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RequestHeaderOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -627,7 +668,7 @@ class RequestHeaderOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class RequestMethodMatchConditionParametersMatchValuesItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RequestMethodMatchConditionParametersMatchValuesItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "GET" HEAD = "HEAD" @@ -637,18 +678,18 @@ class RequestMethodMatchConditionParametersMatchValuesItem(with_metaclass(_CaseI OPTIONS = "OPTIONS" TRACE = "TRACE" -class RequestMethodOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RequestMethodOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ EQUAL = "Equal" -class RequestSchemeMatchConditionParametersMatchValuesItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RequestSchemeMatchConditionParametersMatchValuesItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): HTTP = "HTTP" HTTPS = "HTTPS" -class RequestUriOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RequestUriOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -663,7 +704,14 @@ class RequestUriOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class ResponseBasedDetectedErrorTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of CDN resource used in CheckNameAvailability. + """ + + MICROSOFT_CDN_PROFILES_ENDPOINTS = "Microsoft.Cdn/Profiles/Endpoints" + MICROSOFT_CDN_PROFILES_AFD_ENDPOINTS = "Microsoft.Cdn/Profiles/AfdEndpoints" + +class ResponseBasedDetectedErrorTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of response errors for real user requests for which origin will be deemed unhealthy """ @@ -671,21 +719,65 @@ class ResponseBasedDetectedErrorTypes(with_metaclass(_CaseInsensitiveEnumMeta, s TCP_ERRORS_ONLY = "TcpErrorsOnly" TCP_AND_HTTP_ERRORS = "TcpAndHttpErrors" -class SecretType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of the Secret to create. +class RuleCacheBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Caching behavior for the requests + """ + + HONOR_ORIGIN = "HonorOrigin" + OVERRIDE_ALWAYS = "OverrideAlways" + OVERRIDE_IF_ORIGIN_MISSING = "OverrideIfOriginMissing" + +class RuleIsCompressionEnabled(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether content compression is enabled. If compression is enabled, content will be + served as compressed if user requests for a compressed version. Content won't be compressed on + AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class RuleQueryStringCachingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines how Frontdoor caches requests that include query strings. You can ignore any query + strings when caching, ignore specific query strings, cache every request with a unique URL, or + cache specific query strings. + """ + + IGNORE_QUERY_STRING = "IgnoreQueryString" + USE_QUERY_STRING = "UseQueryString" + IGNORE_SPECIFIED_QUERY_STRINGS = "IgnoreSpecifiedQueryStrings" + INCLUDE_SPECIFIED_QUERY_STRINGS = "IncludeSpecifiedQueryStrings" + +class SecretType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the secret resource. """ URL_SIGNING_KEY = "UrlSigningKey" CUSTOMER_CERTIFICATE = "CustomerCertificate" MANAGED_CERTIFICATE = "ManagedCertificate" + AZURE_FIRST_PARTY_MANAGED_CERTIFICATE = "AzureFirstPartyManagedCertificate" -class SecurityPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the Security policy to create. """ WEB_APPLICATION_FIREWALL = "WebApplicationFirewall" -class SharedPrivateLinkResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServerPortOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Describes operator to be matched + """ + + ANY = "Any" + EQUAL = "Equal" + CONTAINS = "Contains" + BEGINS_WITH = "BeginsWith" + ENDS_WITH = "EndsWith" + LESS_THAN = "LessThan" + LESS_THAN_OR_EQUAL = "LessThanOrEqual" + GREATER_THAN = "GreaterThan" + GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" + REG_EX = "RegEx" + +class SharedPrivateLinkResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the shared private link resource. Can be Pending, Approved, Rejected, Disconnected, or Timeout. """ @@ -696,7 +788,7 @@ class SharedPrivateLinkResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, s DISCONNECTED = "Disconnected" TIMEOUT = "Timeout" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Name of the pricing tier. """ @@ -706,7 +798,6 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_AKAMAI = "Standard_Akamai" STANDARD_CHINA_CDN = "Standard_ChinaCdn" STANDARD_MICROSOFT = "Standard_Microsoft" - PREMIUM_CHINA_CDN = "Premium_ChinaCdn" STANDARD_AZURE_FRONT_DOOR = "Standard_AzureFrontDoor" PREMIUM_AZURE_FRONT_DOOR = "Premium_AzureFrontDoor" STANDARD955_BAND_WIDTH_CHINA_CDN = "Standard_955BandWidth_ChinaCdn" @@ -715,7 +806,28 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_PLUS955_BAND_WIDTH_CHINA_CDN = "StandardPlus_955BandWidth_ChinaCdn" STANDARD_PLUS_AVG_BAND_WIDTH_CHINA_CDN = "StandardPlus_AvgBandWidth_ChinaCdn" -class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SocketAddrOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Describes operator to be matched + """ + + ANY = "Any" + IP_MATCH = "IPMatch" + +class SslProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The protocol of an established TLS connection. + """ + + TL_SV1 = "TLSv1" + TL_SV1_1 = "TLSv1.1" + TL_SV1_2 = "TLSv1.2" + +class SslProtocolOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Describes operator to be matched + """ + + EQUAL = "Equal" + +class Status(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The validation status. """ @@ -724,14 +836,18 @@ class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCESS_DENIED = "AccessDenied" CERTIFICATE_EXPIRED = "CertificateExpired" -class Transform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Transform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes what transforms are applied before matching """ LOWERCASE = "Lowercase" UPPERCASE = "Uppercase" + TRIM = "Trim" + URL_DECODE = "UrlDecode" + URL_ENCODE = "UrlEncode" + REMOVE_NULLS = "RemoveNulls" -class TransformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TransformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes what transforms were applied before matching. """ @@ -742,13 +858,13 @@ class TransformType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): URL_ENCODE = "UrlEncode" REMOVE_NULLS = "RemoveNulls" -class UpdateRule(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateRule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes the action that shall be taken when the certificate is updated in Key Vault. """ NO_ACTION = "NoAction" -class UrlFileExtensionOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UrlFileExtensionOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -763,7 +879,7 @@ class UrlFileExtensionOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class UrlFileNameOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UrlFileNameOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -778,7 +894,7 @@ class UrlFileNameOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class UrlPathOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UrlPathOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes operator to be matched """ @@ -794,49 +910,55 @@ class UrlPathOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WILDCARD = "Wildcard" REG_EX = "RegEx" -class UsageUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """An enum describing the unit of measurement. """ COUNT = "Count" -class ValidateSecretType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The secret type. - """ - - URL_SIGNING_KEY = "UrlSigningKey" - MANAGED_CERTIFICATE = "ManagedCertificate" - CUSTOMER_CERTIFICATE = "CustomerCertificate" - -class WafAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WafAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "allow" BLOCK = "block" LOG = "log" REDIRECT = "redirect" -class WafGranularity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WafGranularity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT5_M = "PT5M" PT1_H = "PT1H" P1_D = "P1D" -class WafMetric(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WafMatchVariable(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Match variable to compare against. + """ + + REMOTE_ADDR = "RemoteAddr" + SOCKET_ADDR = "SocketAddr" + REQUEST_METHOD = "RequestMethod" + REQUEST_HEADER = "RequestHeader" + REQUEST_URI = "RequestUri" + QUERY_STRING = "QueryString" + REQUEST_BODY = "RequestBody" + COOKIES = "Cookies" + POST_ARGS = "PostArgs" + +class WafMetric(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CLIENT_REQUEST_COUNT = "clientRequestCount" -class WafMetricsResponseGranularity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WafMetricsResponseGranularity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PT5_M = "PT5M" PT1_H = "PT1H" P1_D = "P1D" -class WafRankingGroupBy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WafRankingGroupBy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): HTTP_STATUS_CODE = "httpStatusCode" CUSTOM_DOMAIN = "customDomain" -class WafRankingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WafRankingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACTION = "action" RULE_GROUP = "ruleGroup" @@ -844,10 +966,10 @@ class WafRankingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_AGENT = "userAgent" CLIENT_IP = "clientIp" URL = "url" - COUNTRY = "country" + COUNTRY_OR_REGION = "countryOrRegion" RULE_TYPE = "ruleType" -class WafRuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WafRuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED = "managed" CUSTOM = "custom" diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models.py deleted file mode 100644 index 521964635f1d..000000000000 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models.py +++ /dev/null @@ -1,8615 +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 Resource(msrest.serialization.Model): - """The core properties of ARM resources. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class AFDDomain(Resource): - """Friendly domain name mapping to the endpoint hostname that the customer provides for branding purposes, e.g. www.contoso.com. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param tls_settings: The configuration specifying how to enable HTTPS for the domain - using - AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl - uses AzureFrontDoor managed certificate by default. - :type tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters - :param azure_dns_zone: Resource reference to the Azure DNS zone. - :type azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :ivar domain_validation_state: Provisioning substate shows the progress of custom HTTPS - enabling/disabling process step by step. DCV stands for DomainControlValidation. Possible - values include: "Unknown", "Submitting", "Pending", "TimedOut", "PendingRevalidation", - "Approved". - :vartype domain_validation_state: str or ~azure.mgmt.cdn.models.DomainValidationState - :param host_name: The host name of the domain. Must be a domain name. - :type host_name: str - :ivar validation_properties: Values the customer needs to validate domain ownership. - :vartype validation_properties: ~azure.mgmt.cdn.models.DomainValidationProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'domain_validation_state': {'readonly': True}, - 'validation_properties': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tls_settings': {'key': 'properties.tlsSettings', 'type': 'AFDDomainHttpsParameters'}, - 'azure_dns_zone': {'key': 'properties.azureDnsZone', 'type': 'ResourceReference'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - 'domain_validation_state': {'key': 'properties.domainValidationState', 'type': 'str'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'validation_properties': {'key': 'properties.validationProperties', 'type': 'DomainValidationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDDomain, self).__init__(**kwargs) - self.tls_settings = kwargs.get('tls_settings', None) - self.azure_dns_zone = kwargs.get('azure_dns_zone', None) - self.provisioning_state = None - self.deployment_status = None - self.domain_validation_state = None - self.host_name = kwargs.get('host_name', None) - self.validation_properties = None - - -class AFDDomainHttpsParameters(msrest.serialization.Model): - """The JSON object that contains the properties to secure a domain. - - All required parameters must be populated in order to send to Azure. - - :param certificate_type: Required. Defines the source of the SSL certificate. Possible values - include: "CustomerCertificate", "ManagedCertificate". - :type certificate_type: str or ~azure.mgmt.cdn.models.AfdCertificateType - :param minimum_tls_version: TLS protocol version that will be used for Https. Possible values - include: "TLS10", "TLS12". - :type minimum_tls_version: str or ~azure.mgmt.cdn.models.AfdMinimumTlsVersion - :param secret: Resource reference to the secret. ie. subs/rg/profile/secret. - :type secret: ~azure.mgmt.cdn.models.ResourceReference - """ - - _validation = { - 'certificate_type': {'required': True}, - } - - _attribute_map = { - 'certificate_type': {'key': 'certificateType', 'type': 'str'}, - 'minimum_tls_version': {'key': 'minimumTlsVersion', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'ResourceReference'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDDomainHttpsParameters, self).__init__(**kwargs) - self.certificate_type = kwargs['certificate_type'] - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - self.secret = kwargs.get('secret', None) - - -class AFDDomainListResult(msrest.serialization.Model): - """Result of the request to list domains. It contains a list of domain 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 AzureFrontDoor domains within a profile. - :vartype value: list[~azure.mgmt.cdn.models.AFDDomain] - :param next_link: URL to get the next set of domain objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AFDDomain]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDDomainListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class AFDStateProperties(msrest.serialization.Model): - """The tracking states for afd resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDStateProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.deployment_status = None - - -class AFDDomainUpdatePropertiesParameters(msrest.serialization.Model): - """The JSON object that contains the properties of the domain to create. - - :param tls_settings: The configuration specifying how to enable HTTPS for the domain - using - AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl - uses AzureFrontDoor managed certificate by default. - :type tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters - :param azure_dns_zone: Resource reference to the Azure DNS zone. - :type azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference - """ - - _attribute_map = { - 'tls_settings': {'key': 'tlsSettings', 'type': 'AFDDomainHttpsParameters'}, - 'azure_dns_zone': {'key': 'azureDnsZone', 'type': 'ResourceReference'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDDomainUpdatePropertiesParameters, self).__init__(**kwargs) - self.tls_settings = kwargs.get('tls_settings', None) - self.azure_dns_zone = kwargs.get('azure_dns_zone', None) - - -class AFDDomainProperties(AFDDomainUpdatePropertiesParameters, AFDStateProperties): - """The JSON object that contains the properties of the domain to create. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :param tls_settings: The configuration specifying how to enable HTTPS for the domain - using - AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl - uses AzureFrontDoor managed certificate by default. - :type tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters - :param azure_dns_zone: Resource reference to the Azure DNS zone. - :type azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference - :ivar domain_validation_state: Provisioning substate shows the progress of custom HTTPS - enabling/disabling process step by step. DCV stands for DomainControlValidation. Possible - values include: "Unknown", "Submitting", "Pending", "TimedOut", "PendingRevalidation", - "Approved". - :vartype domain_validation_state: str or ~azure.mgmt.cdn.models.DomainValidationState - :param host_name: Required. The host name of the domain. Must be a domain name. - :type host_name: str - :ivar validation_properties: Values the customer needs to validate domain ownership. - :vartype validation_properties: ~azure.mgmt.cdn.models.DomainValidationProperties - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'domain_validation_state': {'readonly': True}, - 'host_name': {'required': True}, - 'validation_properties': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - 'tls_settings': {'key': 'tlsSettings', 'type': 'AFDDomainHttpsParameters'}, - 'azure_dns_zone': {'key': 'azureDnsZone', 'type': 'ResourceReference'}, - 'domain_validation_state': {'key': 'domainValidationState', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'validation_properties': {'key': 'validationProperties', 'type': 'DomainValidationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDDomainProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.deployment_status = None - self.domain_validation_state = None - self.host_name = kwargs['host_name'] - self.validation_properties = None - self.tls_settings = kwargs.get('tls_settings', None) - self.azure_dns_zone = kwargs.get('azure_dns_zone', None) - self.domain_validation_state = None - self.host_name = kwargs['host_name'] - self.validation_properties = None - - -class AFDDomainUpdateParameters(msrest.serialization.Model): - """The domain JSON object required for domain creation or update. - - :param tls_settings: The configuration specifying how to enable HTTPS for the domain - using - AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl - uses AzureFrontDoor managed certificate by default. - :type tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters - :param azure_dns_zone: Resource reference to the Azure DNS zone. - :type azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference - """ - - _attribute_map = { - 'tls_settings': {'key': 'properties.tlsSettings', 'type': 'AFDDomainHttpsParameters'}, - 'azure_dns_zone': {'key': 'properties.azureDnsZone', 'type': 'ResourceReference'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDDomainUpdateParameters, self).__init__(**kwargs) - self.tls_settings = kwargs.get('tls_settings', None) - self.azure_dns_zone = kwargs.get('azure_dns_zone', None) - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param location: Required. 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}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - - -class AFDEndpoint(TrackedResource): - """CDN endpoint is the entity within a CDN profile containing configuration information such as origin, protocol, content caching and delivery behavior. The AzureFrontDoor endpoint uses the URL format :code:``.azureedge.net. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param origin_response_timeout_seconds: Send and receive timeout on forwarding request to the - origin. When timeout is reached, the request fails and returns. - :type origin_response_timeout_seconds: int - :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.cdn.models.EnabledState - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. - contoso.azureedge.net. - :vartype host_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'origin_response_timeout_seconds': {'minimum': 16}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'host_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'origin_response_timeout_seconds': {'key': 'properties.originResponseTimeoutSeconds', 'type': 'int'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDEndpoint, self).__init__(**kwargs) - self.origin_response_timeout_seconds = kwargs.get('origin_response_timeout_seconds', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.provisioning_state = None - self.deployment_status = None - self.host_name = None - - -class AFDEndpointListResult(msrest.serialization.Model): - """Result of the request to list endpoints. It contains a list of 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 AzureFrontDoor endpoints within a profile. - :vartype value: list[~azure.mgmt.cdn.models.AFDEndpoint] - :param next_link: URL to get the next set of endpoint objects if there is any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AFDEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDEndpointListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class AFDEndpointPropertiesUpdateParameters(msrest.serialization.Model): - """The JSON object containing endpoint update parameters. - - :param origin_response_timeout_seconds: Send and receive timeout on forwarding request to the - origin. When timeout is reached, the request fails and returns. - :type origin_response_timeout_seconds: int - :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.cdn.models.EnabledState - """ - - _validation = { - 'origin_response_timeout_seconds': {'minimum': 16}, - } - - _attribute_map = { - 'origin_response_timeout_seconds': {'key': 'originResponseTimeoutSeconds', 'type': 'int'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDEndpointPropertiesUpdateParameters, self).__init__(**kwargs) - self.origin_response_timeout_seconds = kwargs.get('origin_response_timeout_seconds', None) - self.enabled_state = kwargs.get('enabled_state', None) - - -class AFDEndpointProperties(AFDStateProperties, AFDEndpointPropertiesUpdateParameters): - """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 origin_response_timeout_seconds: Send and receive timeout on forwarding request to the - origin. When timeout is reached, the request fails and returns. - :type origin_response_timeout_seconds: int - :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.cdn.models.EnabledState - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. - contoso.azureedge.net. - :vartype host_name: str - """ - - _validation = { - 'origin_response_timeout_seconds': {'minimum': 16}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'host_name': {'readonly': True}, - } - - _attribute_map = { - 'origin_response_timeout_seconds': {'key': 'originResponseTimeoutSeconds', 'type': 'int'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDEndpointProperties, self).__init__(**kwargs) - self.origin_response_timeout_seconds = kwargs.get('origin_response_timeout_seconds', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.host_name = None - self.provisioning_state = None - self.deployment_status = None - self.host_name = None - - -class AFDEndpointUpdateParameters(msrest.serialization.Model): - """Properties required to create or update an endpoint. - - :param tags: A set of tags. Endpoint tags. - :type tags: dict[str, str] - :param origin_response_timeout_seconds: Send and receive timeout on forwarding request to the - origin. When timeout is reached, the request fails and returns. - :type origin_response_timeout_seconds: int - :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.cdn.models.EnabledState - """ - - _validation = { - 'origin_response_timeout_seconds': {'minimum': 16}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'origin_response_timeout_seconds': {'key': 'properties.originResponseTimeoutSeconds', 'type': 'int'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDEndpointUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.origin_response_timeout_seconds = kwargs.get('origin_response_timeout_seconds', None) - self.enabled_state = kwargs.get('enabled_state', None) - - -class AfdErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~azure.mgmt.cdn.models.ErrorResponse - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponse'}, - } - - def __init__( - self, - **kwargs - ): - super(AfdErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class AFDOrigin(Resource): - """CDN origin is the source of the content being delivered via CDN. When the edge nodes represented by an endpoint do not have the requested content cached, they attempt to fetch it from one or more of the configured origins. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param azure_origin: Resource reference to the Azure origin resource. - :type azure_origin: ~azure.mgmt.cdn.models.ResourceReference - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses - are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin - hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities - will not be used for load balancing if any lower priority origin is healthy.Must be between 1 - and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 - and 1000. - :type weight: int - :param shared_private_link_resource: The properties of the private link resource for private - origin. - :type shared_private_link_resource: object - :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.cdn.models.EnabledState - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'azure_origin': {'key': 'properties.azureOrigin', 'type': 'ResourceReference'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'http_port': {'key': 'properties.httpPort', 'type': 'int'}, - 'https_port': {'key': 'properties.httpsPort', 'type': 'int'}, - 'origin_host_header': {'key': 'properties.originHostHeader', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'weight': {'key': 'properties.weight', 'type': 'int'}, - 'shared_private_link_resource': {'key': 'properties.sharedPrivateLinkResource', 'type': 'object'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDOrigin, self).__init__(**kwargs) - self.azure_origin = kwargs.get('azure_origin', None) - self.host_name = kwargs.get('host_name', None) - self.http_port = kwargs.get('http_port', None) - self.https_port = kwargs.get('https_port', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.priority = kwargs.get('priority', None) - self.weight = kwargs.get('weight', None) - self.shared_private_link_resource = kwargs.get('shared_private_link_resource', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.provisioning_state = None - self.deployment_status = None - - -class AFDOriginGroup(Resource): - """AFDOrigin group comprising of origins is used for load balancing to origins when the content cannot be served from CDN. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters - :param health_probe_settings: Health probe settings to the origin that is used to determine the - health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift - the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new - endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_afd_origin_error_detection_settings: The JSON object that contains the - properties to determine origin health using real requests/responses. This property is currently - not supported. - :type response_based_afd_origin_error_detection_settings: - ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - :param session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'load_balancing_settings': {'key': 'properties.loadBalancingSettings', 'type': 'LoadBalancingSettingsParameters'}, - 'health_probe_settings': {'key': 'properties.healthProbeSettings', 'type': 'HealthProbeParameters'}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'properties.trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, - 'response_based_afd_origin_error_detection_settings': {'key': 'properties.responseBasedAfdOriginErrorDetectionSettings', 'type': 'ResponseBasedOriginErrorDetectionParameters'}, - 'session_affinity_state': {'key': 'properties.sessionAffinityState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDOriginGroup, self).__init__(**kwargs) - self.load_balancing_settings = kwargs.get('load_balancing_settings', None) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = kwargs.get('traffic_restoration_time_to_healed_or_new_endpoints_in_minutes', None) - self.response_based_afd_origin_error_detection_settings = kwargs.get('response_based_afd_origin_error_detection_settings', None) - self.session_affinity_state = kwargs.get('session_affinity_state', None) - self.provisioning_state = None - self.deployment_status = None - - -class AFDOriginGroupListResult(msrest.serialization.Model): - """Result of the request to list origin groups. It contains a list of origin groups 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 CDN origin groups within an endpoint. - :vartype value: list[~azure.mgmt.cdn.models.AFDOriginGroup] - :param next_link: URL to get the next set of origin objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AFDOriginGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDOriginGroupListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class AFDOriginGroupUpdatePropertiesParameters(msrest.serialization.Model): - """The JSON object that contains the properties of the origin group. - - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters - :param health_probe_settings: Health probe settings to the origin that is used to determine the - health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift - the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new - endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_afd_origin_error_detection_settings: The JSON object that contains the - properties to determine origin health using real requests/responses. This property is currently - not supported. - :type response_based_afd_origin_error_detection_settings: - ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - :param session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState - """ - - _validation = { - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, - } - - _attribute_map = { - 'load_balancing_settings': {'key': 'loadBalancingSettings', 'type': 'LoadBalancingSettingsParameters'}, - 'health_probe_settings': {'key': 'healthProbeSettings', 'type': 'HealthProbeParameters'}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, - 'response_based_afd_origin_error_detection_settings': {'key': 'responseBasedAfdOriginErrorDetectionSettings', 'type': 'ResponseBasedOriginErrorDetectionParameters'}, - 'session_affinity_state': {'key': 'sessionAffinityState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDOriginGroupUpdatePropertiesParameters, self).__init__(**kwargs) - self.load_balancing_settings = kwargs.get('load_balancing_settings', None) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = kwargs.get('traffic_restoration_time_to_healed_or_new_endpoints_in_minutes', None) - self.response_based_afd_origin_error_detection_settings = kwargs.get('response_based_afd_origin_error_detection_settings', None) - self.session_affinity_state = kwargs.get('session_affinity_state', None) - - -class AFDOriginGroupProperties(AFDStateProperties, AFDOriginGroupUpdatePropertiesParameters): - """The JSON object that contains the properties of the origin group. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters - :param health_probe_settings: Health probe settings to the origin that is used to determine the - health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift - the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new - endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_afd_origin_error_detection_settings: The JSON object that contains the - properties to determine origin health using real requests/responses. This property is currently - not supported. - :type response_based_afd_origin_error_detection_settings: - ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - :param session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'load_balancing_settings': {'key': 'loadBalancingSettings', 'type': 'LoadBalancingSettingsParameters'}, - 'health_probe_settings': {'key': 'healthProbeSettings', 'type': 'HealthProbeParameters'}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, - 'response_based_afd_origin_error_detection_settings': {'key': 'responseBasedAfdOriginErrorDetectionSettings', 'type': 'ResponseBasedOriginErrorDetectionParameters'}, - 'session_affinity_state': {'key': 'sessionAffinityState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDOriginGroupProperties, self).__init__(**kwargs) - self.load_balancing_settings = kwargs.get('load_balancing_settings', None) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = kwargs.get('traffic_restoration_time_to_healed_or_new_endpoints_in_minutes', None) - self.response_based_afd_origin_error_detection_settings = kwargs.get('response_based_afd_origin_error_detection_settings', None) - self.session_affinity_state = kwargs.get('session_affinity_state', None) - self.provisioning_state = None - self.deployment_status = None - - -class AFDOriginGroupUpdateParameters(msrest.serialization.Model): - """AFDOrigin group properties needed for origin group creation or update. - - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters - :param health_probe_settings: Health probe settings to the origin that is used to determine the - health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift - the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new - endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_afd_origin_error_detection_settings: The JSON object that contains the - properties to determine origin health using real requests/responses. This property is currently - not supported. - :type response_based_afd_origin_error_detection_settings: - ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - :param session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState - """ - - _validation = { - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, - } - - _attribute_map = { - 'load_balancing_settings': {'key': 'properties.loadBalancingSettings', 'type': 'LoadBalancingSettingsParameters'}, - 'health_probe_settings': {'key': 'properties.healthProbeSettings', 'type': 'HealthProbeParameters'}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'properties.trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, - 'response_based_afd_origin_error_detection_settings': {'key': 'properties.responseBasedAfdOriginErrorDetectionSettings', 'type': 'ResponseBasedOriginErrorDetectionParameters'}, - 'session_affinity_state': {'key': 'properties.sessionAffinityState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDOriginGroupUpdateParameters, self).__init__(**kwargs) - self.load_balancing_settings = kwargs.get('load_balancing_settings', None) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = kwargs.get('traffic_restoration_time_to_healed_or_new_endpoints_in_minutes', None) - self.response_based_afd_origin_error_detection_settings = kwargs.get('response_based_afd_origin_error_detection_settings', None) - self.session_affinity_state = kwargs.get('session_affinity_state', None) - - -class AFDOriginListResult(msrest.serialization.Model): - """Result of the request to list origins. It contains a list of origin 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 CDN origins within an endpoint. - :vartype value: list[~azure.mgmt.cdn.models.AFDOrigin] - :param next_link: URL to get the next set of origin objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AFDOrigin]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDOriginListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class AFDOriginUpdatePropertiesParameters(msrest.serialization.Model): - """The JSON object that contains the properties of the origin. - - :param azure_origin: Resource reference to the Azure origin resource. - :type azure_origin: ~azure.mgmt.cdn.models.ResourceReference - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses - are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin - hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities - will not be used for load balancing if any lower priority origin is healthy.Must be between 1 - and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 - and 1000. - :type weight: int - :param shared_private_link_resource: The properties of the private link resource for private - origin. - :type shared_private_link_resource: object - :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.cdn.models.EnabledState - """ - - _validation = { - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, - } - - _attribute_map = { - 'azure_origin': {'key': 'azureOrigin', 'type': 'ResourceReference'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'http_port': {'key': 'httpPort', 'type': 'int'}, - 'https_port': {'key': 'httpsPort', 'type': 'int'}, - 'origin_host_header': {'key': 'originHostHeader', 'type': 'str'}, - 'priority': {'key': 'priority', 'type': 'int'}, - 'weight': {'key': 'weight', 'type': 'int'}, - 'shared_private_link_resource': {'key': 'sharedPrivateLinkResource', 'type': 'object'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDOriginUpdatePropertiesParameters, self).__init__(**kwargs) - self.azure_origin = kwargs.get('azure_origin', None) - self.host_name = kwargs.get('host_name', None) - self.http_port = kwargs.get('http_port', None) - self.https_port = kwargs.get('https_port', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.priority = kwargs.get('priority', None) - self.weight = kwargs.get('weight', None) - self.shared_private_link_resource = kwargs.get('shared_private_link_resource', None) - self.enabled_state = kwargs.get('enabled_state', None) - - -class AFDOriginProperties(AFDStateProperties, AFDOriginUpdatePropertiesParameters): - """The JSON object that contains the properties of the origin. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param azure_origin: Resource reference to the Azure origin resource. - :type azure_origin: ~azure.mgmt.cdn.models.ResourceReference - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses - are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin - hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities - will not be used for load balancing if any lower priority origin is healthy.Must be between 1 - and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 - and 1000. - :type weight: int - :param shared_private_link_resource: The properties of the private link resource for private - origin. - :type shared_private_link_resource: object - :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.cdn.models.EnabledState - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'azure_origin': {'key': 'azureOrigin', 'type': 'ResourceReference'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'http_port': {'key': 'httpPort', 'type': 'int'}, - 'https_port': {'key': 'httpsPort', 'type': 'int'}, - 'origin_host_header': {'key': 'originHostHeader', 'type': 'str'}, - 'priority': {'key': 'priority', 'type': 'int'}, - 'weight': {'key': 'weight', 'type': 'int'}, - 'shared_private_link_resource': {'key': 'sharedPrivateLinkResource', 'type': 'object'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDOriginProperties, self).__init__(**kwargs) - self.azure_origin = kwargs.get('azure_origin', None) - self.host_name = kwargs.get('host_name', None) - self.http_port = kwargs.get('http_port', None) - self.https_port = kwargs.get('https_port', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.priority = kwargs.get('priority', None) - self.weight = kwargs.get('weight', None) - self.shared_private_link_resource = kwargs.get('shared_private_link_resource', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.provisioning_state = None - self.deployment_status = None - - -class AFDOriginUpdateParameters(msrest.serialization.Model): - """AFDOrigin properties needed for origin update. - - :param azure_origin: Resource reference to the Azure origin resource. - :type azure_origin: ~azure.mgmt.cdn.models.ResourceReference - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses - are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin - hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities - will not be used for load balancing if any lower priority origin is healthy.Must be between 1 - and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 - and 1000. - :type weight: int - :param shared_private_link_resource: The properties of the private link resource for private - origin. - :type shared_private_link_resource: object - :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.cdn.models.EnabledState - """ - - _validation = { - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, - } - - _attribute_map = { - 'azure_origin': {'key': 'properties.azureOrigin', 'type': 'ResourceReference'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'http_port': {'key': 'properties.httpPort', 'type': 'int'}, - 'https_port': {'key': 'properties.httpsPort', 'type': 'int'}, - 'origin_host_header': {'key': 'properties.originHostHeader', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'weight': {'key': 'properties.weight', 'type': 'int'}, - 'shared_private_link_resource': {'key': 'properties.sharedPrivateLinkResource', 'type': 'object'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AFDOriginUpdateParameters, self).__init__(**kwargs) - self.azure_origin = kwargs.get('azure_origin', None) - self.host_name = kwargs.get('host_name', None) - self.http_port = kwargs.get('http_port', None) - self.https_port = kwargs.get('https_port', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.priority = kwargs.get('priority', None) - self.weight = kwargs.get('weight', None) - self.shared_private_link_resource = kwargs.get('shared_private_link_resource', None) - self.enabled_state = kwargs.get('enabled_state', None) - - -class AfdPurgeParameters(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] - :param domains: List of domains. - :type domains: list[str] - """ - - _validation = { - 'content_paths': {'required': True}, - } - - _attribute_map = { - 'content_paths': {'key': 'contentPaths', 'type': '[str]'}, - 'domains': {'key': 'domains', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(AfdPurgeParameters, self).__init__(**kwargs) - self.content_paths = kwargs['content_paths'] - self.domains = kwargs.get('domains', None) - - -class CacheExpirationActionParameters(msrest.serialization.Model): - """Defines the parameters for the cache expiration action. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleCacheExpirationActionParameters". - :vartype odata_type: str - :param cache_behavior: Required. Caching behavior for the requests. Possible values include: - "BypassCache", "Override", "SetIfMissing". - :type cache_behavior: str or ~azure.mgmt.cdn.models.CacheBehavior - :param cache_type: Required. The level at which the content needs to be cached. Possible values - include: "All". - :type cache_type: str or ~azure.mgmt.cdn.models.CacheType - :param cache_duration: The duration for which the content needs to be cached. Allowed format is - [d.]hh:mm:ss. - :type cache_duration: str - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'cache_behavior': {'required': True}, - 'cache_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'cache_behavior': {'key': 'cacheBehavior', 'type': 'str'}, - 'cache_type': {'key': 'cacheType', 'type': 'str'}, - 'cache_duration': {'key': 'cacheDuration', 'type': 'str'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleCacheExpirationActionParameters" - - def __init__( - self, - **kwargs - ): - super(CacheExpirationActionParameters, self).__init__(**kwargs) - self.cache_behavior = kwargs['cache_behavior'] - self.cache_type = kwargs['cache_type'] - self.cache_duration = kwargs.get('cache_duration', None) - - -class CacheKeyQueryStringActionParameters(msrest.serialization.Model): - """Defines the parameters for the cache-key query string action. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleCacheKeyQueryStringBehaviorActionParameters". - :vartype odata_type: str - :param query_string_behavior: Required. Caching behavior for the requests. Possible values - include: "Include", "IncludeAll", "Exclude", "ExcludeAll". - :type query_string_behavior: str or ~azure.mgmt.cdn.models.QueryStringBehavior - :param query_parameters: query parameters to include or exclude (comma separated). - :type query_parameters: str - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'query_string_behavior': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'query_string_behavior': {'key': 'queryStringBehavior', 'type': 'str'}, - 'query_parameters': {'key': 'queryParameters', 'type': 'str'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" - - def __init__( - self, - **kwargs - ): - super(CacheKeyQueryStringActionParameters, self).__init__(**kwargs) - self.query_string_behavior = kwargs['query_string_behavior'] - self.query_parameters = kwargs.get('query_parameters', None) - - -class CdnCertificateSourceParameters(msrest.serialization.Model): - """Defines the parameters for using CDN managed certificate for securing custom domain. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.CdnCertificateSourceParameters". - :vartype odata_type: str - :param certificate_type: Required. Type of certificate used. Possible values include: "Shared", - "Dedicated". - :type certificate_type: str or ~azure.mgmt.cdn.models.CertificateType - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'certificate_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'certificate_type': {'key': 'certificateType', 'type': 'str'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.CdnCertificateSourceParameters" - - def __init__( - self, - **kwargs - ): - super(CdnCertificateSourceParameters, self).__init__(**kwargs) - self.certificate_type = kwargs['certificate_type'] - - -class CdnEndpoint(msrest.serialization.Model): - """Defines the ARM Resource ID for the linked endpoints. - - :param id: ARM Resource ID string. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CdnEndpoint, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class CustomDomainHttpsParameters(msrest.serialization.Model): - """The JSON object that contains the properties to secure a custom domain. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: UserManagedHttpsParameters, CdnManagedHttpsParameters. - - All required parameters must be populated in order to send to Azure. - - :param certificate_source: Required. Defines the source of the SSL certificate.Constant filled - by server. Possible values include: "AzureKeyVault", "Cdn". - :type certificate_source: str or ~azure.mgmt.cdn.models.CertificateSource - :param protocol_type: Required. Defines the TLS extension protocol that is used for secure - delivery. Possible values include: "ServerNameIndication", "IPBased". - :type protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType - :param minimum_tls_version: TLS protocol version that will be used for Https. Possible values - include: "None", "TLS10", "TLS12". - :type minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion - """ - - _validation = { - 'certificate_source': {'required': True}, - 'protocol_type': {'required': True}, - } - - _attribute_map = { - 'certificate_source': {'key': 'certificateSource', 'type': 'str'}, - 'protocol_type': {'key': 'protocolType', 'type': 'str'}, - 'minimum_tls_version': {'key': 'minimumTlsVersion', 'type': 'str'}, - } - - _subtype_map = { - 'certificate_source': {'AzureKeyVault': 'UserManagedHttpsParameters', 'Cdn': 'CdnManagedHttpsParameters'} - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainHttpsParameters, self).__init__(**kwargs) - self.certificate_source = None # type: Optional[str] - self.protocol_type = kwargs['protocol_type'] - self.minimum_tls_version = kwargs.get('minimum_tls_version', None) - - -class CdnManagedHttpsParameters(CustomDomainHttpsParameters): - """Defines the certificate source parameters using CDN managed certificate for enabling SSL. - - All required parameters must be populated in order to send to Azure. - - :param certificate_source: Required. Defines the source of the SSL certificate.Constant filled - by server. Possible values include: "AzureKeyVault", "Cdn". - :type certificate_source: str or ~azure.mgmt.cdn.models.CertificateSource - :param protocol_type: Required. Defines the TLS extension protocol that is used for secure - delivery. Possible values include: "ServerNameIndication", "IPBased". - :type protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType - :param minimum_tls_version: TLS protocol version that will be used for Https. Possible values - include: "None", "TLS10", "TLS12". - :type minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion - :param certificate_source_parameters: Required. Defines the certificate source parameters using - CDN managed certificate for enabling SSL. - :type certificate_source_parameters: ~azure.mgmt.cdn.models.CdnCertificateSourceParameters - """ - - _validation = { - 'certificate_source': {'required': True}, - 'protocol_type': {'required': True}, - 'certificate_source_parameters': {'required': True}, - } - - _attribute_map = { - 'certificate_source': {'key': 'certificateSource', 'type': 'str'}, - 'protocol_type': {'key': 'protocolType', 'type': 'str'}, - 'minimum_tls_version': {'key': 'minimumTlsVersion', 'type': 'str'}, - 'certificate_source_parameters': {'key': 'certificateSourceParameters', 'type': 'CdnCertificateSourceParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(CdnManagedHttpsParameters, self).__init__(**kwargs) - self.certificate_source = 'Cdn' # type: str - self.certificate_source_parameters = kwargs['certificate_source_parameters'] - - -class CdnWebApplicationFirewallPolicy(TrackedResource): - """Defines web application firewall policy for Azure CDN. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param location: Required. 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: Required. The pricing tier (defines a CDN provider, feature list and rate) of the - CdnWebApplicationFirewallPolicy. - :type sku: ~azure.mgmt.cdn.models.Sku - :param policy_settings: Describes policySettings for policy. - :type policy_settings: ~azure.mgmt.cdn.models.PolicySettings - :param rate_limit_rules: Describes rate limit rules inside the policy. - :type rate_limit_rules: ~azure.mgmt.cdn.models.RateLimitRuleList - :param custom_rules: Describes custom rules inside the policy. - :type custom_rules: ~azure.mgmt.cdn.models.CustomRuleList - :param managed_rules: Describes managed rules inside the policy. - :type managed_rules: ~azure.mgmt.cdn.models.ManagedRuleSetList - :ivar endpoint_links: Describes Azure CDN endpoints associated with this Web Application - Firewall policy. - :vartype endpoint_links: list[~azure.mgmt.cdn.models.CdnEndpoint] - :ivar provisioning_state: Provisioning state of the WebApplicationFirewallPolicy. Possible - values include: "Creating", "Succeeded", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.ProvisioningState - :ivar resource_state: Resource status of the policy. Possible values include: "Creating", - "Enabling", "Enabled", "Disabling", "Disabled", "Deleting". - :vartype resource_state: str or ~azure.mgmt.cdn.models.PolicyResourceState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'endpoint_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'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - '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'}, - 'rate_limit_rules': {'key': 'properties.rateLimitRules', 'type': 'RateLimitRuleList'}, - 'custom_rules': {'key': 'properties.customRules', 'type': 'CustomRuleList'}, - 'managed_rules': {'key': 'properties.managedRules', 'type': 'ManagedRuleSetList'}, - 'endpoint_links': {'key': 'properties.endpointLinks', 'type': '[CdnEndpoint]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CdnWebApplicationFirewallPolicy, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.sku = kwargs['sku'] - self.policy_settings = kwargs.get('policy_settings', None) - self.rate_limit_rules = kwargs.get('rate_limit_rules', None) - self.custom_rules = kwargs.get('custom_rules', None) - self.managed_rules = kwargs.get('managed_rules', None) - self.endpoint_links = None - self.provisioning_state = None - self.resource_state = None - - -class CdnWebApplicationFirewallPolicyList(msrest.serialization.Model): - """Defines a list of WebApplicationFirewallPolicies for Azure CDN. 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 Azure CDN WebApplicationFirewallPolicies within a resource group. - :vartype value: list[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] - :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': '[CdnWebApplicationFirewallPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CdnWebApplicationFirewallPolicyList, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class CdnWebApplicationFirewallPolicyPatchParameters(msrest.serialization.Model): - """Properties required to update a CdnWebApplicationFirewallPolicy. - - :param tags: A set of tags. CdnWebApplicationFirewallPolicy tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(CdnWebApplicationFirewallPolicyPatchParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class Certificate(msrest.serialization.Model): - """Certificate used for https. - - :param subject: Subject name in the certificate. - :type subject: str - :param expiration_date: Certificate expiration date. - :type expiration_date: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - """ - - _attribute_map = { - 'subject': {'key': 'subject', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Certificate, self).__init__(**kwargs) - self.subject = kwargs.get('subject', None) - self.expiration_date = kwargs.get('expiration_date', None) - self.thumbprint = kwargs.get('thumbprint', None) - - -class CheckNameAvailabilityInput(msrest.serialization.Model): - """Input of CheckNameAvailability API. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The resource name to validate. - :type name: str - :ivar type: Required. The type of the resource whose name is to be validated. Default value: - "Microsoft.Cdn/Profiles/Endpoints". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Cdn/Profiles/Endpoints" - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityInput, self).__init__(**kwargs) - self.name = kwargs['name'] - - -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_available: Indicates whether the name is available. - :vartype name_available: bool - :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_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityOutput, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CidrIpAddress(msrest.serialization.Model): - """CIDR Ip address. - - :param base_ip_address: Ip address itself. - :type base_ip_address: str - :param prefix_length: The length of the prefix of the ip address. - :type prefix_length: int - """ - - _attribute_map = { - 'base_ip_address': {'key': 'baseIpAddress', 'type': 'str'}, - 'prefix_length': {'key': 'prefixLength', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(CidrIpAddress, self).__init__(**kwargs) - self.base_ip_address = kwargs.get('base_ip_address', None) - self.prefix_length = kwargs.get('prefix_length', None) - - -class Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(msrest.serialization.Model): - """Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems. - - :param date_time: - :type date_time: ~datetime.datetime - :param value: - :type value: float - """ - - _attribute_map = { - 'date_time': {'key': 'dateTime', 'type': 'iso-8601'}, - 'value': {'key': 'value', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems, self).__init__(**kwargs) - self.date_time = kwargs.get('date_time', None) - self.value = kwargs.get('value', None) - - -class Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(msrest.serialization.Model): - """Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems. - - :param date_time: - :type date_time: ~datetime.datetime - :param value: - :type value: float - """ - - _attribute_map = { - 'date_time': {'key': 'dateTime', 'type': 'iso-8601'}, - 'value': {'key': 'value', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems, self).__init__(**kwargs) - self.date_time = kwargs.get('date_time', None) - self.value = kwargs.get('value', None) - - -class ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(msrest.serialization.Model): - """ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems. - - :param metric: - :type metric: str - :param value: - :type value: long - :param percentage: - :type percentage: float - """ - - _attribute_map = { - 'metric': {'key': 'metric', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'long'}, - 'percentage': {'key': 'percentage', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems, self).__init__(**kwargs) - self.metric = kwargs.get('metric', None) - self.value = kwargs.get('value', None) - self.percentage = kwargs.get('percentage', None) - - -class CompressionSettings(msrest.serialization.Model): - """settings for compression. - - :param content_types_to_compress: List of content types on which compression applies. The value - should be a valid MIME type. - :type content_types_to_compress: list[str] - :param is_compression_enabled: Indicates whether content compression is enabled on - AzureFrontDoor. Default value is false. If compression is enabled, content will be served as - compressed if user requests for a compressed version. Content won't be compressed on - AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. - :type is_compression_enabled: bool - """ - - _attribute_map = { - 'content_types_to_compress': {'key': 'contentTypesToCompress', 'type': '[str]'}, - 'is_compression_enabled': {'key': 'isCompressionEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(CompressionSettings, self).__init__(**kwargs) - self.content_types_to_compress = kwargs.get('content_types_to_compress', None) - self.is_compression_enabled = kwargs.get('is_compression_enabled', None) - - -class ContinentsResponse(msrest.serialization.Model): - """Continents Response. - - :param continents: - :type continents: list[~azure.mgmt.cdn.models.ContinentsResponseContinentsItem] - :param country_or_regions: - :type country_or_regions: list[~azure.mgmt.cdn.models.ContinentsResponseCountryOrRegionsItem] - """ - - _attribute_map = { - 'continents': {'key': 'continents', 'type': '[ContinentsResponseContinentsItem]'}, - 'country_or_regions': {'key': 'countryOrRegions', 'type': '[ContinentsResponseCountryOrRegionsItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContinentsResponse, self).__init__(**kwargs) - self.continents = kwargs.get('continents', None) - self.country_or_regions = kwargs.get('country_or_regions', None) - - -class ContinentsResponseContinentsItem(msrest.serialization.Model): - """ContinentsResponseContinentsItem. - - :param id: - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContinentsResponseContinentsItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class ContinentsResponseCountryOrRegionsItem(msrest.serialization.Model): - """ContinentsResponseCountryOrRegionsItem. - - :param id: - :type id: str - :param continent_id: - :type continent_id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'continent_id': {'key': 'continentId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContinentsResponseCountryOrRegionsItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.continent_id = kwargs.get('continent_id', None) - - -class CookiesMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for Cookies match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleCookiesConditionParameters". - :vartype odata_type: str - :param selector: Name of Cookies to be matched. - :type selector: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.CookiesOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'selector': {'key': 'selector', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleCookiesConditionParameters" - - def __init__( - self, - **kwargs - ): - super(CookiesMatchConditionParameters, self).__init__(**kwargs) - self.selector = kwargs.get('selector', None) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class CustomDomain(Resource): - """Friendly domain name mapping to the endpoint hostname that the customer provides for branding purposes, e.g. www.contoso.com. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param host_name: The host name of the custom domain. Must be a domain name. - :type host_name: str - :ivar resource_state: Resource status of the custom domain. Possible values include: - "Creating", "Active", "Deleting". - :vartype resource_state: str or ~azure.mgmt.cdn.models.CustomDomainResourceState - :ivar custom_https_provisioning_state: Provisioning status of Custom Https of the custom - domain. Possible values include: "Enabling", "Enabled", "Disabling", "Disabled", "Failed". - :vartype custom_https_provisioning_state: str or - ~azure.mgmt.cdn.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.cdn.models.CustomHttpsProvisioningSubstate - :param validation_data: Special validation or data may be required when delivering CDN to some - regions due to local compliance reasons. E.g. ICP license number of a custom domain is required - to deliver content in China. - :type validation_data: str - :ivar provisioning_state: Provisioning status of the custom domain. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'resource_state': {'readonly': True}, - 'custom_https_provisioning_state': {'readonly': True}, - 'custom_https_provisioning_substate': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - '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'}, - 'validation_data': {'key': 'properties.validationData', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomain, self).__init__(**kwargs) - self.host_name = kwargs.get('host_name', None) - self.resource_state = None - self.custom_https_provisioning_state = None - self.custom_https_provisioning_substate = None - self.validation_data = kwargs.get('validation_data', None) - self.provisioning_state = None - - -class CustomDomainListResult(msrest.serialization.Model): - """Result of the request to list custom domains. It contains a list of custom domain 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 CDN CustomDomains within an endpoint. - :vartype value: list[~azure.mgmt.cdn.models.CustomDomain] - :param next_link: URL to get the next set of custom domain objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CustomDomain]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class CustomDomainParameters(msrest.serialization.Model): - """The customDomain JSON object required for custom domain creation or update. - - :param host_name: The host name of the custom domain. Must be a domain name. - :type host_name: str - """ - - _attribute_map = { - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainParameters, self).__init__(**kwargs) - self.host_name = kwargs.get('host_name', None) - - -class CustomerCertificate(Certificate): - """Customer Certificate used for https. - - All required parameters must be populated in order to send to Azure. - - :param subject: Subject name in the certificate. - :type subject: str - :param expiration_date: Certificate expiration date. - :type expiration_date: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param version: Certificate version. - :type version: str - :param certificate_authority: Certificate issuing authority. - :type certificate_authority: str - :param certificate_url: Required. Complete Url to the certificate. - :type certificate_url: str - :param use_latest_version: Whether to use the latest version for the certificate. - :type use_latest_version: bool - :param subject_alternative_names: The list of SANs. - :type subject_alternative_names: list[str] - """ - - _validation = { - 'certificate_url': {'required': True}, - } - - _attribute_map = { - 'subject': {'key': 'subject', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'certificate_authority': {'key': 'certificateAuthority', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, - 'use_latest_version': {'key': 'useLatestVersion', 'type': 'bool'}, - 'subject_alternative_names': {'key': 'subjectAlternativeNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomerCertificate, self).__init__(**kwargs) - self.version = kwargs.get('version', None) - self.certificate_authority = kwargs.get('certificate_authority', None) - self.certificate_url = kwargs['certificate_url'] - self.use_latest_version = kwargs.get('use_latest_version', None) - self.subject_alternative_names = kwargs.get('subject_alternative_names', None) - - -class SecretParameters(msrest.serialization.Model): - """The json object containing secret parameters. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CustomerCertificateParameters, ManagedCertificateParameters, UrlSigningKeyParameters. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the Secret to create.Constant filled by server. Possible - values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate". - :type type: str or ~azure.mgmt.cdn.models.SecretType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'CustomerCertificate': 'CustomerCertificateParameters', 'ManagedCertificate': 'ManagedCertificateParameters', 'UrlSigningKey': 'UrlSigningKeyParameters'} - } - - def __init__( - self, - **kwargs - ): - super(SecretParameters, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class CustomerCertificateParameters(SecretParameters): - """Customer Certificate used for https. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the Secret to create.Constant filled by server. Possible - values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate". - :type type: str or ~azure.mgmt.cdn.models.SecretType - :param secret_source: Required. Resource reference to the KV secret. - :type secret_source: ~azure.mgmt.cdn.models.ResourceReference - :param secret_version: Version of the secret to be used. - :type secret_version: str - :param certificate_authority: Certificate issuing authority. - :type certificate_authority: str - :param use_latest_version: Whether to use the latest version for the certificate. - :type use_latest_version: bool - :param subject_alternative_names: The list of SANs. - :type subject_alternative_names: list[str] - """ - - _validation = { - 'type': {'required': True}, - 'secret_source': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'secret_source': {'key': 'secretSource', 'type': 'ResourceReference'}, - 'secret_version': {'key': 'secretVersion', 'type': 'str'}, - 'certificate_authority': {'key': 'certificateAuthority', 'type': 'str'}, - 'use_latest_version': {'key': 'useLatestVersion', 'type': 'bool'}, - 'subject_alternative_names': {'key': 'subjectAlternativeNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomerCertificateParameters, self).__init__(**kwargs) - self.type = 'CustomerCertificate' # type: str - self.secret_source = kwargs['secret_source'] - self.secret_version = kwargs.get('secret_version', None) - self.certificate_authority = kwargs.get('certificate_authority', None) - self.use_latest_version = kwargs.get('use_latest_version', None) - self.subject_alternative_names = kwargs.get('subject_alternative_names', None) - - -class CustomRule(msrest.serialization.Model): - """Defines the common attributes for a custom rule that can be included in a waf policy. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Defines the name of the custom rule. - :type name: str - :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.cdn.models.CustomRuleEnabledState - :param priority: Required. Defines in what order this rule be evaluated in the overall list of - custom rules. - :type priority: int - :param match_conditions: Required. List of match conditions. - :type match_conditions: list[~azure.mgmt.cdn.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.cdn.models.ActionType - """ - - _validation = { - 'name': {'required': True}, - 'priority': {'required': True, 'maximum': 1000, 'minimum': 0}, - 'match_conditions': {'required': True}, - 'action': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'priority': {'key': 'priority', '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['name'] - self.enabled_state = kwargs.get('enabled_state', None) - self.priority = kwargs['priority'] - 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.cdn.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 DeepCreatedOrigin(msrest.serialization.Model): - """The main origin of CDN content which is added when creating a CDN endpoint. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Origin name which must be unique within the endpoint. - :type name: str - :param host_name: The address of the origin. It can be a domain name, IPv4 address, or IPv6 - address. This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin - hostname by default. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities - will not be used for load balancing if any lower priority origin is healthy.Must be between 1 - and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 - and 1000. - :type weight: int - :param enabled: Origin is enabled for load balancing or not. By default, origin is always - enabled. - :type enabled: bool - :param private_link_alias: The Alias of the Private Link resource. Populating this optional - field indicates that this origin 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 - :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 - """ - - _validation = { - 'name': {'required': 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 = { - 'name': {'key': 'name', 'type': 'str'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'http_port': {'key': 'properties.httpPort', 'type': 'int'}, - 'https_port': {'key': 'properties.httpsPort', 'type': 'int'}, - 'origin_host_header': {'key': 'properties.originHostHeader', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'weight': {'key': 'properties.weight', 'type': 'int'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'private_link_alias': {'key': 'properties.privateLinkAlias', 'type': 'str'}, - 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, - 'private_link_location': {'key': 'properties.privateLinkLocation', 'type': 'str'}, - 'private_link_approval_message': {'key': 'properties.privateLinkApprovalMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeepCreatedOrigin, self).__init__(**kwargs) - self.name = kwargs['name'] - self.host_name = kwargs.get('host_name', None) - self.http_port = kwargs.get('http_port', None) - self.https_port = kwargs.get('https_port', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.priority = kwargs.get('priority', None) - self.weight = kwargs.get('weight', None) - self.enabled = kwargs.get('enabled', 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_link_approval_message = kwargs.get('private_link_approval_message', None) - - -class DeepCreatedOriginGroup(msrest.serialization.Model): - """The origin group for CDN content which is added when creating a CDN endpoint. Traffic is sent to the origins within the origin group based on origin health. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Origin group name which must be unique within the endpoint. - :type name: str - :param health_probe_settings: Health probe settings to the origin that is used to determine the - health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param origins: The source of the content being delivered via CDN within given origin group. - :type origins: list[~azure.mgmt.cdn.models.ResourceReference] - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift - the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new - endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_origin_error_detection_settings: The JSON object that contains the - properties to determine origin health using real requests/responses.This property is currently - not supported. - :type response_based_origin_error_detection_settings: - ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - """ - - _validation = { - 'name': {'required': True}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'health_probe_settings': {'key': 'properties.healthProbeSettings', 'type': 'HealthProbeParameters'}, - 'origins': {'key': 'properties.origins', 'type': '[ResourceReference]'}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'properties.trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, - 'response_based_origin_error_detection_settings': {'key': 'properties.responseBasedOriginErrorDetectionSettings', 'type': 'ResponseBasedOriginErrorDetectionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeepCreatedOriginGroup, self).__init__(**kwargs) - self.name = kwargs['name'] - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.origins = kwargs.get('origins', None) - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = kwargs.get('traffic_restoration_time_to_healed_or_new_endpoints_in_minutes', None) - self.response_based_origin_error_detection_settings = kwargs.get('response_based_origin_error_detection_settings', None) - - -class DeliveryRule(msrest.serialization.Model): - """A rule that specifies a set of actions and conditions. - - All required parameters must be populated in order to send to Azure. - - :param name: Name of the rule. - :type name: str - :param order: Required. The order in which the rules are applied for the endpoint. Possible - values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater - order. Rule with order 0 is a special rule. It does not require any condition and actions - listed in it will always be applied. - :type order: int - :param conditions: A list of conditions that must be matched for the actions to be executed. - :type conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] - :param actions: Required. A list of actions that are executed when all the conditions of a rule - are satisfied. - :type actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] - """ - - _validation = { - 'order': {'required': True}, - 'actions': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'order': {'key': 'order', 'type': 'int'}, - 'conditions': {'key': 'conditions', 'type': '[DeliveryRuleCondition]'}, - 'actions': {'key': 'actions', 'type': '[DeliveryRuleAction]'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRule, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.order = kwargs['order'] - self.conditions = kwargs.get('conditions', None) - self.actions = kwargs['actions'] - - -class DeliveryRuleAction(msrest.serialization.Model): - """An action for the delivery rule. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DeliveryRuleCacheExpirationAction, DeliveryRuleCacheKeyQueryStringAction, DeliveryRuleRequestHeaderAction, DeliveryRuleResponseHeaderAction, OriginGroupOverrideAction, UrlRedirectAction, UrlRewriteAction, UrlSigningAction. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the action for the delivery rule.Constant filled by server. - Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - _subtype_map = { - 'name': {'CacheExpiration': 'DeliveryRuleCacheExpirationAction', 'CacheKeyQueryString': 'DeliveryRuleCacheKeyQueryStringAction', 'ModifyRequestHeader': 'DeliveryRuleRequestHeaderAction', 'ModifyResponseHeader': 'DeliveryRuleResponseHeaderAction', 'OriginGroupOverride': 'OriginGroupOverrideAction', 'UrlRedirect': 'UrlRedirectAction', 'UrlRewrite': 'UrlRewriteAction', 'UrlSigning': 'UrlSigningAction'} - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleAction, self).__init__(**kwargs) - self.name = None # type: Optional[str] - - -class DeliveryRuleCacheExpirationAction(DeliveryRuleAction): - """Defines the cache expiration action for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the action for the delivery rule.Constant filled by server. - Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.CacheExpirationActionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'CacheExpirationActionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleCacheExpirationAction, self).__init__(**kwargs) - self.name = 'CacheExpiration' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleCacheKeyQueryStringAction(DeliveryRuleAction): - """Defines the cache-key query string action for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the action for the delivery rule.Constant filled by server. - Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.CacheKeyQueryStringActionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'CacheKeyQueryStringActionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleCacheKeyQueryStringAction, self).__init__(**kwargs) - self.name = 'CacheKeyQueryString' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleCondition(msrest.serialization.Model): - """A condition for the delivery rule. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DeliveryRuleCookiesCondition, DeliveryRuleHttpVersionCondition, DeliveryRuleIsDeviceCondition, DeliveryRulePostArgsCondition, DeliveryRuleQueryStringCondition, DeliveryRuleRemoteAddressCondition, DeliveryRuleRequestBodyCondition, DeliveryRuleRequestHeaderCondition, DeliveryRuleRequestMethodCondition, DeliveryRuleRequestSchemeCondition, DeliveryRuleRequestUriCondition, DeliveryRuleUrlFileExtensionCondition, DeliveryRuleUrlFileNameCondition, DeliveryRuleUrlPathCondition. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - _subtype_map = { - 'name': {'Cookies': 'DeliveryRuleCookiesCondition', 'HttpVersion': 'DeliveryRuleHttpVersionCondition', 'IsDevice': 'DeliveryRuleIsDeviceCondition', 'PostArgs': 'DeliveryRulePostArgsCondition', 'QueryString': 'DeliveryRuleQueryStringCondition', 'RemoteAddress': 'DeliveryRuleRemoteAddressCondition', 'RequestBody': 'DeliveryRuleRequestBodyCondition', 'RequestHeader': 'DeliveryRuleRequestHeaderCondition', 'RequestMethod': 'DeliveryRuleRequestMethodCondition', 'RequestScheme': 'DeliveryRuleRequestSchemeCondition', 'RequestUri': 'DeliveryRuleRequestUriCondition', 'UrlFileExtension': 'DeliveryRuleUrlFileExtensionCondition', 'UrlFileName': 'DeliveryRuleUrlFileNameCondition', 'UrlPath': 'DeliveryRuleUrlPathCondition'} - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleCondition, self).__init__(**kwargs) - self.name = None # type: Optional[str] - - -class DeliveryRuleCookiesCondition(DeliveryRuleCondition): - """Defines the Cookies condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.CookiesMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'CookiesMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleCookiesCondition, self).__init__(**kwargs) - self.name = 'Cookies' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleHttpVersionCondition(DeliveryRuleCondition): - """Defines the HttpVersion condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.HttpVersionMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'HttpVersionMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleHttpVersionCondition, self).__init__(**kwargs) - self.name = 'HttpVersion' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleIsDeviceCondition(DeliveryRuleCondition): - """Defines the IsDevice condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.IsDeviceMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'IsDeviceMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleIsDeviceCondition, self).__init__(**kwargs) - self.name = 'IsDevice' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRulePostArgsCondition(DeliveryRuleCondition): - """Defines the PostArgs condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.PostArgsMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'PostArgsMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRulePostArgsCondition, self).__init__(**kwargs) - self.name = 'PostArgs' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleQueryStringCondition(DeliveryRuleCondition): - """Defines the QueryString condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.QueryStringMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'QueryStringMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleQueryStringCondition, self).__init__(**kwargs) - self.name = 'QueryString' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleRemoteAddressCondition(DeliveryRuleCondition): - """Defines the RemoteAddress condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RemoteAddressMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RemoteAddressMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleRemoteAddressCondition, self).__init__(**kwargs) - self.name = 'RemoteAddress' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleRequestBodyCondition(DeliveryRuleCondition): - """Defines the RequestBody condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RequestBodyMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RequestBodyMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleRequestBodyCondition, self).__init__(**kwargs) - self.name = 'RequestBody' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleRequestHeaderAction(DeliveryRuleAction): - """Defines the request header action for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the action for the delivery rule.Constant filled by server. - Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.HeaderActionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'HeaderActionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleRequestHeaderAction, self).__init__(**kwargs) - self.name = 'ModifyRequestHeader' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleRequestHeaderCondition(DeliveryRuleCondition): - """Defines the RequestHeader condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RequestHeaderMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RequestHeaderMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleRequestHeaderCondition, self).__init__(**kwargs) - self.name = 'RequestHeader' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleRequestMethodCondition(DeliveryRuleCondition): - """Defines the RequestMethod condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RequestMethodMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RequestMethodMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleRequestMethodCondition, self).__init__(**kwargs) - self.name = 'RequestMethod' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleRequestSchemeCondition(DeliveryRuleCondition): - """Defines the RequestScheme condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RequestSchemeMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleRequestSchemeCondition, self).__init__(**kwargs) - self.name = 'RequestScheme' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleRequestUriCondition(DeliveryRuleCondition): - """Defines the RequestUri condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RequestUriMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RequestUriMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleRequestUriCondition, self).__init__(**kwargs) - self.name = 'RequestUri' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleResponseHeaderAction(DeliveryRuleAction): - """Defines the response header action for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the action for the delivery rule.Constant filled by server. - Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.HeaderActionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'HeaderActionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleResponseHeaderAction, self).__init__(**kwargs) - self.name = 'ModifyResponseHeader' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleUrlFileExtensionCondition(DeliveryRuleCondition): - """Defines the UrlFileExtension condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.UrlFileExtensionMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlFileExtensionMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleUrlFileExtensionCondition, self).__init__(**kwargs) - self.name = 'UrlFileExtension' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleUrlFileNameCondition(DeliveryRuleCondition): - """Defines the UrlFileName condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.UrlFileNameMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlFileNameMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleUrlFileNameCondition, self).__init__(**kwargs) - self.name = 'UrlFileName' # type: str - self.parameters = kwargs['parameters'] - - -class DeliveryRuleUrlPathCondition(DeliveryRuleCondition): - """Defines the UrlPath condition for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", - "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.UrlPathMatchConditionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlPathMatchConditionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(DeliveryRuleUrlPathCondition, self).__init__(**kwargs) - self.name = 'UrlPath' # type: str - self.parameters = kwargs['parameters'] - - -class DomainValidationProperties(msrest.serialization.Model): - """The JSON object that contains the properties to validate a domain. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar validation_token: Challenge used for DNS TXT record or file based validation. - :vartype validation_token: str - :ivar expiration_date: The date time that the token expires. - :vartype expiration_date: str - """ - - _validation = { - 'validation_token': {'readonly': True}, - 'expiration_date': {'readonly': True}, - } - - _attribute_map = { - 'validation_token': {'key': 'validationToken', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DomainValidationProperties, self).__init__(**kwargs) - self.validation_token = None - self.expiration_date = None - - -class EdgeNode(Resource): - """Edgenode is a global Point of Presence (POP) location used to deliver CDN content to end users. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param ip_address_groups: List of ip address groups. - :type ip_address_groups: list[~azure.mgmt.cdn.models.IpAddressGroup] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'ip_address_groups': {'key': 'properties.ipAddressGroups', 'type': '[IpAddressGroup]'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeNode, self).__init__(**kwargs) - self.ip_address_groups = kwargs.get('ip_address_groups', None) - - -class EdgenodeResult(msrest.serialization.Model): - """Result of the request to list CDN edgenodes. It contains a list of ip address group 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: Edge node of CDN service. - :vartype value: list[~azure.mgmt.cdn.models.EdgeNode] - :param next_link: URL to get the next set of edgenode list results if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EdgeNode]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgenodeResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class Endpoint(TrackedResource): - """CDN endpoint is the entity within a CDN profile containing configuration information such as origin, protocol, content caching and delivery behavior. The CDN endpoint uses the URL format :code:``.azureedge.net. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param origin_path: A directory path on the origin that CDN can use to retrieve content from, - e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param content_types_to_compress: List of content types on which compression applies. The value - should be a valid MIME type. - :type content_types_to_compress: list[str] - :param origin_host_header: The host header value sent to the origin with each request. This - property at Endpoint is only allowed when endpoint uses single origin and can be overridden by - the same property specified at origin.If you leave this blank, the request hostname determines - this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this - host header value to match the origin hostname by default. - :type origin_host_header: str - :param is_compression_enabled: Indicates whether content compression is enabled on CDN. Default - value is false. If compression is enabled, content will be served as compressed if user - requests for a compressed version. Content won't be compressed on CDN when requested content is - smaller than 1 byte or larger than 1 MB. - :type is_compression_enabled: bool - :param is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_http_allowed: bool - :param is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_https_allowed: bool - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or ~azure.mgmt.cdn.models.QueryStringCachingBehavior - :param optimization_type: Specifies what scenario the customer wants this CDN endpoint to - optimize for, e.g. Download, Media services. With this information, CDN can apply scenario - driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", - "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". - :type optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType - :param probe_path: Path to a file hosted on the origin which helps accelerate delivery of the - dynamic content and calculate the most optimal routes for the CDN. This is relative to the - origin path. This property is only relevant when using a single origin. - :type probe_path: str - :param geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each - geo filter defines an access rule to a specified path or content, e.g. block APAC for path - /pictures/. - :type geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] - :param default_origin_group: A reference to the origin group. - :type default_origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param url_signing_keys: List of keys used to validate the signed URL hashes. - :type url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] - :param delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. - :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - the endpoint (if applicable). - :type web_application_firewall_policy_link: - ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink - :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. - contoso.azureedge.net. - :vartype host_name: str - :param origins: The source of the content being delivered via CDN. - :type origins: list[~azure.mgmt.cdn.models.DeepCreatedOrigin] - :param origin_groups: The origin groups comprising of origins that are used for load balancing - the traffic based on availability. - :type origin_groups: list[~azure.mgmt.cdn.models.DeepCreatedOriginGroup] - :ivar resource_state: Resource status of the endpoint. Possible values include: "Creating", - "Deleting", "Running", "Starting", "Stopped", "Stopping". - :vartype resource_state: str or ~azure.mgmt.cdn.models.EndpointResourceState - :ivar provisioning_state: Provisioning status of the endpoint. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'host_name': {'readonly': True}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'origin_path': {'key': 'properties.originPath', 'type': 'str'}, - 'content_types_to_compress': {'key': 'properties.contentTypesToCompress', 'type': '[str]'}, - 'origin_host_header': {'key': 'properties.originHostHeader', 'type': 'str'}, - 'is_compression_enabled': {'key': 'properties.isCompressionEnabled', 'type': 'bool'}, - 'is_http_allowed': {'key': 'properties.isHttpAllowed', 'type': 'bool'}, - 'is_https_allowed': {'key': 'properties.isHttpsAllowed', 'type': 'bool'}, - 'query_string_caching_behavior': {'key': 'properties.queryStringCachingBehavior', 'type': 'str'}, - 'optimization_type': {'key': 'properties.optimizationType', 'type': 'str'}, - 'probe_path': {'key': 'properties.probePath', 'type': 'str'}, - 'geo_filters': {'key': 'properties.geoFilters', 'type': '[GeoFilter]'}, - 'default_origin_group': {'key': 'properties.defaultOriginGroup', 'type': 'ResourceReference'}, - 'url_signing_keys': {'key': 'properties.urlSigningKeys', 'type': '[UrlSigningKey]'}, - 'delivery_policy': {'key': 'properties.deliveryPolicy', 'type': 'EndpointPropertiesUpdateParametersDeliveryPolicy'}, - 'web_application_firewall_policy_link': {'key': 'properties.webApplicationFirewallPolicyLink', 'type': 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'origins': {'key': 'properties.origins', 'type': '[DeepCreatedOrigin]'}, - 'origin_groups': {'key': 'properties.originGroups', 'type': '[DeepCreatedOriginGroup]'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Endpoint, self).__init__(**kwargs) - self.origin_path = kwargs.get('origin_path', None) - self.content_types_to_compress = kwargs.get('content_types_to_compress', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.is_compression_enabled = kwargs.get('is_compression_enabled', None) - self.is_http_allowed = kwargs.get('is_http_allowed', None) - self.is_https_allowed = kwargs.get('is_https_allowed', None) - self.query_string_caching_behavior = kwargs.get('query_string_caching_behavior', None) - self.optimization_type = kwargs.get('optimization_type', None) - self.probe_path = kwargs.get('probe_path', None) - self.geo_filters = kwargs.get('geo_filters', None) - self.default_origin_group = kwargs.get('default_origin_group', None) - self.url_signing_keys = kwargs.get('url_signing_keys', None) - self.delivery_policy = kwargs.get('delivery_policy', None) - self.web_application_firewall_policy_link = kwargs.get('web_application_firewall_policy_link', None) - self.host_name = None - self.origins = kwargs.get('origins', None) - self.origin_groups = kwargs.get('origin_groups', None) - self.resource_state = None - self.provisioning_state = None - - -class EndpointListResult(msrest.serialization.Model): - """Result of the request to list endpoints. It contains a list of 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 CDN endpoints within a profile. - :vartype value: list[~azure.mgmt.cdn.models.Endpoint] - :param next_link: URL to get the next set of endpoint objects if there is any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Endpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class EndpointPropertiesUpdateParameters(msrest.serialization.Model): - """The JSON object containing endpoint update parameters. - - :param origin_path: A directory path on the origin that CDN can use to retrieve content from, - e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param content_types_to_compress: List of content types on which compression applies. The value - should be a valid MIME type. - :type content_types_to_compress: list[str] - :param origin_host_header: The host header value sent to the origin with each request. This - property at Endpoint is only allowed when endpoint uses single origin and can be overridden by - the same property specified at origin.If you leave this blank, the request hostname determines - this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this - host header value to match the origin hostname by default. - :type origin_host_header: str - :param is_compression_enabled: Indicates whether content compression is enabled on CDN. Default - value is false. If compression is enabled, content will be served as compressed if user - requests for a compressed version. Content won't be compressed on CDN when requested content is - smaller than 1 byte or larger than 1 MB. - :type is_compression_enabled: bool - :param is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_http_allowed: bool - :param is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_https_allowed: bool - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or ~azure.mgmt.cdn.models.QueryStringCachingBehavior - :param optimization_type: Specifies what scenario the customer wants this CDN endpoint to - optimize for, e.g. Download, Media services. With this information, CDN can apply scenario - driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", - "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". - :type optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType - :param probe_path: Path to a file hosted on the origin which helps accelerate delivery of the - dynamic content and calculate the most optimal routes for the CDN. This is relative to the - origin path. This property is only relevant when using a single origin. - :type probe_path: str - :param geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each - geo filter defines an access rule to a specified path or content, e.g. block APAC for path - /pictures/. - :type geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] - :param default_origin_group: A reference to the origin group. - :type default_origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param url_signing_keys: List of keys used to validate the signed URL hashes. - :type url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] - :param delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. - :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - the endpoint (if applicable). - :type web_application_firewall_policy_link: - ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink - """ - - _attribute_map = { - 'origin_path': {'key': 'originPath', 'type': 'str'}, - 'content_types_to_compress': {'key': 'contentTypesToCompress', 'type': '[str]'}, - 'origin_host_header': {'key': 'originHostHeader', 'type': 'str'}, - 'is_compression_enabled': {'key': 'isCompressionEnabled', 'type': 'bool'}, - 'is_http_allowed': {'key': 'isHttpAllowed', 'type': 'bool'}, - 'is_https_allowed': {'key': 'isHttpsAllowed', 'type': 'bool'}, - 'query_string_caching_behavior': {'key': 'queryStringCachingBehavior', 'type': 'str'}, - 'optimization_type': {'key': 'optimizationType', 'type': 'str'}, - 'probe_path': {'key': 'probePath', 'type': 'str'}, - 'geo_filters': {'key': 'geoFilters', 'type': '[GeoFilter]'}, - 'default_origin_group': {'key': 'defaultOriginGroup', 'type': 'ResourceReference'}, - 'url_signing_keys': {'key': 'urlSigningKeys', 'type': '[UrlSigningKey]'}, - 'delivery_policy': {'key': 'deliveryPolicy', 'type': 'EndpointPropertiesUpdateParametersDeliveryPolicy'}, - 'web_application_firewall_policy_link': {'key': 'webApplicationFirewallPolicyLink', 'type': 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointPropertiesUpdateParameters, self).__init__(**kwargs) - self.origin_path = kwargs.get('origin_path', None) - self.content_types_to_compress = kwargs.get('content_types_to_compress', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.is_compression_enabled = kwargs.get('is_compression_enabled', None) - self.is_http_allowed = kwargs.get('is_http_allowed', None) - self.is_https_allowed = kwargs.get('is_https_allowed', None) - self.query_string_caching_behavior = kwargs.get('query_string_caching_behavior', None) - self.optimization_type = kwargs.get('optimization_type', None) - self.probe_path = kwargs.get('probe_path', None) - self.geo_filters = kwargs.get('geo_filters', None) - self.default_origin_group = kwargs.get('default_origin_group', None) - self.url_signing_keys = kwargs.get('url_signing_keys', None) - self.delivery_policy = kwargs.get('delivery_policy', None) - self.web_application_firewall_policy_link = kwargs.get('web_application_firewall_policy_link', None) - - -class EndpointProperties(EndpointPropertiesUpdateParameters): - """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. - - All required parameters must be populated in order to send to Azure. - - :param origin_path: A directory path on the origin that CDN can use to retrieve content from, - e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param content_types_to_compress: List of content types on which compression applies. The value - should be a valid MIME type. - :type content_types_to_compress: list[str] - :param origin_host_header: The host header value sent to the origin with each request. This - property at Endpoint is only allowed when endpoint uses single origin and can be overridden by - the same property specified at origin.If you leave this blank, the request hostname determines - this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this - host header value to match the origin hostname by default. - :type origin_host_header: str - :param is_compression_enabled: Indicates whether content compression is enabled on CDN. Default - value is false. If compression is enabled, content will be served as compressed if user - requests for a compressed version. Content won't be compressed on CDN when requested content is - smaller than 1 byte or larger than 1 MB. - :type is_compression_enabled: bool - :param is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_http_allowed: bool - :param is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_https_allowed: bool - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or ~azure.mgmt.cdn.models.QueryStringCachingBehavior - :param optimization_type: Specifies what scenario the customer wants this CDN endpoint to - optimize for, e.g. Download, Media services. With this information, CDN can apply scenario - driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", - "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". - :type optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType - :param probe_path: Path to a file hosted on the origin which helps accelerate delivery of the - dynamic content and calculate the most optimal routes for the CDN. This is relative to the - origin path. This property is only relevant when using a single origin. - :type probe_path: str - :param geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each - geo filter defines an access rule to a specified path or content, e.g. block APAC for path - /pictures/. - :type geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] - :param default_origin_group: A reference to the origin group. - :type default_origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param url_signing_keys: List of keys used to validate the signed URL hashes. - :type url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] - :param delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. - :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - the endpoint (if applicable). - :type web_application_firewall_policy_link: - ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink - :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. - contoso.azureedge.net. - :vartype host_name: str - :param origins: Required. The source of the content being delivered via CDN. - :type origins: list[~azure.mgmt.cdn.models.DeepCreatedOrigin] - :param origin_groups: The origin groups comprising of origins that are used for load balancing - the traffic based on availability. - :type origin_groups: list[~azure.mgmt.cdn.models.DeepCreatedOriginGroup] - :ivar resource_state: Resource status of the endpoint. Possible values include: "Creating", - "Deleting", "Running", "Starting", "Stopped", "Stopping". - :vartype resource_state: str or ~azure.mgmt.cdn.models.EndpointResourceState - :ivar provisioning_state: Provisioning status of the endpoint. - :vartype provisioning_state: str - """ - - _validation = { - 'host_name': {'readonly': True}, - 'origins': {'required': True}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'origin_path': {'key': 'originPath', 'type': 'str'}, - 'content_types_to_compress': {'key': 'contentTypesToCompress', 'type': '[str]'}, - 'origin_host_header': {'key': 'originHostHeader', 'type': 'str'}, - 'is_compression_enabled': {'key': 'isCompressionEnabled', 'type': 'bool'}, - 'is_http_allowed': {'key': 'isHttpAllowed', 'type': 'bool'}, - 'is_https_allowed': {'key': 'isHttpsAllowed', 'type': 'bool'}, - 'query_string_caching_behavior': {'key': 'queryStringCachingBehavior', 'type': 'str'}, - 'optimization_type': {'key': 'optimizationType', 'type': 'str'}, - 'probe_path': {'key': 'probePath', 'type': 'str'}, - 'geo_filters': {'key': 'geoFilters', 'type': '[GeoFilter]'}, - 'default_origin_group': {'key': 'defaultOriginGroup', 'type': 'ResourceReference'}, - 'url_signing_keys': {'key': 'urlSigningKeys', 'type': '[UrlSigningKey]'}, - 'delivery_policy': {'key': 'deliveryPolicy', 'type': 'EndpointPropertiesUpdateParametersDeliveryPolicy'}, - 'web_application_firewall_policy_link': {'key': 'webApplicationFirewallPolicyLink', 'type': 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'origins': {'key': 'origins', 'type': '[DeepCreatedOrigin]'}, - 'origin_groups': {'key': 'originGroups', 'type': '[DeepCreatedOriginGroup]'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointProperties, self).__init__(**kwargs) - self.host_name = None - self.origins = kwargs['origins'] - self.origin_groups = kwargs.get('origin_groups', None) - self.resource_state = None - self.provisioning_state = None - - -class EndpointPropertiesUpdateParametersDeliveryPolicy(msrest.serialization.Model): - """A policy that specifies the delivery rules to be used for an endpoint. - - All required parameters must be populated in order to send to Azure. - - :param description: User-friendly description of the policy. - :type description: str - :param rules: Required. A list of the delivery rules. - :type rules: list[~azure.mgmt.cdn.models.DeliveryRule] - """ - - _validation = { - 'rules': {'required': True}, - } - - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[DeliveryRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointPropertiesUpdateParametersDeliveryPolicy, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.rules = kwargs['rules'] - - -class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(msrest.serialization.Model): - """Defines the Web Application Firewall policy for the endpoint (if applicable). - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class EndpointUpdateParameters(msrest.serialization.Model): - """Properties required to create or update an endpoint. - - :param tags: A set of tags. Endpoint tags. - :type tags: dict[str, str] - :param origin_path: A directory path on the origin that CDN can use to retrieve content from, - e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param content_types_to_compress: List of content types on which compression applies. The value - should be a valid MIME type. - :type content_types_to_compress: list[str] - :param origin_host_header: The host header value sent to the origin with each request. This - property at Endpoint is only allowed when endpoint uses single origin and can be overridden by - the same property specified at origin.If you leave this blank, the request hostname determines - this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this - host header value to match the origin hostname by default. - :type origin_host_header: str - :param is_compression_enabled: Indicates whether content compression is enabled on CDN. Default - value is false. If compression is enabled, content will be served as compressed if user - requests for a compressed version. Content won't be compressed on CDN when requested content is - smaller than 1 byte or larger than 1 MB. - :type is_compression_enabled: bool - :param is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_http_allowed: bool - :param is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_https_allowed: bool - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or ~azure.mgmt.cdn.models.QueryStringCachingBehavior - :param optimization_type: Specifies what scenario the customer wants this CDN endpoint to - optimize for, e.g. Download, Media services. With this information, CDN can apply scenario - driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", - "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". - :type optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType - :param probe_path: Path to a file hosted on the origin which helps accelerate delivery of the - dynamic content and calculate the most optimal routes for the CDN. This is relative to the - origin path. This property is only relevant when using a single origin. - :type probe_path: str - :param geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each - geo filter defines an access rule to a specified path or content, e.g. block APAC for path - /pictures/. - :type geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] - :param default_origin_group: A reference to the origin group. - :type default_origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param url_signing_keys: List of keys used to validate the signed URL hashes. - :type url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] - :param delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. - :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - the endpoint (if applicable). - :type web_application_firewall_policy_link: - ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'origin_path': {'key': 'properties.originPath', 'type': 'str'}, - 'content_types_to_compress': {'key': 'properties.contentTypesToCompress', 'type': '[str]'}, - 'origin_host_header': {'key': 'properties.originHostHeader', 'type': 'str'}, - 'is_compression_enabled': {'key': 'properties.isCompressionEnabled', 'type': 'bool'}, - 'is_http_allowed': {'key': 'properties.isHttpAllowed', 'type': 'bool'}, - 'is_https_allowed': {'key': 'properties.isHttpsAllowed', 'type': 'bool'}, - 'query_string_caching_behavior': {'key': 'properties.queryStringCachingBehavior', 'type': 'str'}, - 'optimization_type': {'key': 'properties.optimizationType', 'type': 'str'}, - 'probe_path': {'key': 'properties.probePath', 'type': 'str'}, - 'geo_filters': {'key': 'properties.geoFilters', 'type': '[GeoFilter]'}, - 'default_origin_group': {'key': 'properties.defaultOriginGroup', 'type': 'ResourceReference'}, - 'url_signing_keys': {'key': 'properties.urlSigningKeys', 'type': '[UrlSigningKey]'}, - 'delivery_policy': {'key': 'properties.deliveryPolicy', 'type': 'EndpointPropertiesUpdateParametersDeliveryPolicy'}, - 'web_application_firewall_policy_link': {'key': 'properties.webApplicationFirewallPolicyLink', 'type': 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.origin_path = kwargs.get('origin_path', None) - self.content_types_to_compress = kwargs.get('content_types_to_compress', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.is_compression_enabled = kwargs.get('is_compression_enabled', None) - self.is_http_allowed = kwargs.get('is_http_allowed', None) - self.is_https_allowed = kwargs.get('is_https_allowed', None) - self.query_string_caching_behavior = kwargs.get('query_string_caching_behavior', None) - self.optimization_type = kwargs.get('optimization_type', None) - self.probe_path = kwargs.get('probe_path', None) - self.geo_filters = kwargs.get('geo_filters', None) - self.default_origin_group = kwargs.get('default_origin_group', None) - self.url_signing_keys = kwargs.get('url_signing_keys', None) - self.delivery_policy = kwargs.get('delivery_policy', None) - self.web_application_firewall_policy_link = kwargs.get('web_application_firewall_policy_link', None) - - -class ErrorResponse(msrest.serialization.Model): - """Error response indicates CDN 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 GeoFilter(msrest.serialization.Model): - """Rules defining user's geo access within a CDN endpoint. - - All required parameters must be populated in order to send to Azure. - - :param relative_path: Required. Relative path applicable to geo filter. (e.g. '/mypictures', - '/mypicture/kitty.jpg', and etc.). - :type relative_path: str - :param action: Required. Action of the geo filter, i.e. allow or block access. Possible values - include: "Block", "Allow". - :type action: str or ~azure.mgmt.cdn.models.GeoFilterActions - :param country_codes: Required. Two letter country codes defining user country access in a geo - filter, e.g. AU, MX, US. - :type country_codes: list[str] - """ - - _validation = { - 'relative_path': {'required': True}, - 'action': {'required': True}, - 'country_codes': {'required': True}, - } - - _attribute_map = { - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - 'country_codes': {'key': 'countryCodes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoFilter, self).__init__(**kwargs) - self.relative_path = kwargs['relative_path'] - self.action = kwargs['action'] - self.country_codes = kwargs['country_codes'] - - -class HeaderActionParameters(msrest.serialization.Model): - """Defines the parameters for the request header action. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleHeaderActionParameters". - :vartype odata_type: str - :param header_action: Required. Action to perform. Possible values include: "Append", - "Overwrite", "Delete". - :type header_action: str or ~azure.mgmt.cdn.models.HeaderAction - :param header_name: Required. Name of the header to modify. - :type header_name: str - :param value: Value for the specified action. - :type value: str - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'header_action': {'required': True}, - 'header_name': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'header_action': {'key': 'headerAction', 'type': 'str'}, - 'header_name': {'key': 'headerName', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleHeaderActionParameters" - - def __init__( - self, - **kwargs - ): - super(HeaderActionParameters, self).__init__(**kwargs) - self.header_action = kwargs['header_action'] - self.header_name = kwargs['header_name'] - self.value = kwargs.get('value', None) - - -class HealthProbeParameters(msrest.serialization.Model): - """The JSON object that contains the properties to send health probes to origin. - - :param probe_path: The path relative to the origin that is used to determine the health of the - origin. - :type probe_path: str - :param probe_request_type: The type of health probe request that is made. Possible values - include: "NotSet", "GET", "HEAD". - :type probe_request_type: str or ~azure.mgmt.cdn.models.HealthProbeRequestType - :param probe_protocol: Protocol to use for health probe. Possible values include: "NotSet", - "Http", "Https". - :type probe_protocol: str or ~azure.mgmt.cdn.models.ProbeProtocol - :param probe_interval_in_seconds: The number of seconds between health probes.Default is - 240sec. - :type probe_interval_in_seconds: int - """ - - _validation = { - 'probe_interval_in_seconds': {'maximum': 255, 'minimum': 1}, - } - - _attribute_map = { - 'probe_path': {'key': 'probePath', 'type': 'str'}, - 'probe_request_type': {'key': 'probeRequestType', 'type': 'str'}, - 'probe_protocol': {'key': 'probeProtocol', 'type': 'str'}, - 'probe_interval_in_seconds': {'key': 'probeIntervalInSeconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(HealthProbeParameters, self).__init__(**kwargs) - self.probe_path = kwargs.get('probe_path', None) - self.probe_request_type = kwargs.get('probe_request_type', None) - self.probe_protocol = kwargs.get('probe_protocol', None) - self.probe_interval_in_seconds = kwargs.get('probe_interval_in_seconds', None) - - -class HttpErrorRangeParameters(msrest.serialization.Model): - """The JSON object that represents the range for http status codes. - - :param begin: The inclusive start of the http status code range. - :type begin: int - :param end: The inclusive end of the http status code range. - :type end: int - """ - - _validation = { - 'begin': {'maximum': 999, 'minimum': 100}, - 'end': {'maximum': 999, 'minimum': 100}, - } - - _attribute_map = { - 'begin': {'key': 'begin', 'type': 'int'}, - 'end': {'key': 'end', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(HttpErrorRangeParameters, self).__init__(**kwargs) - self.begin = kwargs.get('begin', None) - self.end = kwargs.get('end', None) - - -class HttpVersionMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for HttpVersion match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleHttpVersionConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Equal". - :type operator: str or ~azure.mgmt.cdn.models.HttpVersionOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleHttpVersionConditionParameters" - - def __init__( - self, - **kwargs - ): - super(HttpVersionMatchConditionParameters, self).__init__(**kwargs) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - - -class IpAddressGroup(msrest.serialization.Model): - """CDN Ip address group. - - :param delivery_region: The delivery region of the ip address group. - :type delivery_region: str - :param ipv4_addresses: The list of ip v4 addresses. - :type ipv4_addresses: list[~azure.mgmt.cdn.models.CidrIpAddress] - :param ipv6_addresses: The list of ip v6 addresses. - :type ipv6_addresses: list[~azure.mgmt.cdn.models.CidrIpAddress] - """ - - _attribute_map = { - 'delivery_region': {'key': 'deliveryRegion', 'type': 'str'}, - 'ipv4_addresses': {'key': 'ipv4Addresses', 'type': '[CidrIpAddress]'}, - 'ipv6_addresses': {'key': 'ipv6Addresses', 'type': '[CidrIpAddress]'}, - } - - def __init__( - self, - **kwargs - ): - super(IpAddressGroup, self).__init__(**kwargs) - self.delivery_region = kwargs.get('delivery_region', None) - self.ipv4_addresses = kwargs.get('ipv4_addresses', None) - self.ipv6_addresses = kwargs.get('ipv6_addresses', None) - - -class IsDeviceMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for IsDevice match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleIsDeviceConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Equal". - :type operator: str or ~azure.mgmt.cdn.models.IsDeviceOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str or - ~azure.mgmt.cdn.models.IsDeviceMatchConditionParametersMatchValuesItem] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleIsDeviceConditionParameters" - - def __init__( - self, - **kwargs - ): - super(IsDeviceMatchConditionParameters, self).__init__(**kwargs) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class KeyVaultCertificateSourceParameters(msrest.serialization.Model): - """Describes the parameters for using a user's KeyVault certificate for securing custom domain. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.KeyVaultCertificateSourceParameters". - :vartype odata_type: str - :param subscription_id: Required. Subscription Id of the user's Key Vault containing the SSL - certificate. - :type subscription_id: str - :param resource_group_name: Required. Resource group of the user's Key Vault containing the SSL - certificate. - :type resource_group_name: str - :param vault_name: Required. The name of the user's Key Vault containing the SSL certificate. - :type vault_name: str - :param secret_name: Required. The name of Key Vault Secret (representing the full certificate - PFX) in Key Vault. - :type secret_name: str - :param secret_version: The version(GUID) of Key Vault Secret in Key Vault. - :type secret_version: str - :param update_rule: Required. Describes the action that shall be taken when the certificate is - updated in Key Vault. Possible values include: "NoAction". - :type update_rule: str or ~azure.mgmt.cdn.models.UpdateRule - :param delete_rule: Required. Describes the action that shall be taken when the certificate is - removed from Key Vault. Possible values include: "NoAction". - :type delete_rule: str or ~azure.mgmt.cdn.models.DeleteRule - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'subscription_id': {'required': True}, - 'resource_group_name': {'required': True}, - 'vault_name': {'required': True}, - 'secret_name': {'required': True}, - 'update_rule': {'required': True}, - 'delete_rule': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, - 'vault_name': {'key': 'vaultName', 'type': 'str'}, - 'secret_name': {'key': 'secretName', 'type': 'str'}, - 'secret_version': {'key': 'secretVersion', 'type': 'str'}, - 'update_rule': {'key': 'updateRule', 'type': 'str'}, - 'delete_rule': {'key': 'deleteRule', 'type': 'str'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.KeyVaultCertificateSourceParameters" - - def __init__( - self, - **kwargs - ): - super(KeyVaultCertificateSourceParameters, self).__init__(**kwargs) - self.subscription_id = kwargs['subscription_id'] - self.resource_group_name = kwargs['resource_group_name'] - self.vault_name = kwargs['vault_name'] - self.secret_name = kwargs['secret_name'] - self.secret_version = kwargs.get('secret_version', None) - self.update_rule = kwargs['update_rule'] - self.delete_rule = kwargs['delete_rule'] - - -class KeyVaultSigningKeyParameters(msrest.serialization.Model): - """Describes the parameters for using a user's KeyVault for URL Signing Key. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.KeyVaultSigningKeyParameters". - :vartype odata_type: str - :param subscription_id: Required. Subscription Id of the user's Key Vault containing the - secret. - :type subscription_id: str - :param resource_group_name: Required. Resource group of the user's Key Vault containing the - secret. - :type resource_group_name: str - :param vault_name: Required. The name of the user's Key Vault containing the secret. - :type vault_name: str - :param secret_name: Required. The name of secret in Key Vault. - :type secret_name: str - :param secret_version: Required. The version(GUID) of secret in Key Vault. - :type secret_version: str - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'subscription_id': {'required': True}, - 'resource_group_name': {'required': True}, - 'vault_name': {'required': True}, - 'secret_name': {'required': True}, - 'secret_version': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, - 'vault_name': {'key': 'vaultName', 'type': 'str'}, - 'secret_name': {'key': 'secretName', 'type': 'str'}, - 'secret_version': {'key': 'secretVersion', 'type': 'str'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.KeyVaultSigningKeyParameters" - - def __init__( - self, - **kwargs - ): - super(KeyVaultSigningKeyParameters, self).__init__(**kwargs) - self.subscription_id = kwargs['subscription_id'] - self.resource_group_name = kwargs['resource_group_name'] - self.vault_name = kwargs['vault_name'] - self.secret_name = kwargs['secret_name'] - self.secret_version = kwargs['secret_version'] - - -class LoadBalancingSettingsParameters(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_in_milliseconds: The additional latency in milliseconds for probes to - fall into the lowest latency bucket. - :type additional_latency_in_milliseconds: int - """ - - _attribute_map = { - 'sample_size': {'key': 'sampleSize', 'type': 'int'}, - 'successful_samples_required': {'key': 'successfulSamplesRequired', 'type': 'int'}, - 'additional_latency_in_milliseconds': {'key': 'additionalLatencyInMilliseconds', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadBalancingSettingsParameters, self).__init__(**kwargs) - self.sample_size = kwargs.get('sample_size', None) - self.successful_samples_required = kwargs.get('successful_samples_required', None) - self.additional_latency_in_milliseconds = kwargs.get('additional_latency_in_milliseconds', None) - - -class LoadParameters(msrest.serialization.Model): - """Parameters required for content load. - - All required parameters must be populated in order to send to Azure. - - :param content_paths: Required. The path to the content to be loaded. Path should be a relative - file URL of the origin. - :type content_paths: list[str] - """ - - _validation = { - 'content_paths': {'required': True}, - } - - _attribute_map = { - 'content_paths': {'key': 'contentPaths', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(LoadParameters, self).__init__(**kwargs) - self.content_paths = kwargs['content_paths'] - - -class ManagedCertificate(Certificate): - """Managed Certificate used for https. - - :param subject: Subject name in the certificate. - :type subject: str - :param expiration_date: Certificate expiration date. - :type expiration_date: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - """ - - _attribute_map = { - 'subject': {'key': 'subject', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedCertificate, self).__init__(**kwargs) - - -class ManagedCertificateParameters(SecretParameters): - """Managed Certificate used for https. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the Secret to create.Constant filled by server. Possible - values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate". - :type type: str or ~azure.mgmt.cdn.models.SecretType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedCertificateParameters, self).__init__(**kwargs) - self.type = 'ManagedCertificate' # type: str - - -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 description: Describes the functionality of the managed rule. - :vartype description: str - """ - - _validation = { - 'rule_id': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleDefinition, self).__init__(**kwargs) - self.rule_id = None - self.description = None - - -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.cdn.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 within the rule set to - override. - :type rule_group_name: str - :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.cdn.models.ManagedRuleOverride] - """ - - _validation = { - 'rule_group_name': {'required': True}, - } - - _attribute_map = { - 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[ManagedRuleOverride]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedRuleGroupOverride, self).__init__(**kwargs) - self.rule_group_name = kwargs['rule_group_name'] - 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.cdn.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.cdn.models.ActionType - """ - - _validation = { - 'rule_id': {'required': True}, - } - - _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, - } - - 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) - - -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 anomaly_score: Verizon only : If the rule set supports anomaly detection mode, this - describes the threshold for blocking requests. - :type anomaly_score: int - :param rule_group_overrides: Defines the rule overrides to apply to the rule set. - :type rule_group_overrides: list[~azure.mgmt.cdn.models.ManagedRuleGroupOverride] - """ - - _validation = { - 'rule_set_type': {'required': True}, - 'rule_set_version': {'required': True}, - 'anomaly_score': {'maximum': 20, 'minimum': 0}, - } - - _attribute_map = { - 'rule_set_type': {'key': 'ruleSetType', 'type': 'str'}, - 'rule_set_version': {'key': 'ruleSetVersion', 'type': 'str'}, - 'anomaly_score': {'key': 'anomalyScore', 'type': 'int'}, - '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.anomaly_score = kwargs.get('anomaly_score', None) - self.rule_group_overrides = kwargs.get('rule_group_overrides', None) - - -class ManagedRuleSetDefinition(Resource): - """Describes 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param sku: The pricing tier (defines a CDN provider, feature list and rate) of the - CdnWebApplicationFirewallPolicy. - :type sku: ~azure.mgmt.cdn.models.Sku - :ivar provisioning_state: Provisioning state of the managed rule set. - :vartype provisioning_state: 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.cdn.models.ManagedRuleGroupDefinition] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'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'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'provisioning_state': {'key': 'properties.provisioningState', '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.sku = kwargs.get('sku', None) - self.provisioning_state = 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.cdn.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.cdn.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 match conditions. - - All required parameters must be populated in order to send to Azure. - - :param match_variable: Required. Match variable to compare against. Possible values include: - "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", - "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", - "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type match_variable: str or ~azure.mgmt.cdn.models.MatchVariable - :param selector: Selector can used to match a specific key for QueryString, Cookies, - RequestHeader or PostArgs. - :type selector: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", "GreaterThan", "LessThanOrEqual", - "GreaterThanOrEqual", "BeginsWith", "EndsWith", "RegEx". - :type operator: str or ~azure.mgmt.cdn.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.cdn.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 MetricsResponse(msrest.serialization.Model): - """Metrics Response. - - :param date_time_begin: - :type date_time_begin: ~datetime.datetime - :param date_time_end: - :type date_time_end: ~datetime.datetime - :param granularity: Possible values include: "PT5M", "PT1H", "P1D". - :type granularity: str or ~azure.mgmt.cdn.models.MetricsResponseGranularity - :param series: - :type series: list[~azure.mgmt.cdn.models.MetricsResponseSeriesItem] - """ - - _attribute_map = { - 'date_time_begin': {'key': 'dateTimeBegin', 'type': 'iso-8601'}, - 'date_time_end': {'key': 'dateTimeEnd', 'type': 'iso-8601'}, - 'granularity': {'key': 'granularity', 'type': 'str'}, - 'series': {'key': 'series', 'type': '[MetricsResponseSeriesItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricsResponse, self).__init__(**kwargs) - self.date_time_begin = kwargs.get('date_time_begin', None) - self.date_time_end = kwargs.get('date_time_end', None) - self.granularity = kwargs.get('granularity', None) - self.series = kwargs.get('series', None) - - -class MetricsResponseSeriesItem(msrest.serialization.Model): - """MetricsResponseSeriesItem. - - :param metric: - :type metric: str - :param unit: Possible values include: "count", "bytes", "bitsPerSecond". - :type unit: str or ~azure.mgmt.cdn.models.MetricsResponseSeriesItemUnit - :param groups: - :type groups: list[~azure.mgmt.cdn.models.MetricsResponseSeriesPropertiesItemsItem] - :param data: - :type data: - list[~azure.mgmt.cdn.models.Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems] - """ - - _attribute_map = { - 'metric': {'key': 'metric', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[MetricsResponseSeriesPropertiesItemsItem]'}, - 'data': {'key': 'data', 'type': '[Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricsResponseSeriesItem, self).__init__(**kwargs) - self.metric = kwargs.get('metric', None) - self.unit = kwargs.get('unit', None) - self.groups = kwargs.get('groups', None) - self.data = kwargs.get('data', None) - - -class MetricsResponseSeriesPropertiesItemsItem(msrest.serialization.Model): - """MetricsResponseSeriesPropertiesItemsItem. - - :param name: - :type name: str - :param value: - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricsResponseSeriesPropertiesItemsItem, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class Operation(msrest.serialization.Model): - """CDN REST API operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.cdn.models.OperationDisplay - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = None - self.display = kwargs.get('display', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: Service provider: Microsoft.Cdn. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. - :vartype operation: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - - -class OperationsListResult(msrest.serialization.Model): - """Result of the request to list CDN operations. It contains a list of operations 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 CDN operations supported by the CDN resource provider. - :vartype value: list[~azure.mgmt.cdn.models.Operation] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class Origin(Resource): - """CDN origin is the source of the content being delivered via CDN. When the edge nodes represented by an endpoint do not have the requested content cached, they attempt to fetch it from one or more of the configured origins. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses - are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin - hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities - will not be used for load balancing if any lower priority origin is healthy.Must be between 1 - and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 - and 1000. - :type weight: int - :param enabled: Origin is enabled for load balancing or not. - :type enabled: bool - :param private_link_alias: The Alias of the Private Link resource. Populating this optional - field indicates that this origin 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 - :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 - :ivar resource_state: Resource status of the origin. Possible values include: "Creating", - "Active", "Deleting". - :vartype resource_state: str or ~azure.mgmt.cdn.models.OriginResourceState - :ivar provisioning_state: Provisioning status of the origin. - :vartype provisioning_state: 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.cdn.models.PrivateEndpointStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'private_endpoint_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'http_port': {'key': 'properties.httpPort', 'type': 'int'}, - 'https_port': {'key': 'properties.httpsPort', 'type': 'int'}, - 'origin_host_header': {'key': 'properties.originHostHeader', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'weight': {'key': 'properties.weight', 'type': 'int'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'private_link_alias': {'key': 'properties.privateLinkAlias', 'type': 'str'}, - 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, - 'private_link_location': {'key': 'properties.privateLinkLocation', 'type': 'str'}, - 'private_link_approval_message': {'key': 'properties.privateLinkApprovalMessage', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint_status': {'key': 'properties.privateEndpointStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Origin, self).__init__(**kwargs) - self.host_name = kwargs.get('host_name', None) - self.http_port = kwargs.get('http_port', None) - self.https_port = kwargs.get('https_port', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.priority = kwargs.get('priority', None) - self.weight = kwargs.get('weight', None) - self.enabled = kwargs.get('enabled', 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_link_approval_message = kwargs.get('private_link_approval_message', None) - self.resource_state = None - self.provisioning_state = None - self.private_endpoint_status = None - - -class OriginGroup(Resource): - """Origin group comprising of origins is used for load balancing to origins when the content cannot be served from CDN. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param health_probe_settings: Health probe settings to the origin that is used to determine the - health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param origins: The source of the content being delivered via CDN within given origin group. - :type origins: list[~azure.mgmt.cdn.models.ResourceReference] - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift - the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new - endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_origin_error_detection_settings: The JSON object that contains the - properties to determine origin health using real requests/responses. This property is currently - not supported. - :type response_based_origin_error_detection_settings: - ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - :ivar resource_state: Resource status of the origin group. Possible values include: "Creating", - "Active", "Deleting". - :vartype resource_state: str or ~azure.mgmt.cdn.models.OriginGroupResourceState - :ivar provisioning_state: Provisioning status of the origin group. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'health_probe_settings': {'key': 'properties.healthProbeSettings', 'type': 'HealthProbeParameters'}, - 'origins': {'key': 'properties.origins', 'type': '[ResourceReference]'}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'properties.trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, - 'response_based_origin_error_detection_settings': {'key': 'properties.responseBasedOriginErrorDetectionSettings', 'type': 'ResponseBasedOriginErrorDetectionParameters'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OriginGroup, self).__init__(**kwargs) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.origins = kwargs.get('origins', None) - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = kwargs.get('traffic_restoration_time_to_healed_or_new_endpoints_in_minutes', None) - self.response_based_origin_error_detection_settings = kwargs.get('response_based_origin_error_detection_settings', None) - self.resource_state = None - self.provisioning_state = None - - -class OriginGroupListResult(msrest.serialization.Model): - """Result of the request to list origin groups. It contains a list of origin groups 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 CDN origin groups within an endpoint. - :vartype value: list[~azure.mgmt.cdn.models.OriginGroup] - :param next_link: URL to get the next set of origin objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OriginGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OriginGroupListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class OriginGroupOverrideAction(DeliveryRuleAction): - """Defines the origin group override action for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the action for the delivery rule.Constant filled by server. - Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.OriginGroupOverrideActionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'OriginGroupOverrideActionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(OriginGroupOverrideAction, self).__init__(**kwargs) - self.name = 'OriginGroupOverride' # type: str - self.parameters = kwargs['parameters'] - - -class OriginGroupOverrideActionParameters(msrest.serialization.Model): - """Defines the parameters for the origin group override action. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleOriginGroupOverrideActionParameters". - :vartype odata_type: str - :param origin_group: Required. defines the OriginGroup that would override the - DefaultOriginGroup. - :type origin_group: ~azure.mgmt.cdn.models.ResourceReference - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'origin_group': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'origin_group': {'key': 'originGroup', 'type': 'ResourceReference'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleOriginGroupOverrideActionParameters" - - def __init__( - self, - **kwargs - ): - super(OriginGroupOverrideActionParameters, self).__init__(**kwargs) - self.origin_group = kwargs['origin_group'] - - -class OriginGroupUpdatePropertiesParameters(msrest.serialization.Model): - """The JSON object that contains the properties of the origin group. - - :param health_probe_settings: Health probe settings to the origin that is used to determine the - health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param origins: The source of the content being delivered via CDN within given origin group. - :type origins: list[~azure.mgmt.cdn.models.ResourceReference] - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift - the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new - endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_origin_error_detection_settings: The JSON object that contains the - properties to determine origin health using real requests/responses. This property is currently - not supported. - :type response_based_origin_error_detection_settings: - ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - """ - - _validation = { - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, - } - - _attribute_map = { - 'health_probe_settings': {'key': 'healthProbeSettings', 'type': 'HealthProbeParameters'}, - 'origins': {'key': 'origins', 'type': '[ResourceReference]'}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, - 'response_based_origin_error_detection_settings': {'key': 'responseBasedOriginErrorDetectionSettings', 'type': 'ResponseBasedOriginErrorDetectionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(OriginGroupUpdatePropertiesParameters, self).__init__(**kwargs) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.origins = kwargs.get('origins', None) - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = kwargs.get('traffic_restoration_time_to_healed_or_new_endpoints_in_minutes', None) - self.response_based_origin_error_detection_settings = kwargs.get('response_based_origin_error_detection_settings', None) - - -class OriginGroupProperties(OriginGroupUpdatePropertiesParameters): - """The JSON object that contains the properties of the origin group. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param health_probe_settings: Health probe settings to the origin that is used to determine the - health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param origins: The source of the content being delivered via CDN within given origin group. - :type origins: list[~azure.mgmt.cdn.models.ResourceReference] - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift - the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new - endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_origin_error_detection_settings: The JSON object that contains the - properties to determine origin health using real requests/responses. This property is currently - not supported. - :type response_based_origin_error_detection_settings: - ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - :ivar resource_state: Resource status of the origin group. Possible values include: "Creating", - "Active", "Deleting". - :vartype resource_state: str or ~azure.mgmt.cdn.models.OriginGroupResourceState - :ivar provisioning_state: Provisioning status of the origin group. - :vartype provisioning_state: str - """ - - _validation = { - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'health_probe_settings': {'key': 'healthProbeSettings', 'type': 'HealthProbeParameters'}, - 'origins': {'key': 'origins', 'type': '[ResourceReference]'}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, - 'response_based_origin_error_detection_settings': {'key': 'responseBasedOriginErrorDetectionSettings', 'type': 'ResponseBasedOriginErrorDetectionParameters'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OriginGroupProperties, self).__init__(**kwargs) - self.resource_state = None - self.provisioning_state = None - - -class OriginGroupUpdateParameters(msrest.serialization.Model): - """Origin group properties needed for origin group creation or update. - - :param health_probe_settings: Health probe settings to the origin that is used to determine the - health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param origins: The source of the content being delivered via CDN within given origin group. - :type origins: list[~azure.mgmt.cdn.models.ResourceReference] - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift - the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new - endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_origin_error_detection_settings: The JSON object that contains the - properties to determine origin health using real requests/responses. This property is currently - not supported. - :type response_based_origin_error_detection_settings: - ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - """ - - _validation = { - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, - } - - _attribute_map = { - 'health_probe_settings': {'key': 'properties.healthProbeSettings', 'type': 'HealthProbeParameters'}, - 'origins': {'key': 'properties.origins', 'type': '[ResourceReference]'}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'properties.trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, - 'response_based_origin_error_detection_settings': {'key': 'properties.responseBasedOriginErrorDetectionSettings', 'type': 'ResponseBasedOriginErrorDetectionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(OriginGroupUpdateParameters, self).__init__(**kwargs) - self.health_probe_settings = kwargs.get('health_probe_settings', None) - self.origins = kwargs.get('origins', None) - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = kwargs.get('traffic_restoration_time_to_healed_or_new_endpoints_in_minutes', None) - self.response_based_origin_error_detection_settings = kwargs.get('response_based_origin_error_detection_settings', None) - - -class OriginListResult(msrest.serialization.Model): - """Result of the request to list origins. It contains a list of origin 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 CDN origins within an endpoint. - :vartype value: list[~azure.mgmt.cdn.models.Origin] - :param next_link: URL to get the next set of origin objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Origin]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OriginListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class OriginUpdatePropertiesParameters(msrest.serialization.Model): - """The JSON object that contains the properties of the origin. - - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses - are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin - hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities - will not be used for load balancing if any lower priority origin is healthy.Must be between 1 - and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 - and 1000. - :type weight: int - :param enabled: Origin is enabled for load balancing or not. - :type enabled: bool - :param private_link_alias: The Alias of the Private Link resource. Populating this optional - field indicates that this origin 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 - :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 - """ - - _validation = { - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, - } - - _attribute_map = { - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'http_port': {'key': 'httpPort', 'type': 'int'}, - 'https_port': {'key': 'httpsPort', 'type': 'int'}, - 'origin_host_header': {'key': 'originHostHeader', 'type': 'str'}, - 'priority': {'key': 'priority', 'type': 'int'}, - 'weight': {'key': 'weight', 'type': 'int'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'private_link_alias': {'key': 'privateLinkAlias', 'type': 'str'}, - 'private_link_resource_id': {'key': 'privateLinkResourceId', 'type': 'str'}, - 'private_link_location': {'key': 'privateLinkLocation', 'type': 'str'}, - 'private_link_approval_message': {'key': 'privateLinkApprovalMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OriginUpdatePropertiesParameters, self).__init__(**kwargs) - self.host_name = kwargs.get('host_name', None) - self.http_port = kwargs.get('http_port', None) - self.https_port = kwargs.get('https_port', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.priority = kwargs.get('priority', None) - self.weight = kwargs.get('weight', None) - self.enabled = kwargs.get('enabled', 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_link_approval_message = kwargs.get('private_link_approval_message', None) - - -class OriginProperties(OriginUpdatePropertiesParameters): - """The JSON object that contains the properties of the origin. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses - are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin - hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities - will not be used for load balancing if any lower priority origin is healthy.Must be between 1 - and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 - and 1000. - :type weight: int - :param enabled: Origin is enabled for load balancing or not. - :type enabled: bool - :param private_link_alias: The Alias of the Private Link resource. Populating this optional - field indicates that this origin 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 - :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 - :ivar resource_state: Resource status of the origin. Possible values include: "Creating", - "Active", "Deleting". - :vartype resource_state: str or ~azure.mgmt.cdn.models.OriginResourceState - :ivar provisioning_state: Provisioning status of the origin. - :vartype provisioning_state: 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.cdn.models.PrivateEndpointStatus - """ - - _validation = { - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'private_endpoint_status': {'readonly': True}, - } - - _attribute_map = { - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'http_port': {'key': 'httpPort', 'type': 'int'}, - 'https_port': {'key': 'httpsPort', 'type': 'int'}, - 'origin_host_header': {'key': 'originHostHeader', 'type': 'str'}, - 'priority': {'key': 'priority', 'type': 'int'}, - 'weight': {'key': 'weight', 'type': 'int'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'private_link_alias': {'key': 'privateLinkAlias', 'type': 'str'}, - 'private_link_resource_id': {'key': 'privateLinkResourceId', 'type': 'str'}, - 'private_link_location': {'key': 'privateLinkLocation', 'type': 'str'}, - 'private_link_approval_message': {'key': 'privateLinkApprovalMessage', 'type': 'str'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'private_endpoint_status': {'key': 'privateEndpointStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OriginProperties, self).__init__(**kwargs) - self.resource_state = None - self.provisioning_state = None - self.private_endpoint_status = None - - -class OriginUpdateParameters(msrest.serialization.Model): - """Origin properties needed for origin update. - - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses - are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin - hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities - will not be used for load balancing if any lower priority origin is healthy.Must be between 1 - and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 - and 1000. - :type weight: int - :param enabled: Origin is enabled for load balancing or not. - :type enabled: bool - :param private_link_alias: The Alias of the Private Link resource. Populating this optional - field indicates that this origin 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 - :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 - """ - - _validation = { - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, - } - - _attribute_map = { - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'http_port': {'key': 'properties.httpPort', 'type': 'int'}, - 'https_port': {'key': 'properties.httpsPort', 'type': 'int'}, - 'origin_host_header': {'key': 'properties.originHostHeader', 'type': 'str'}, - 'priority': {'key': 'properties.priority', 'type': 'int'}, - 'weight': {'key': 'properties.weight', 'type': 'int'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'private_link_alias': {'key': 'properties.privateLinkAlias', 'type': 'str'}, - 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, - 'private_link_location': {'key': 'properties.privateLinkLocation', 'type': 'str'}, - 'private_link_approval_message': {'key': 'properties.privateLinkApprovalMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OriginUpdateParameters, self).__init__(**kwargs) - self.host_name = kwargs.get('host_name', None) - self.http_port = kwargs.get('http_port', None) - self.https_port = kwargs.get('https_port', None) - self.origin_host_header = kwargs.get('origin_host_header', None) - self.priority = kwargs.get('priority', None) - self.weight = kwargs.get('weight', None) - self.enabled = kwargs.get('enabled', 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_link_approval_message = kwargs.get('private_link_approval_message', None) - - -class PolicySettings(msrest.serialization.Model): - """Defines contents of a web application firewall global configuration. - - :param enabled_state: describes if the policy is in enabled state or disabled state. Possible - values include: "Disabled", "Enabled". - :type enabled_state: str or ~azure.mgmt.cdn.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.cdn.models.PolicyMode - :param default_redirect_url: If action type is redirect, this field represents the default - redirect URL for the client. - :type default_redirect_url: str - :param default_custom_block_response_status_code: If the action type is block, this field - defines the default customer overridable http response status code. Possible values include: - 200, 403, 405, 406, 429. - :type default_custom_block_response_status_code: str or ~azure.mgmt.cdn.models.Enum46 - :param default_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 default_custom_block_response_body: str - """ - - _validation = { - 'default_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'}, - 'default_redirect_url': {'key': 'defaultRedirectUrl', 'type': 'str'}, - 'default_custom_block_response_status_code': {'key': 'defaultCustomBlockResponseStatusCode', 'type': 'int'}, - 'default_custom_block_response_body': {'key': 'defaultCustomBlockResponseBody', '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.default_redirect_url = kwargs.get('default_redirect_url', None) - self.default_custom_block_response_status_code = kwargs.get('default_custom_block_response_status_code', None) - self.default_custom_block_response_body = kwargs.get('default_custom_block_response_body', None) - - -class PostArgsMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for PostArgs match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRulePostArgsConditionParameters". - :vartype odata_type: str - :param selector: Name of PostArg to be matched. - :type selector: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.PostArgsOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'selector': {'key': 'selector', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRulePostArgsConditionParameters" - - def __init__( - self, - **kwargs - ): - super(PostArgsMatchConditionParameters, self).__init__(**kwargs) - self.selector = kwargs.get('selector', None) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class Profile(TrackedResource): - """CDN profile is a logical grouping of endpoints that share the same settings, such as CDN provider and pricing tier. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Required. The pricing tier (defines a CDN provider, feature list and rate) of the - CDN profile. - :type sku: ~azure.mgmt.cdn.models.Sku - :ivar resource_state: Resource status of the profile. Possible values include: "Creating", - "Active", "Deleting", "Disabled". - :vartype resource_state: str or ~azure.mgmt.cdn.models.ProfileResourceState - :ivar provisioning_state: Provisioning status of the profile. - :vartype provisioning_state: str - :ivar frontdoor_id: The Id of the frontdoor. - :vartype frontdoor_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'frontdoor_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'frontdoor_id': {'key': 'properties.frontdoorId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Profile, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.resource_state = None - self.provisioning_state = None - self.frontdoor_id = None - - -class ProfileListResult(msrest.serialization.Model): - """Result of the request to list 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 CDN profiles within a resource group. - :vartype value: list[~azure.mgmt.cdn.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(ProfileListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class ProfileUpdateParameters(msrest.serialization.Model): - """Properties required to update a profile. - - :param tags: A set of tags. Profile tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ProfileUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -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 QueryStringMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for QueryString match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleQueryStringConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.QueryStringOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleQueryStringConditionParameters" - - def __init__( - self, - **kwargs - ): - super(QueryStringMatchConditionParameters, self).__init__(**kwargs) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class RankingsResponse(msrest.serialization.Model): - """Rankings Response. - - :param date_time_begin: - :type date_time_begin: ~datetime.datetime - :param date_time_end: - :type date_time_end: ~datetime.datetime - :param tables: - :type tables: list[~azure.mgmt.cdn.models.RankingsResponseTablesItem] - """ - - _attribute_map = { - 'date_time_begin': {'key': 'dateTimeBegin', 'type': 'iso-8601'}, - 'date_time_end': {'key': 'dateTimeEnd', 'type': 'iso-8601'}, - 'tables': {'key': 'tables', 'type': '[RankingsResponseTablesItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(RankingsResponse, self).__init__(**kwargs) - self.date_time_begin = kwargs.get('date_time_begin', None) - self.date_time_end = kwargs.get('date_time_end', None) - self.tables = kwargs.get('tables', None) - - -class RankingsResponseTablesItem(msrest.serialization.Model): - """RankingsResponseTablesItem. - - :param ranking: - :type ranking: str - :param data: - :type data: list[~azure.mgmt.cdn.models.RankingsResponseTablesPropertiesItemsItem] - """ - - _attribute_map = { - 'ranking': {'key': 'ranking', 'type': 'str'}, - 'data': {'key': 'data', 'type': '[RankingsResponseTablesPropertiesItemsItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(RankingsResponseTablesItem, self).__init__(**kwargs) - self.ranking = kwargs.get('ranking', None) - self.data = kwargs.get('data', None) - - -class RankingsResponseTablesPropertiesItemsItem(msrest.serialization.Model): - """RankingsResponseTablesPropertiesItemsItem. - - :param name: - :type name: str - :param metrics: - :type metrics: list[~azure.mgmt.cdn.models.RankingsResponseTablesPropertiesItemsMetricsItem] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'metrics': {'key': 'metrics', 'type': '[RankingsResponseTablesPropertiesItemsMetricsItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(RankingsResponseTablesPropertiesItemsItem, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.metrics = kwargs.get('metrics', None) - - -class RankingsResponseTablesPropertiesItemsMetricsItem(msrest.serialization.Model): - """RankingsResponseTablesPropertiesItemsMetricsItem. - - :param metric: - :type metric: str - :param value: - :type value: long - :param percentage: - :type percentage: float - """ - - _attribute_map = { - 'metric': {'key': 'metric', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'long'}, - 'percentage': {'key': 'percentage', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(RankingsResponseTablesPropertiesItemsMetricsItem, self).__init__(**kwargs) - self.metric = kwargs.get('metric', None) - self.value = kwargs.get('value', None) - self.percentage = kwargs.get('percentage', None) - - -class RateLimitRule(CustomRule): - """Defines a rate limiting rule that can be included in a waf policy. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Defines the name of the custom rule. - :type name: str - :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.cdn.models.CustomRuleEnabledState - :param priority: Required. Defines in what order this rule be evaluated in the overall list of - custom rules. - :type priority: int - :param match_conditions: Required. List of match conditions. - :type match_conditions: list[~azure.mgmt.cdn.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.cdn.models.ActionType - :param rate_limit_threshold: Required. Defines rate limit threshold. - :type rate_limit_threshold: int - :param rate_limit_duration_in_minutes: Required. Defines rate limit duration. Default is 1 - minute. - :type rate_limit_duration_in_minutes: int - """ - - _validation = { - 'name': {'required': True}, - 'priority': {'required': True, 'maximum': 1000, 'minimum': 0}, - 'match_conditions': {'required': True}, - 'action': {'required': True}, - 'rate_limit_threshold': {'required': True, 'minimum': 0}, - 'rate_limit_duration_in_minutes': {'required': True, 'maximum': 60, 'minimum': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'priority': {'key': 'priority', 'type': 'int'}, - 'match_conditions': {'key': 'matchConditions', 'type': '[MatchCondition]'}, - 'action': {'key': 'action', 'type': 'str'}, - 'rate_limit_threshold': {'key': 'rateLimitThreshold', 'type': 'int'}, - 'rate_limit_duration_in_minutes': {'key': 'rateLimitDurationInMinutes', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(RateLimitRule, self).__init__(**kwargs) - self.rate_limit_threshold = kwargs['rate_limit_threshold'] - self.rate_limit_duration_in_minutes = kwargs['rate_limit_duration_in_minutes'] - - -class RateLimitRuleList(msrest.serialization.Model): - """Defines contents of rate limit rules. - - :param rules: List of rules. - :type rules: list[~azure.mgmt.cdn.models.RateLimitRule] - """ - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[RateLimitRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(RateLimitRuleList, self).__init__(**kwargs) - self.rules = kwargs.get('rules', None) - - -class RemoteAddressMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for RemoteAddress match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRemoteAddressConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "IPMatch", "GeoMatch". - :type operator: str or ~azure.mgmt.cdn.models.RemoteAddressOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: 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 match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRemoteAddressConditionParameters" - - def __init__( - self, - **kwargs - ): - super(RemoteAddressMatchConditionParameters, self).__init__(**kwargs) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class RequestBodyMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for RequestBody match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestBodyConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.RequestBodyOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestBodyConditionParameters" - - def __init__( - self, - **kwargs - ): - super(RequestBodyMatchConditionParameters, self).__init__(**kwargs) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class RequestHeaderMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for RequestHeader match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestHeaderConditionParameters". - :vartype odata_type: str - :param selector: Name of Header to be matched. - :type selector: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.RequestHeaderOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'selector': {'key': 'selector', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestHeaderConditionParameters" - - def __init__( - self, - **kwargs - ): - super(RequestHeaderMatchConditionParameters, self).__init__(**kwargs) - self.selector = kwargs.get('selector', None) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class RequestMethodMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for RequestMethod match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestMethodConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Equal". - :type operator: str or ~azure.mgmt.cdn.models.RequestMethodOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str or - ~azure.mgmt.cdn.models.RequestMethodMatchConditionParametersMatchValuesItem] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestMethodConditionParameters" - - def __init__( - self, - **kwargs - ): - super(RequestMethodMatchConditionParameters, self).__init__(**kwargs) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - - -class RequestSchemeMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for RequestScheme match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestSchemeConditionParameters". - :vartype odata_type: str - :ivar operator: Required. Describes operator to be matched. Default value: "Equal". - :vartype operator: str - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str or - ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParametersMatchValuesItem] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestSchemeConditionParameters" - operator = "Equal" - - def __init__( - self, - **kwargs - ): - super(RequestSchemeMatchConditionParameters, self).__init__(**kwargs) - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - - -class RequestUriMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for RequestUri match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestUriConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.RequestUriOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestUriConditionParameters" - - def __init__( - self, - **kwargs - ): - super(RequestUriMatchConditionParameters, self).__init__(**kwargs) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class ResourceReference(msrest.serialization.Model): - """Reference to another resource. - - :param id: Resource ID. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceReference, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class ResourcesResponse(msrest.serialization.Model): - """Resources Response. - - :param endpoints: - :type endpoints: list[~azure.mgmt.cdn.models.ResourcesResponseEndpointsItem] - :param custom_domains: - :type custom_domains: list[~azure.mgmt.cdn.models.ResourcesResponseCustomDomainsItem] - """ - - _attribute_map = { - 'endpoints': {'key': 'endpoints', 'type': '[ResourcesResponseEndpointsItem]'}, - 'custom_domains': {'key': 'customDomains', 'type': '[ResourcesResponseCustomDomainsItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourcesResponse, self).__init__(**kwargs) - self.endpoints = kwargs.get('endpoints', None) - self.custom_domains = kwargs.get('custom_domains', None) - - -class ResourcesResponseCustomDomainsItem(msrest.serialization.Model): - """ResourcesResponseCustomDomainsItem. - - :param id: - :type id: str - :param name: - :type name: str - :param endpoint_id: - :type endpoint_id: str - :param history: - :type history: bool - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, - 'history': {'key': 'history', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourcesResponseCustomDomainsItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.endpoint_id = kwargs.get('endpoint_id', None) - self.history = kwargs.get('history', None) - - -class ResourcesResponseEndpointsItem(msrest.serialization.Model): - """ResourcesResponseEndpointsItem. - - :param id: - :type id: str - :param name: - :type name: str - :param history: - :type history: bool - :param custom_domains: - :type custom_domains: - list[~azure.mgmt.cdn.models.ResourcesResponseEndpointsPropertiesItemsItem] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'history': {'key': 'history', 'type': 'bool'}, - 'custom_domains': {'key': 'customDomains', 'type': '[ResourcesResponseEndpointsPropertiesItemsItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourcesResponseEndpointsItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.history = kwargs.get('history', None) - self.custom_domains = kwargs.get('custom_domains', None) - - -class ResourcesResponseEndpointsPropertiesItemsItem(msrest.serialization.Model): - """ResourcesResponseEndpointsPropertiesItemsItem. - - :param id: - :type id: str - :param name: - :type name: str - :param endpoint_id: - :type endpoint_id: str - :param history: - :type history: bool - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, - 'history': {'key': 'history', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourcesResponseEndpointsPropertiesItemsItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.endpoint_id = kwargs.get('endpoint_id', None) - self.history = kwargs.get('history', None) - - -class ResourceUsage(msrest.serialization.Model): - """Output of check resource usage API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: Resource type for which the usage is provided. - :vartype resource_type: str - :ivar unit: Unit of the usage. e.g. Count. - :vartype unit: str - :ivar current_value: Actual value of usage on the specified resource type. - :vartype current_value: int - :ivar limit: Quota of the specified resource type. - :vartype limit: int - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'int'}, - 'limit': {'key': 'limit', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUsage, self).__init__(**kwargs) - self.resource_type = None - self.unit = None - self.current_value = None - self.limit = None - - -class ResourceUsageListResult(msrest.serialization.Model): - """Output of check resource usage API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of resource usages. - :vartype value: list[~azure.mgmt.cdn.models.ResourceUsage] - :param next_link: URL to get the next set of custom domain objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceUsage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUsageListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class ResponseBasedOriginErrorDetectionParameters(msrest.serialization.Model): - """The JSON object that contains the properties to determine origin health using real requests/responses. - - :param response_based_detected_error_types: Type of response errors for real user requests for - which origin will be deemed unhealthy. Possible values include: "None", "TcpErrorsOnly", - "TcpAndHttpErrors". - :type response_based_detected_error_types: str or - ~azure.mgmt.cdn.models.ResponseBasedDetectedErrorTypes - :param response_based_failover_threshold_percentage: The percentage of failed requests in the - sample where failover should trigger. - :type response_based_failover_threshold_percentage: int - :param http_error_ranges: The list of Http status code ranges that are considered as server - errors for origin and it is marked as unhealthy. - :type http_error_ranges: list[~azure.mgmt.cdn.models.HttpErrorRangeParameters] - """ - - _validation = { - 'response_based_failover_threshold_percentage': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'response_based_detected_error_types': {'key': 'responseBasedDetectedErrorTypes', 'type': 'str'}, - 'response_based_failover_threshold_percentage': {'key': 'responseBasedFailoverThresholdPercentage', 'type': 'int'}, - 'http_error_ranges': {'key': 'httpErrorRanges', 'type': '[HttpErrorRangeParameters]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResponseBasedOriginErrorDetectionParameters, self).__init__(**kwargs) - self.response_based_detected_error_types = kwargs.get('response_based_detected_error_types', None) - self.response_based_failover_threshold_percentage = kwargs.get('response_based_failover_threshold_percentage', None) - self.http_error_ranges = kwargs.get('http_error_ranges', None) - - -class Route(Resource): - """Friendly Routes name mapping to the any Routes or secret related information. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param custom_domains: Domains referenced by this endpoint. - :type custom_domains: list[~azure.mgmt.cdn.models.ResourceReference] - :param origin_group: A reference to the origin group. - :type origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve - content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param rule_sets: rule sets referenced by this endpoint. - :type rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] - :param supported_protocols: List of supported protocols for this route. - :type supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param compression_settings: compression settings. - :type compression_settings: object - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or - ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior - :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.cdn.models.ForwardingProtocol - :param link_to_default_domain: whether this route will be linked to the default endpoint - domain. Possible values include: "Enabled", "Disabled". - :type link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain - :param https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note - that this is a easy way to set up this rule and it will be the first rule that gets executed. - Possible values include: "Enabled", "Disabled". - :type https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect - :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.cdn.models.EnabledState - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'custom_domains': {'key': 'properties.customDomains', 'type': '[ResourceReference]'}, - 'origin_group': {'key': 'properties.originGroup', 'type': 'ResourceReference'}, - 'origin_path': {'key': 'properties.originPath', 'type': 'str'}, - 'rule_sets': {'key': 'properties.ruleSets', 'type': '[ResourceReference]'}, - 'supported_protocols': {'key': 'properties.supportedProtocols', 'type': '[str]'}, - 'patterns_to_match': {'key': 'properties.patternsToMatch', 'type': '[str]'}, - 'compression_settings': {'key': 'properties.compressionSettings', 'type': 'object'}, - 'query_string_caching_behavior': {'key': 'properties.queryStringCachingBehavior', 'type': 'str'}, - 'forwarding_protocol': {'key': 'properties.forwardingProtocol', 'type': 'str'}, - 'link_to_default_domain': {'key': 'properties.linkToDefaultDomain', 'type': 'str'}, - 'https_redirect': {'key': 'properties.httpsRedirect', 'type': 'str'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Route, self).__init__(**kwargs) - self.custom_domains = kwargs.get('custom_domains', None) - self.origin_group = kwargs.get('origin_group', None) - self.origin_path = kwargs.get('origin_path', None) - self.rule_sets = kwargs.get('rule_sets', None) - self.supported_protocols = kwargs.get('supported_protocols', None) - self.patterns_to_match = kwargs.get('patterns_to_match', None) - self.compression_settings = kwargs.get('compression_settings', None) - self.query_string_caching_behavior = kwargs.get('query_string_caching_behavior', None) - self.forwarding_protocol = kwargs.get('forwarding_protocol', None) - self.link_to_default_domain = kwargs.get('link_to_default_domain', None) - self.https_redirect = kwargs.get('https_redirect', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.provisioning_state = None - self.deployment_status = None - - -class RouteListResult(msrest.serialization.Model): - """Result of the request to list routes. It contains a list of route 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 AzureFrontDoor routes within a profile. - :vartype value: list[~azure.mgmt.cdn.models.Route] - :param next_link: URL to get the next set of route objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Route]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RouteListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class RouteUpdatePropertiesParameters(msrest.serialization.Model): - """The JSON object that contains the properties of the domain to create. - - :param custom_domains: Domains referenced by this endpoint. - :type custom_domains: list[~azure.mgmt.cdn.models.ResourceReference] - :param origin_group: A reference to the origin group. - :type origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve - content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param rule_sets: rule sets referenced by this endpoint. - :type rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] - :param supported_protocols: List of supported protocols for this route. - :type supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param compression_settings: compression settings. - :type compression_settings: object - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or - ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior - :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.cdn.models.ForwardingProtocol - :param link_to_default_domain: whether this route will be linked to the default endpoint - domain. Possible values include: "Enabled", "Disabled". - :type link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain - :param https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note - that this is a easy way to set up this rule and it will be the first rule that gets executed. - Possible values include: "Enabled", "Disabled". - :type https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect - :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.cdn.models.EnabledState - """ - - _attribute_map = { - 'custom_domains': {'key': 'customDomains', 'type': '[ResourceReference]'}, - 'origin_group': {'key': 'originGroup', 'type': 'ResourceReference'}, - 'origin_path': {'key': 'originPath', 'type': 'str'}, - 'rule_sets': {'key': 'ruleSets', 'type': '[ResourceReference]'}, - 'supported_protocols': {'key': 'supportedProtocols', 'type': '[str]'}, - 'patterns_to_match': {'key': 'patternsToMatch', 'type': '[str]'}, - 'compression_settings': {'key': 'compressionSettings', 'type': 'object'}, - 'query_string_caching_behavior': {'key': 'queryStringCachingBehavior', 'type': 'str'}, - 'forwarding_protocol': {'key': 'forwardingProtocol', 'type': 'str'}, - 'link_to_default_domain': {'key': 'linkToDefaultDomain', 'type': 'str'}, - 'https_redirect': {'key': 'httpsRedirect', 'type': 'str'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RouteUpdatePropertiesParameters, self).__init__(**kwargs) - self.custom_domains = kwargs.get('custom_domains', None) - self.origin_group = kwargs.get('origin_group', None) - self.origin_path = kwargs.get('origin_path', None) - self.rule_sets = kwargs.get('rule_sets', None) - self.supported_protocols = kwargs.get('supported_protocols', None) - self.patterns_to_match = kwargs.get('patterns_to_match', None) - self.compression_settings = kwargs.get('compression_settings', None) - self.query_string_caching_behavior = kwargs.get('query_string_caching_behavior', None) - self.forwarding_protocol = kwargs.get('forwarding_protocol', None) - self.link_to_default_domain = kwargs.get('link_to_default_domain', None) - self.https_redirect = kwargs.get('https_redirect', None) - self.enabled_state = kwargs.get('enabled_state', None) - - -class RouteProperties(AFDStateProperties, RouteUpdatePropertiesParameters): - """The JSON object that contains the properties of the Routes to create. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param custom_domains: Domains referenced by this endpoint. - :type custom_domains: list[~azure.mgmt.cdn.models.ResourceReference] - :param origin_group: A reference to the origin group. - :type origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve - content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param rule_sets: rule sets referenced by this endpoint. - :type rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] - :param supported_protocols: List of supported protocols for this route. - :type supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param compression_settings: compression settings. - :type compression_settings: object - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or - ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior - :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.cdn.models.ForwardingProtocol - :param link_to_default_domain: whether this route will be linked to the default endpoint - domain. Possible values include: "Enabled", "Disabled". - :type link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain - :param https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note - that this is a easy way to set up this rule and it will be the first rule that gets executed. - Possible values include: "Enabled", "Disabled". - :type https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect - :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.cdn.models.EnabledState - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'custom_domains': {'key': 'customDomains', 'type': '[ResourceReference]'}, - 'origin_group': {'key': 'originGroup', 'type': 'ResourceReference'}, - 'origin_path': {'key': 'originPath', 'type': 'str'}, - 'rule_sets': {'key': 'ruleSets', 'type': '[ResourceReference]'}, - 'supported_protocols': {'key': 'supportedProtocols', 'type': '[str]'}, - 'patterns_to_match': {'key': 'patternsToMatch', 'type': '[str]'}, - 'compression_settings': {'key': 'compressionSettings', 'type': 'object'}, - 'query_string_caching_behavior': {'key': 'queryStringCachingBehavior', 'type': 'str'}, - 'forwarding_protocol': {'key': 'forwardingProtocol', 'type': 'str'}, - 'link_to_default_domain': {'key': 'linkToDefaultDomain', 'type': 'str'}, - 'https_redirect': {'key': 'httpsRedirect', 'type': 'str'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RouteProperties, self).__init__(**kwargs) - self.custom_domains = kwargs.get('custom_domains', None) - self.origin_group = kwargs.get('origin_group', None) - self.origin_path = kwargs.get('origin_path', None) - self.rule_sets = kwargs.get('rule_sets', None) - self.supported_protocols = kwargs.get('supported_protocols', None) - self.patterns_to_match = kwargs.get('patterns_to_match', None) - self.compression_settings = kwargs.get('compression_settings', None) - self.query_string_caching_behavior = kwargs.get('query_string_caching_behavior', None) - self.forwarding_protocol = kwargs.get('forwarding_protocol', None) - self.link_to_default_domain = kwargs.get('link_to_default_domain', None) - self.https_redirect = kwargs.get('https_redirect', None) - self.enabled_state = kwargs.get('enabled_state', None) - self.provisioning_state = None - self.deployment_status = None - - -class RouteUpdateParameters(msrest.serialization.Model): - """The domain JSON object required for domain creation or update. - - :param custom_domains: Domains referenced by this endpoint. - :type custom_domains: list[~azure.mgmt.cdn.models.ResourceReference] - :param origin_group: A reference to the origin group. - :type origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve - content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param rule_sets: rule sets referenced by this endpoint. - :type rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] - :param supported_protocols: List of supported protocols for this route. - :type supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param compression_settings: compression settings. - :type compression_settings: object - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or - ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior - :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.cdn.models.ForwardingProtocol - :param link_to_default_domain: whether this route will be linked to the default endpoint - domain. Possible values include: "Enabled", "Disabled". - :type link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain - :param https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note - that this is a easy way to set up this rule and it will be the first rule that gets executed. - Possible values include: "Enabled", "Disabled". - :type https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect - :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.cdn.models.EnabledState - """ - - _attribute_map = { - 'custom_domains': {'key': 'properties.customDomains', 'type': '[ResourceReference]'}, - 'origin_group': {'key': 'properties.originGroup', 'type': 'ResourceReference'}, - 'origin_path': {'key': 'properties.originPath', 'type': 'str'}, - 'rule_sets': {'key': 'properties.ruleSets', 'type': '[ResourceReference]'}, - 'supported_protocols': {'key': 'properties.supportedProtocols', 'type': '[str]'}, - 'patterns_to_match': {'key': 'properties.patternsToMatch', 'type': '[str]'}, - 'compression_settings': {'key': 'properties.compressionSettings', 'type': 'object'}, - 'query_string_caching_behavior': {'key': 'properties.queryStringCachingBehavior', 'type': 'str'}, - 'forwarding_protocol': {'key': 'properties.forwardingProtocol', 'type': 'str'}, - 'link_to_default_domain': {'key': 'properties.linkToDefaultDomain', 'type': 'str'}, - 'https_redirect': {'key': 'properties.httpsRedirect', 'type': 'str'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RouteUpdateParameters, self).__init__(**kwargs) - self.custom_domains = kwargs.get('custom_domains', None) - self.origin_group = kwargs.get('origin_group', None) - self.origin_path = kwargs.get('origin_path', None) - self.rule_sets = kwargs.get('rule_sets', None) - self.supported_protocols = kwargs.get('supported_protocols', None) - self.patterns_to_match = kwargs.get('patterns_to_match', None) - self.compression_settings = kwargs.get('compression_settings', None) - self.query_string_caching_behavior = kwargs.get('query_string_caching_behavior', None) - self.forwarding_protocol = kwargs.get('forwarding_protocol', None) - self.link_to_default_domain = kwargs.get('link_to_default_domain', None) - self.https_redirect = kwargs.get('https_redirect', None) - self.enabled_state = kwargs.get('enabled_state', None) - - -class Rule(Resource): - """Friendly Rules name mapping to the any Rules or secret related information. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param order: The order in which the rules are applied for the endpoint. Possible values - {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. - Rule with order 0 is a special rule. It does not require any condition and actions listed in it - will always be applied. - :type order: int - :param conditions: A list of conditions that must be matched for the actions to be executed. - :type conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] - :param actions: A list of actions that are executed when all the conditions of a rule are - satisfied. - :type actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] - :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.cdn.models.MatchProcessingBehavior - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'order': {'key': 'properties.order', 'type': 'int'}, - 'conditions': {'key': 'properties.conditions', 'type': '[DeliveryRuleCondition]'}, - 'actions': {'key': 'properties.actions', 'type': '[DeliveryRuleAction]'}, - 'match_processing_behavior': {'key': 'properties.matchProcessingBehavior', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Rule, self).__init__(**kwargs) - self.order = kwargs.get('order', None) - self.conditions = kwargs.get('conditions', None) - self.actions = kwargs.get('actions', None) - self.match_processing_behavior = kwargs.get('match_processing_behavior', None) - self.provisioning_state = None - self.deployment_status = None - - -class RuleListResult(msrest.serialization.Model): - """Result of the request to list rules. It contains a list of 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 AzureFrontDoor rules within a rule set. - :vartype value: list[~azure.mgmt.cdn.models.Rule] - :param next_link: URL to get the next set of rule objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Rule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuleListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class RuleUpdatePropertiesParameters(msrest.serialization.Model): - """The JSON object that contains the properties of the domain to create. - - :param order: The order in which the rules are applied for the endpoint. Possible values - {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. - Rule with order 0 is a special rule. It does not require any condition and actions listed in it - will always be applied. - :type order: int - :param conditions: A list of conditions that must be matched for the actions to be executed. - :type conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] - :param actions: A list of actions that are executed when all the conditions of a rule are - satisfied. - :type actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] - :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.cdn.models.MatchProcessingBehavior - """ - - _attribute_map = { - 'order': {'key': 'order', 'type': 'int'}, - 'conditions': {'key': 'conditions', 'type': '[DeliveryRuleCondition]'}, - 'actions': {'key': 'actions', 'type': '[DeliveryRuleAction]'}, - 'match_processing_behavior': {'key': 'matchProcessingBehavior', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuleUpdatePropertiesParameters, self).__init__(**kwargs) - self.order = kwargs.get('order', None) - self.conditions = kwargs.get('conditions', None) - self.actions = kwargs.get('actions', None) - self.match_processing_behavior = kwargs.get('match_processing_behavior', None) - - -class RuleProperties(AFDStateProperties, RuleUpdatePropertiesParameters): - """The JSON object that contains the properties of the Rules to create. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param order: The order in which the rules are applied for the endpoint. Possible values - {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. - Rule with order 0 is a special rule. It does not require any condition and actions listed in it - will always be applied. - :type order: int - :param conditions: A list of conditions that must be matched for the actions to be executed. - :type conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] - :param actions: A list of actions that are executed when all the conditions of a rule are - satisfied. - :type actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] - :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.cdn.models.MatchProcessingBehavior - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'order': {'key': 'order', 'type': 'int'}, - 'conditions': {'key': 'conditions', 'type': '[DeliveryRuleCondition]'}, - 'actions': {'key': 'actions', 'type': '[DeliveryRuleAction]'}, - 'match_processing_behavior': {'key': 'matchProcessingBehavior', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuleProperties, self).__init__(**kwargs) - self.order = kwargs.get('order', None) - self.conditions = kwargs.get('conditions', None) - self.actions = kwargs.get('actions', None) - self.match_processing_behavior = kwargs.get('match_processing_behavior', None) - self.provisioning_state = None - self.deployment_status = None - - -class RuleSet(Resource): - """Friendly RuleSet name mapping to the any RuleSet or secret related information. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuleSet, self).__init__(**kwargs) - self.provisioning_state = None - self.deployment_status = None - - -class RuleSetListResult(msrest.serialization.Model): - """Result of the request to list rule sets. It contains a list of rule set 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 AzureFrontDoor rule sets within a profile. - :vartype value: list[~azure.mgmt.cdn.models.RuleSet] - :param next_link: URL to get the next set of rule set objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RuleSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuleSetListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class RuleSetProperties(AFDStateProperties): - """The JSON object that contains the properties of the Rule Set to create. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuleSetProperties, self).__init__(**kwargs) - - -class RuleUpdateParameters(msrest.serialization.Model): - """The domain JSON object required for domain creation or update. - - :param order: The order in which the rules are applied for the endpoint. Possible values - {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. - Rule with order 0 is a special rule. It does not require any condition and actions listed in it - will always be applied. - :type order: int - :param conditions: A list of conditions that must be matched for the actions to be executed. - :type conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] - :param actions: A list of actions that are executed when all the conditions of a rule are - satisfied. - :type actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] - :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.cdn.models.MatchProcessingBehavior - """ - - _attribute_map = { - 'order': {'key': 'properties.order', 'type': 'int'}, - 'conditions': {'key': 'properties.conditions', 'type': '[DeliveryRuleCondition]'}, - 'actions': {'key': 'properties.actions', 'type': '[DeliveryRuleAction]'}, - 'match_processing_behavior': {'key': 'properties.matchProcessingBehavior', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuleUpdateParameters, self).__init__(**kwargs) - self.order = kwargs.get('order', None) - self.conditions = kwargs.get('conditions', None) - self.actions = kwargs.get('actions', None) - self.match_processing_behavior = kwargs.get('match_processing_behavior', None) - - -class Secret(Resource): - """Friendly Secret name mapping to the any Secret or secret related information. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :param parameters: object which contains secret parameters. - :type parameters: ~azure.mgmt.cdn.models.SecretParameters - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - 'parameters': {'key': 'properties.parameters', 'type': 'SecretParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(Secret, self).__init__(**kwargs) - self.provisioning_state = None - self.deployment_status = None - self.parameters = kwargs.get('parameters', None) - - -class SecretListResult(msrest.serialization.Model): - """Result of the request to list secrets. It contains a list of Secret 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 AzureFrontDoor secrets within a profile. - :vartype value: list[~azure.mgmt.cdn.models.Secret] - :param next_link: URL to get the next set of Secret objects if there are any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Secret]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class SecretProperties(AFDStateProperties): - """The JSON object that contains the properties of the Secret to create. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :param parameters: object which contains secret parameters. - :type parameters: ~azure.mgmt.cdn.models.SecretParameters - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'SecretParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretProperties, self).__init__(**kwargs) - self.parameters = kwargs.get('parameters', None) - - -class SecurityPolicy(Resource): - """SecurityPolicy association for AzureFrontDoor profile. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :param parameters: object which contains security policy parameters. - :type parameters: ~azure.mgmt.cdn.models.SecurityPolicyParameters - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - 'parameters': {'key': 'properties.parameters', 'type': 'SecurityPolicyParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityPolicy, self).__init__(**kwargs) - self.provisioning_state = None - self.deployment_status = None - self.parameters = kwargs.get('parameters', None) - - -class SecurityPolicyListResult(msrest.serialization.Model): - """Result of the request to list security policies. It contains a list of security policy 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 Security policies within a profile. - :vartype value: list[~azure.mgmt.cdn.models.SecurityPolicy] - :param next_link: URL to get the next set of security policy objects if there is any. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityPolicyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class SecurityPolicyParameters(msrest.serialization.Model): - """The json object containing security policy parameters. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SecurityPolicyWebApplicationFirewallParameters. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the Security policy to create.Constant filled by server. - Possible values include: "WebApplicationFirewall". - :type type: str or ~azure.mgmt.cdn.models.SecurityPolicyType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'WebApplicationFirewall': 'SecurityPolicyWebApplicationFirewallParameters'} - } - - def __init__( - self, - **kwargs - ): - super(SecurityPolicyParameters, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class SecurityPolicyProperties(AFDStateProperties): - """The json object that contains properties required to create a security policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :param parameters: object which contains security policy parameters. - :type parameters: ~azure.mgmt.cdn.models.SecurityPolicyParameters - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'SecurityPolicyParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityPolicyProperties, self).__init__(**kwargs) - self.parameters = kwargs.get('parameters', None) - - -class SecurityPolicyWebApplicationFirewallAssociation(msrest.serialization.Model): - """settings for security policy patterns to match. - - :param domains: List of domains. - :type domains: list[~azure.mgmt.cdn.models.ResourceReference] - :param patterns_to_match: List of paths. - :type patterns_to_match: list[str] - """ - - _attribute_map = { - 'domains': {'key': 'domains', 'type': '[ResourceReference]'}, - 'patterns_to_match': {'key': 'patternsToMatch', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityPolicyWebApplicationFirewallAssociation, self).__init__(**kwargs) - self.domains = kwargs.get('domains', None) - self.patterns_to_match = kwargs.get('patterns_to_match', None) - - -class SecurityPolicyWebApplicationFirewallParameters(SecurityPolicyParameters): - """The json object containing security policy waf parameters. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the Security policy to create.Constant filled by server. - Possible values include: "WebApplicationFirewall". - :type type: str or ~azure.mgmt.cdn.models.SecurityPolicyType - :param waf_policy: Resource ID. - :type waf_policy: ~azure.mgmt.cdn.models.ResourceReference - :param associations: Waf associations. - :type associations: - list[~azure.mgmt.cdn.models.SecurityPolicyWebApplicationFirewallAssociation] - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'waf_policy': {'key': 'wafPolicy', 'type': 'ResourceReference'}, - 'associations': {'key': 'associations', 'type': '[SecurityPolicyWebApplicationFirewallAssociation]'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityPolicyWebApplicationFirewallParameters, self).__init__(**kwargs) - self.type = 'WebApplicationFirewall' # type: str - self.waf_policy = kwargs.get('waf_policy', None) - self.associations = kwargs.get('associations', None) - - -class SharedPrivateLinkResourceProperties(msrest.serialization.Model): - """Describes the properties of an existing Shared Private Link Resource to use when connecting to a private origin. - - :param private_link: The resource id of the resource the shared private link resource is for. - :type private_link: ~azure.mgmt.cdn.models.ResourceReference - :param private_link_location: The location of the shared private link resource. - :type private_link_location: str - :param group_id: The group id from the provider of resource the shared private link resource is - for. - :type group_id: str - :param request_message: The request message for requesting approval of the shared private link - resource. - :type request_message: str - :param status: Status of the shared private link resource. Can be Pending, Approved, Rejected, - Disconnected, or Timeout. Possible values include: "Pending", "Approved", "Rejected", - "Disconnected", "Timeout". - :type status: str or ~azure.mgmt.cdn.models.SharedPrivateLinkResourceStatus - """ - - _attribute_map = { - 'private_link': {'key': 'privateLink', 'type': 'ResourceReference'}, - 'private_link_location': {'key': 'privateLinkLocation', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'request_message': {'key': 'requestMessage', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SharedPrivateLinkResourceProperties, self).__init__(**kwargs) - self.private_link = kwargs.get('private_link', None) - self.private_link_location = kwargs.get('private_link_location', None) - self.group_id = kwargs.get('group_id', None) - self.request_message = kwargs.get('request_message', None) - self.status = kwargs.get('status', None) - - -class Sku(msrest.serialization.Model): - """The pricing tier (defines a CDN provider, feature list and rate) of the CDN profile. - - :param name: Name of the pricing tier. Possible values include: "Standard_Verizon", - "Premium_Verizon", "Custom_Verizon", "Standard_Akamai", "Standard_ChinaCdn", - "Standard_Microsoft", "Premium_ChinaCdn", "Standard_AzureFrontDoor", "Premium_AzureFrontDoor", - "Standard_955BandWidth_ChinaCdn", "Standard_AvgBandWidth_ChinaCdn", "StandardPlus_ChinaCdn", - "StandardPlus_955BandWidth_ChinaCdn", "StandardPlus_AvgBandWidth_ChinaCdn". - :type name: str or ~azure.mgmt.cdn.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 SsoUri(msrest.serialization.Model): - """The URI required to login to the supplemental portal from the Azure portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar sso_uri_value: The URI used to login to the supplemental portal. - :vartype sso_uri_value: str - """ - - _validation = { - 'sso_uri_value': {'readonly': True}, - } - - _attribute_map = { - 'sso_uri_value': {'key': 'ssoUriValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SsoUri, self).__init__(**kwargs) - self.sso_uri_value = None - - -class SupportedOptimizationTypesListResult(msrest.serialization.Model): - """The result of the GetSupportedOptimizationTypes API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar supported_optimization_types: Supported optimization types for a profile. - :vartype supported_optimization_types: list[str or ~azure.mgmt.cdn.models.OptimizationType] - """ - - _validation = { - 'supported_optimization_types': {'readonly': True}, - } - - _attribute_map = { - 'supported_optimization_types': {'key': 'supportedOptimizationTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedOptimizationTypesListResult, self).__init__(**kwargs) - self.supported_optimization_types = None - - -class SystemData(msrest.serialization.Model): - """Read only system data. - - :param created_by: An identifier for the identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "user", "application", "managedIdentity", "key". - :type created_by_type: str or ~azure.mgmt.cdn.models.IdentityType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: An identifier for the identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "user", "application", "managedIdentity", "key". - :type last_modified_by_type: str or ~azure.mgmt.cdn.models.IdentityType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class UrlFileExtensionMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for UrlFileExtension match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFileExtensionMatchConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.UrlFileExtensionOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFileExtensionMatchConditionParameters" - - def __init__( - self, - **kwargs - ): - super(UrlFileExtensionMatchConditionParameters, self).__init__(**kwargs) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class UrlFileNameMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for UrlFilename match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFilenameConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.UrlFileNameOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFilenameConditionParameters" - - def __init__( - self, - **kwargs - ): - super(UrlFileNameMatchConditionParameters, self).__init__(**kwargs) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class UrlPathMatchConditionParameters(msrest.serialization.Model): - """Defines the parameters for UrlPath match conditions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlPathMatchConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", - "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "Wildcard", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.UrlPathOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'operator': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'operator': {'key': 'operator', 'type': 'str'}, - 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, - 'match_values': {'key': 'matchValues', 'type': '[str]'}, - 'transforms': {'key': 'transforms', 'type': '[str]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlPathMatchConditionParameters" - - def __init__( - self, - **kwargs - ): - super(UrlPathMatchConditionParameters, self).__init__(**kwargs) - self.operator = kwargs['operator'] - self.negate_condition = kwargs.get('negate_condition', None) - self.match_values = kwargs.get('match_values', None) - self.transforms = kwargs.get('transforms', None) - - -class UrlRedirectAction(DeliveryRuleAction): - """Defines the url redirect action for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the action for the delivery rule.Constant filled by server. - Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.UrlRedirectActionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlRedirectActionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(UrlRedirectAction, self).__init__(**kwargs) - self.name = 'UrlRedirect' # type: str - self.parameters = kwargs['parameters'] - - -class UrlRedirectActionParameters(msrest.serialization.Model): - """Defines the parameters for the url redirect action. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlRedirectActionParameters". - :vartype odata_type: str - :param redirect_type: Required. The redirect type the rule will use when redirecting traffic. - Possible values include: "Moved", "Found", "TemporaryRedirect", "PermanentRedirect". - :type redirect_type: str or ~azure.mgmt.cdn.models.RedirectType - :param destination_protocol: Protocol to use for the redirect. The default value is - MatchRequest. Possible values include: "MatchRequest", "Http", "Https". - :type destination_protocol: str or ~azure.mgmt.cdn.models.DestinationProtocol - :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_hostname: Host to redirect. Leave empty to use the incoming host as the - destination host. - :type custom_hostname: 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. ? and & will be added - automatically so do not include them. - :type custom_query_string: 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 - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'redirect_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'redirect_type': {'key': 'redirectType', 'type': 'str'}, - 'destination_protocol': {'key': 'destinationProtocol', 'type': 'str'}, - 'custom_path': {'key': 'customPath', 'type': 'str'}, - 'custom_hostname': {'key': 'customHostname', 'type': 'str'}, - 'custom_query_string': {'key': 'customQueryString', 'type': 'str'}, - 'custom_fragment': {'key': 'customFragment', 'type': 'str'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlRedirectActionParameters" - - def __init__( - self, - **kwargs - ): - super(UrlRedirectActionParameters, self).__init__(**kwargs) - self.redirect_type = kwargs['redirect_type'] - self.destination_protocol = kwargs.get('destination_protocol', None) - self.custom_path = kwargs.get('custom_path', None) - self.custom_hostname = kwargs.get('custom_hostname', None) - self.custom_query_string = kwargs.get('custom_query_string', None) - self.custom_fragment = kwargs.get('custom_fragment', None) - - -class UrlRewriteAction(DeliveryRuleAction): - """Defines the url rewrite action for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the action for the delivery rule.Constant filled by server. - Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.UrlRewriteActionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlRewriteActionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(UrlRewriteAction, self).__init__(**kwargs) - self.name = 'UrlRewrite' # type: str - self.parameters = kwargs['parameters'] - - -class UrlRewriteActionParameters(msrest.serialization.Model): - """Defines the parameters for the url rewrite action. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlRewriteActionParameters". - :vartype odata_type: str - :param source_pattern: Required. define a request URI pattern that identifies the type of - requests that may be rewritten. If value is blank, all strings are matched. - :type source_pattern: str - :param destination: Required. Define the relative URL to which the above requests will be - rewritten by. - :type destination: str - :param preserve_unmatched_path: Whether to preserve unmatched path. Default value is true. - :type preserve_unmatched_path: bool - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - 'source_pattern': {'required': True}, - 'destination': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'source_pattern': {'key': 'sourcePattern', 'type': 'str'}, - 'destination': {'key': 'destination', 'type': 'str'}, - 'preserve_unmatched_path': {'key': 'preserveUnmatchedPath', 'type': 'bool'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlRewriteActionParameters" - - def __init__( - self, - **kwargs - ): - super(UrlRewriteActionParameters, self).__init__(**kwargs) - self.source_pattern = kwargs['source_pattern'] - self.destination = kwargs['destination'] - self.preserve_unmatched_path = kwargs.get('preserve_unmatched_path', None) - - -class UrlSigningAction(DeliveryRuleAction): - """Defines the url signing action for the delivery rule. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the action for the delivery rule.Constant filled by server. - Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.UrlSigningActionParameters - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlSigningActionParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(UrlSigningAction, self).__init__(**kwargs) - self.name = 'UrlSigning' # type: str - self.parameters = kwargs['parameters'] - - -class UrlSigningActionParameters(msrest.serialization.Model): - """Defines the parameters for the Url Signing action. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlSigningActionParameters". - :vartype odata_type: str - :param algorithm: Algorithm to use for URL signing. Possible values include: "SHA256". - :type algorithm: str or ~azure.mgmt.cdn.models.Algorithm - :param parameter_name_override: Defines which query string parameters in the url to be - considered for expires, key id etc. - :type parameter_name_override: list[~azure.mgmt.cdn.models.UrlSigningParamIdentifier] - """ - - _validation = { - 'odata_type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'algorithm': {'key': 'algorithm', 'type': 'str'}, - 'parameter_name_override': {'key': 'parameterNameOverride', 'type': '[UrlSigningParamIdentifier]'}, - } - - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlSigningActionParameters" - - def __init__( - self, - **kwargs - ): - super(UrlSigningActionParameters, self).__init__(**kwargs) - self.algorithm = kwargs.get('algorithm', None) - self.parameter_name_override = kwargs.get('parameter_name_override', None) - - -class UrlSigningKey(msrest.serialization.Model): - """Url signing key. - - All required parameters must be populated in order to send to Azure. - - :param key_id: Required. Defines the customer defined key Id. This id will exist in the - incoming request to indicate the key used to form the hash. - :type key_id: str - :param key_source_parameters: Required. Defines the parameters for using customer key vault for - Url Signing Key. - :type key_source_parameters: ~azure.mgmt.cdn.models.KeyVaultSigningKeyParameters - """ - - _validation = { - 'key_id': {'required': True}, - 'key_source_parameters': {'required': True}, - } - - _attribute_map = { - 'key_id': {'key': 'keyId', 'type': 'str'}, - 'key_source_parameters': {'key': 'keySourceParameters', 'type': 'KeyVaultSigningKeyParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(UrlSigningKey, self).__init__(**kwargs) - self.key_id = kwargs['key_id'] - self.key_source_parameters = kwargs['key_source_parameters'] - - -class UrlSigningKeyParameters(SecretParameters): - """Url signing key parameters. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the Secret to create.Constant filled by server. Possible - values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate". - :type type: str or ~azure.mgmt.cdn.models.SecretType - :param key_id: Required. Defines the customer defined key Id. This id will exist in the - incoming request to indicate the key used to form the hash. - :type key_id: str - :param secret_source: Required. Resource reference to the KV secret. - :type secret_source: ~azure.mgmt.cdn.models.ResourceReference - :param secret_version: Version of the secret to be used. - :type secret_version: str - """ - - _validation = { - 'type': {'required': True}, - 'key_id': {'required': True}, - 'secret_source': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'key_id': {'key': 'keyId', 'type': 'str'}, - 'secret_source': {'key': 'secretSource', 'type': 'ResourceReference'}, - 'secret_version': {'key': 'secretVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UrlSigningKeyParameters, self).__init__(**kwargs) - self.type = 'UrlSigningKey' # type: str - self.key_id = kwargs['key_id'] - self.secret_source = kwargs['secret_source'] - self.secret_version = kwargs.get('secret_version', None) - - -class UrlSigningParamIdentifier(msrest.serialization.Model): - """Defines how to identify a parameter for a specific purpose e.g. expires. - - All required parameters must be populated in order to send to Azure. - - :param param_indicator: Required. Indicates the purpose of the parameter. Possible values - include: "Expires", "KeyId", "Signature". - :type param_indicator: str or ~azure.mgmt.cdn.models.ParamIndicator - :param param_name: Required. Parameter name. - :type param_name: str - """ - - _validation = { - 'param_indicator': {'required': True}, - 'param_name': {'required': True}, - } - - _attribute_map = { - 'param_indicator': {'key': 'paramIndicator', 'type': 'str'}, - 'param_name': {'key': 'paramName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UrlSigningParamIdentifier, self).__init__(**kwargs) - self.param_indicator = kwargs['param_indicator'] - self.param_name = kwargs['param_name'] - - -class Usage(msrest.serialization.Model): - """Describes resource usage. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Resource identifier. - :vartype id: str - :param unit: Required. An enum describing the unit of measurement. Possible values include: - "Count". - :type unit: str or ~azure.mgmt.cdn.models.UsageUnit - :param current_value: Required. The current value of the usage. - :type current_value: long - :param limit: Required. The limit of usage. - :type limit: long - :param name: Required. The name of the type of usage. - :type name: ~azure.mgmt.cdn.models.UsageName - """ - - _validation = { - 'id': {'readonly': True}, - 'unit': {'required': True}, - 'current_value': {'required': True}, - 'limit': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'UsageName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.id = None - self.unit = kwargs['unit'] - self.current_value = kwargs['current_value'] - self.limit = kwargs['limit'] - self.name = kwargs['name'] - - -class UsageName(msrest.serialization.Model): - """The usage names. - - :param value: A string describing the resource name. - :type value: str - :param localized_value: A localized string describing the resource name. - :type localized_value: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsageName, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.localized_value = kwargs.get('localized_value', None) - - -class UsagesListResult(msrest.serialization.Model): - """The list usages operation response. - - :param value: The list of resource usages. - :type value: list[~azure.mgmt.cdn.models.Usage] - :param next_link: URL to get the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UsagesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class UserManagedHttpsParameters(CustomDomainHttpsParameters): - """Defines the certificate source parameters using user's keyvault certificate for enabling SSL. - - All required parameters must be populated in order to send to Azure. - - :param certificate_source: Required. Defines the source of the SSL certificate.Constant filled - by server. Possible values include: "AzureKeyVault", "Cdn". - :type certificate_source: str or ~azure.mgmt.cdn.models.CertificateSource - :param protocol_type: Required. Defines the TLS extension protocol that is used for secure - delivery. Possible values include: "ServerNameIndication", "IPBased". - :type protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType - :param minimum_tls_version: TLS protocol version that will be used for Https. Possible values - include: "None", "TLS10", "TLS12". - :type minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion - :param certificate_source_parameters: Required. Defines the certificate source parameters using - user's keyvault certificate for enabling SSL. - :type certificate_source_parameters: ~azure.mgmt.cdn.models.KeyVaultCertificateSourceParameters - """ - - _validation = { - 'certificate_source': {'required': True}, - 'protocol_type': {'required': True}, - 'certificate_source_parameters': {'required': True}, - } - - _attribute_map = { - 'certificate_source': {'key': 'certificateSource', 'type': 'str'}, - 'protocol_type': {'key': 'protocolType', 'type': 'str'}, - 'minimum_tls_version': {'key': 'minimumTlsVersion', 'type': 'str'}, - 'certificate_source_parameters': {'key': 'certificateSourceParameters', 'type': 'KeyVaultCertificateSourceParameters'}, - } - - def __init__( - self, - **kwargs - ): - super(UserManagedHttpsParameters, self).__init__(**kwargs) - self.certificate_source = 'AzureKeyVault' # type: str - self.certificate_source_parameters = kwargs['certificate_source_parameters'] - - -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 ValidateProbeInput(msrest.serialization.Model): - """Input of the validate probe API. - - All required parameters must be populated in order to send to Azure. - - :param probe_url: Required. The probe URL to validate. - :type probe_url: str - """ - - _validation = { - 'probe_url': {'required': True}, - } - - _attribute_map = { - 'probe_url': {'key': 'probeURL', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ValidateProbeInput, self).__init__(**kwargs) - self.probe_url = kwargs['probe_url'] - - -class ValidateProbeOutput(msrest.serialization.Model): - """Output of the validate probe API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar is_valid: Indicates whether the probe URL is accepted or not. - :vartype is_valid: bool - :ivar error_code: Specifies the error code when the probe url is not accepted. - :vartype error_code: str - :ivar message: The detailed error message describing why the probe URL is not accepted. - :vartype message: str - """ - - _validation = { - 'is_valid': {'readonly': True}, - 'error_code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ValidateProbeOutput, self).__init__(**kwargs) - self.is_valid = None - self.error_code = None - self.message = None - - -class ValidateSecretInput(msrest.serialization.Model): - """Input of the secret to be validated. - - All required parameters must be populated in order to send to Azure. - - :param secret_source: Required. The secret source. - :type secret_source: ~azure.mgmt.cdn.models.ResourceReference - :param secret_type: Required. The secret type. Possible values include: "UrlSigningKey", - "ManagedCertificate", "CustomerCertificate". - :type secret_type: str or ~azure.mgmt.cdn.models.ValidateSecretType - """ - - _validation = { - 'secret_source': {'required': True}, - 'secret_type': {'required': True}, - } - - _attribute_map = { - 'secret_source': {'key': 'secretSource', 'type': 'ResourceReference'}, - 'secret_type': {'key': 'secretType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ValidateSecretInput, self).__init__(**kwargs) - self.secret_source = kwargs['secret_source'] - self.secret_type = kwargs['secret_type'] - - -class ValidateSecretOutput(msrest.serialization.Model): - """Output of the validated secret. - - :param status: The validation status. Possible values include: "Valid", "Invalid", - "AccessDenied", "CertificateExpired". - :type status: str or ~azure.mgmt.cdn.models.Status - :param message: Detailed error message. - :type message: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ValidateSecretOutput, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.message = kwargs.get('message', None) - - -class ValidationToken(msrest.serialization.Model): - """The validation token. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar token: - :vartype token: str - """ - - _validation = { - 'token': {'readonly': True}, - } - - _attribute_map = { - 'token': {'key': 'token', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ValidationToken, self).__init__(**kwargs) - self.token = None - - -class WafMetricsResponse(msrest.serialization.Model): - """Waf Metrics Response. - - :param date_time_begin: - :type date_time_begin: ~datetime.datetime - :param date_time_end: - :type date_time_end: ~datetime.datetime - :param granularity: Possible values include: "PT5M", "PT1H", "P1D". - :type granularity: str or ~azure.mgmt.cdn.models.WafMetricsResponseGranularity - :param series: - :type series: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesItem] - """ - - _attribute_map = { - 'date_time_begin': {'key': 'dateTimeBegin', 'type': 'iso-8601'}, - 'date_time_end': {'key': 'dateTimeEnd', 'type': 'iso-8601'}, - 'granularity': {'key': 'granularity', 'type': 'str'}, - 'series': {'key': 'series', 'type': '[WafMetricsResponseSeriesItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(WafMetricsResponse, self).__init__(**kwargs) - self.date_time_begin = kwargs.get('date_time_begin', None) - self.date_time_end = kwargs.get('date_time_end', None) - self.granularity = kwargs.get('granularity', None) - self.series = kwargs.get('series', None) - - -class WafMetricsResponseSeriesItem(msrest.serialization.Model): - """WafMetricsResponseSeriesItem. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param metric: - :type metric: str - :ivar unit: Default value: "count". - :vartype unit: str - :param groups: - :type groups: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesPropertiesItemsItem] - :param data: - :type data: - list[~azure.mgmt.cdn.models.Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems] - """ - - _validation = { - 'unit': {'constant': True}, - } - - _attribute_map = { - 'metric': {'key': 'metric', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[WafMetricsResponseSeriesPropertiesItemsItem]'}, - 'data': {'key': 'data', 'type': '[Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems]'}, - } - - unit = "count" - - def __init__( - self, - **kwargs - ): - super(WafMetricsResponseSeriesItem, self).__init__(**kwargs) - self.metric = kwargs.get('metric', None) - self.groups = kwargs.get('groups', None) - self.data = kwargs.get('data', None) - - -class WafMetricsResponseSeriesPropertiesItemsItem(msrest.serialization.Model): - """WafMetricsResponseSeriesPropertiesItemsItem. - - :param name: - :type name: str - :param value: - :type value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WafMetricsResponseSeriesPropertiesItemsItem, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class WafRankingsResponse(msrest.serialization.Model): - """Waf Rankings Response. - - :param date_time_begin: - :type date_time_begin: ~datetime.datetime - :param date_time_end: - :type date_time_end: ~datetime.datetime - :param groups: - :type groups: list[str] - :param data: - :type data: list[~azure.mgmt.cdn.models.WafRankingsResponseDataItem] - """ - - _attribute_map = { - 'date_time_begin': {'key': 'dateTimeBegin', 'type': 'iso-8601'}, - 'date_time_end': {'key': 'dateTimeEnd', 'type': 'iso-8601'}, - 'groups': {'key': 'groups', 'type': '[str]'}, - 'data': {'key': 'data', 'type': '[WafRankingsResponseDataItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(WafRankingsResponse, self).__init__(**kwargs) - self.date_time_begin = kwargs.get('date_time_begin', None) - self.date_time_end = kwargs.get('date_time_end', None) - self.groups = kwargs.get('groups', None) - self.data = kwargs.get('data', None) - - -class WafRankingsResponseDataItem(msrest.serialization.Model): - """WafRankingsResponseDataItem. - - :param group_values: - :type group_values: list[str] - :param metrics: - :type metrics: - list[~azure.mgmt.cdn.models.ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems] - """ - - _attribute_map = { - 'group_values': {'key': 'groupValues', 'type': '[str]'}, - 'metrics': {'key': 'metrics', 'type': '[ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems]'}, - } - - def __init__( - self, - **kwargs - ): - super(WafRankingsResponseDataItem, self).__init__(**kwargs) - self.group_values = kwargs.get('group_values', None) - self.metrics = kwargs.get('metrics', None) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models_py3.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models_py3.py index f320c383c29a..900cf109d242 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models_py3.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_models_py3.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -15,6 +15,41 @@ from ._cdn_management_client_enums import * +class ActivatedResourceReference(msrest.serialization.Model): + """Reference to another resource along with its state. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar is_active: Whether the resource is active or inactive. + :vartype is_active: bool + """ + + _validation = { + 'is_active': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'is_active': {'key': 'isActive', 'type': 'bool'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super(ActivatedResourceReference, self).__init__(**kwargs) + self.id = id + self.is_active = None + + class Resource(msrest.serialization.Model): """The core properties of ARM resources. @@ -48,6 +83,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -55,7 +92,45 @@ def __init__( self.system_data = None -class AFDDomain(Resource): +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + 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 + :ivar system_data: Read only system data. + :vartype system_data: ~azure.mgmt.cdn.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class AFDDomain(ProxyResource): """Friendly domain name mapping to the endpoint hostname that the customer provides for branding purposes, e.g. www.contoso.com. Variables are only populated by the server, and will be ignored when sending a request. @@ -68,25 +143,30 @@ class AFDDomain(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param tls_settings: The configuration specifying how to enable HTTPS for the domain - using + :ivar profile_name: The name of the profile which holds the domain. + :vartype profile_name: str + :ivar tls_settings: The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. - :type tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters - :param azure_dns_zone: Resource reference to the Azure DNS zone. - :type azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :vartype tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters + :ivar azure_dns_zone: Resource reference to the Azure DNS zone. + :vartype azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :ivar pre_validated_custom_domain_resource_id: Resource reference to the Azure resource where + custom domain ownership was prevalidated. + :vartype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar domain_validation_state: Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. DCV stands for DomainControlValidation. Possible - values include: "Unknown", "Submitting", "Pending", "TimedOut", "PendingRevalidation", - "Approved". + values include: "Unknown", "Submitting", "Pending", "Rejected", "TimedOut", + "PendingRevalidation", "Approved". :vartype domain_validation_state: str or ~azure.mgmt.cdn.models.DomainValidationState - :param host_name: The host name of the domain. Must be a domain name. - :type host_name: str + :ivar host_name: The host name of the domain. Must be a domain name. + :vartype host_name: str :ivar validation_properties: Values the customer needs to validate domain ownership. :vartype validation_properties: ~azure.mgmt.cdn.models.DomainValidationProperties """ @@ -96,6 +176,7 @@ class AFDDomain(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, + 'profile_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, 'domain_validation_state': {'readonly': True}, @@ -107,8 +188,10 @@ class AFDDomain(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, 'tls_settings': {'key': 'properties.tlsSettings', 'type': 'AFDDomainHttpsParameters'}, 'azure_dns_zone': {'key': 'properties.azureDnsZone', 'type': 'ResourceReference'}, + 'pre_validated_custom_domain_resource_id': {'key': 'properties.preValidatedCustomDomainResourceId', 'type': 'ResourceReference'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, 'domain_validation_state': {'key': 'properties.domainValidationState', 'type': 'str'}, @@ -121,12 +204,28 @@ def __init__( *, tls_settings: Optional["AFDDomainHttpsParameters"] = None, azure_dns_zone: Optional["ResourceReference"] = None, + pre_validated_custom_domain_resource_id: Optional["ResourceReference"] = None, host_name: Optional[str] = None, **kwargs ): + """ + :keyword tls_settings: The configuration specifying how to enable HTTPS for the domain - using + AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl + uses AzureFrontDoor managed certificate by default. + :paramtype tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters + :keyword azure_dns_zone: Resource reference to the Azure DNS zone. + :paramtype azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :keyword pre_validated_custom_domain_resource_id: Resource reference to the Azure resource + where custom domain ownership was prevalidated. + :paramtype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference + :keyword host_name: The host name of the domain. Must be a domain name. + :paramtype host_name: str + """ super(AFDDomain, self).__init__(**kwargs) + self.profile_name = None self.tls_settings = tls_settings self.azure_dns_zone = azure_dns_zone + self.pre_validated_custom_domain_resource_id = pre_validated_custom_domain_resource_id self.provisioning_state = None self.deployment_status = None self.domain_validation_state = None @@ -139,14 +238,14 @@ class AFDDomainHttpsParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param certificate_type: Required. Defines the source of the SSL certificate. Possible values - include: "CustomerCertificate", "ManagedCertificate". - :type certificate_type: str or ~azure.mgmt.cdn.models.AfdCertificateType - :param minimum_tls_version: TLS protocol version that will be used for Https. Possible values + :ivar certificate_type: Required. Defines the source of the SSL certificate. Possible values + include: "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :vartype certificate_type: str or ~azure.mgmt.cdn.models.AfdCertificateType + :ivar minimum_tls_version: TLS protocol version that will be used for Https. Possible values include: "TLS10", "TLS12". - :type minimum_tls_version: str or ~azure.mgmt.cdn.models.AfdMinimumTlsVersion - :param secret: Resource reference to the secret. ie. subs/rg/profile/secret. - :type secret: ~azure.mgmt.cdn.models.ResourceReference + :vartype minimum_tls_version: str or ~azure.mgmt.cdn.models.AfdMinimumTlsVersion + :ivar secret: Resource reference to the secret. ie. subs/rg/profile/secret. + :vartype secret: ~azure.mgmt.cdn.models.ResourceReference """ _validation = { @@ -167,6 +266,16 @@ def __init__( secret: Optional["ResourceReference"] = None, **kwargs ): + """ + :keyword certificate_type: Required. Defines the source of the SSL certificate. Possible values + include: "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :paramtype certificate_type: str or ~azure.mgmt.cdn.models.AfdCertificateType + :keyword minimum_tls_version: TLS protocol version that will be used for Https. Possible values + include: "TLS10", "TLS12". + :paramtype minimum_tls_version: str or ~azure.mgmt.cdn.models.AfdMinimumTlsVersion + :keyword secret: Resource reference to the secret. ie. subs/rg/profile/secret. + :paramtype secret: ~azure.mgmt.cdn.models.ResourceReference + """ super(AFDDomainHttpsParameters, self).__init__(**kwargs) self.certificate_type = certificate_type self.minimum_tls_version = minimum_tls_version @@ -180,8 +289,8 @@ class AFDDomainListResult(msrest.serialization.Model): :ivar value: List of AzureFrontDoor domains within a profile. :vartype value: list[~azure.mgmt.cdn.models.AFDDomain] - :param next_link: URL to get the next set of domain objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of domain objects if there are any. + :vartype next_link: str """ _validation = { @@ -199,6 +308,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of domain objects if there are any. + :paramtype next_link: str + """ super(AFDDomainListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -212,7 +325,7 @@ class AFDStateProperties(msrest.serialization.Model): :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ @@ -231,6 +344,8 @@ def __init__( self, **kwargs ): + """ + """ super(AFDStateProperties, self).__init__(**kwargs) self.provisioning_state = None self.deployment_status = None @@ -239,17 +354,30 @@ def __init__( class AFDDomainUpdatePropertiesParameters(msrest.serialization.Model): """The JSON object that contains the properties of the domain to create. - :param tls_settings: The configuration specifying how to enable HTTPS for the domain - using + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar profile_name: The name of the profile which holds the domain. + :vartype profile_name: str + :ivar tls_settings: The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. - :type tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters - :param azure_dns_zone: Resource reference to the Azure DNS zone. - :type azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :vartype tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters + :ivar azure_dns_zone: Resource reference to the Azure DNS zone. + :vartype azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :ivar pre_validated_custom_domain_resource_id: Resource reference to the Azure resource where + custom domain ownership was prevalidated. + :vartype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference """ + _validation = { + 'profile_name': {'readonly': True}, + } + _attribute_map = { + 'profile_name': {'key': 'profileName', 'type': 'str'}, 'tls_settings': {'key': 'tlsSettings', 'type': 'AFDDomainHttpsParameters'}, 'azure_dns_zone': {'key': 'azureDnsZone', 'type': 'ResourceReference'}, + 'pre_validated_custom_domain_resource_id': {'key': 'preValidatedCustomDomainResourceId', 'type': 'ResourceReference'}, } def __init__( @@ -257,11 +385,25 @@ def __init__( *, tls_settings: Optional["AFDDomainHttpsParameters"] = None, azure_dns_zone: Optional["ResourceReference"] = None, - **kwargs - ): + pre_validated_custom_domain_resource_id: Optional["ResourceReference"] = None, + **kwargs + ): + """ + :keyword tls_settings: The configuration specifying how to enable HTTPS for the domain - using + AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl + uses AzureFrontDoor managed certificate by default. + :paramtype tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters + :keyword azure_dns_zone: Resource reference to the Azure DNS zone. + :paramtype azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :keyword pre_validated_custom_domain_resource_id: Resource reference to the Azure resource + where custom domain ownership was prevalidated. + :paramtype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference + """ super(AFDDomainUpdatePropertiesParameters, self).__init__(**kwargs) + self.profile_name = None self.tls_settings = tls_settings self.azure_dns_zone = azure_dns_zone + self.pre_validated_custom_domain_resource_id = pre_validated_custom_domain_resource_id class AFDDomainProperties(AFDDomainUpdatePropertiesParameters, AFDStateProperties): @@ -274,22 +416,27 @@ class AFDDomainProperties(AFDDomainUpdatePropertiesParameters, AFDStatePropertie :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :param tls_settings: The configuration specifying how to enable HTTPS for the domain - using + :ivar profile_name: The name of the profile which holds the domain. + :vartype profile_name: str + :ivar tls_settings: The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. - :type tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters - :param azure_dns_zone: Resource reference to the Azure DNS zone. - :type azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :vartype tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters + :ivar azure_dns_zone: Resource reference to the Azure DNS zone. + :vartype azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :ivar pre_validated_custom_domain_resource_id: Resource reference to the Azure resource where + custom domain ownership was prevalidated. + :vartype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference :ivar domain_validation_state: Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. DCV stands for DomainControlValidation. Possible - values include: "Unknown", "Submitting", "Pending", "TimedOut", "PendingRevalidation", - "Approved". + values include: "Unknown", "Submitting", "Pending", "Rejected", "TimedOut", + "PendingRevalidation", "Approved". :vartype domain_validation_state: str or ~azure.mgmt.cdn.models.DomainValidationState - :param host_name: Required. The host name of the domain. Must be a domain name. - :type host_name: str + :ivar host_name: Required. The host name of the domain. Must be a domain name. + :vartype host_name: str :ivar validation_properties: Values the customer needs to validate domain ownership. :vartype validation_properties: ~azure.mgmt.cdn.models.DomainValidationProperties """ @@ -297,6 +444,7 @@ class AFDDomainProperties(AFDDomainUpdatePropertiesParameters, AFDStatePropertie _validation = { 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, + 'profile_name': {'readonly': True}, 'domain_validation_state': {'readonly': True}, 'host_name': {'required': True}, 'validation_properties': {'readonly': True}, @@ -305,8 +453,10 @@ class AFDDomainProperties(AFDDomainUpdatePropertiesParameters, AFDStatePropertie _attribute_map = { 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, + 'profile_name': {'key': 'profileName', 'type': 'str'}, 'tls_settings': {'key': 'tlsSettings', 'type': 'AFDDomainHttpsParameters'}, 'azure_dns_zone': {'key': 'azureDnsZone', 'type': 'ResourceReference'}, + 'pre_validated_custom_domain_resource_id': {'key': 'preValidatedCustomDomainResourceId', 'type': 'ResourceReference'}, 'domain_validation_state': {'key': 'domainValidationState', 'type': 'str'}, 'host_name': {'key': 'hostName', 'type': 'str'}, 'validation_properties': {'key': 'validationProperties', 'type': 'DomainValidationProperties'}, @@ -318,16 +468,32 @@ def __init__( host_name: str, tls_settings: Optional["AFDDomainHttpsParameters"] = None, azure_dns_zone: Optional["ResourceReference"] = None, - **kwargs - ): - super(AFDDomainProperties, self).__init__(tls_settings=tls_settings, azure_dns_zone=azure_dns_zone, **kwargs) + pre_validated_custom_domain_resource_id: Optional["ResourceReference"] = None, + **kwargs + ): + """ + :keyword tls_settings: The configuration specifying how to enable HTTPS for the domain - using + AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl + uses AzureFrontDoor managed certificate by default. + :paramtype tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters + :keyword azure_dns_zone: Resource reference to the Azure DNS zone. + :paramtype azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :keyword pre_validated_custom_domain_resource_id: Resource reference to the Azure resource + where custom domain ownership was prevalidated. + :paramtype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference + :keyword host_name: Required. The host name of the domain. Must be a domain name. + :paramtype host_name: str + """ + super(AFDDomainProperties, self).__init__(tls_settings=tls_settings, azure_dns_zone=azure_dns_zone, pre_validated_custom_domain_resource_id=pre_validated_custom_domain_resource_id, **kwargs) self.provisioning_state = None self.deployment_status = None self.domain_validation_state = None self.host_name = host_name self.validation_properties = None + self.profile_name = None self.tls_settings = tls_settings self.azure_dns_zone = azure_dns_zone + self.pre_validated_custom_domain_resource_id = pre_validated_custom_domain_resource_id self.domain_validation_state = None self.host_name = host_name self.validation_properties = None @@ -336,17 +502,30 @@ def __init__( class AFDDomainUpdateParameters(msrest.serialization.Model): """The domain JSON object required for domain creation or update. - :param tls_settings: The configuration specifying how to enable HTTPS for the domain - using + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar profile_name: The name of the profile which holds the domain. + :vartype profile_name: str + :ivar tls_settings: The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. - :type tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters - :param azure_dns_zone: Resource reference to the Azure DNS zone. - :type azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :vartype tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters + :ivar azure_dns_zone: Resource reference to the Azure DNS zone. + :vartype azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :ivar pre_validated_custom_domain_resource_id: Resource reference to the Azure resource where + custom domain ownership was prevalidated. + :vartype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference """ + _validation = { + 'profile_name': {'readonly': True}, + } + _attribute_map = { + 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, 'tls_settings': {'key': 'properties.tlsSettings', 'type': 'AFDDomainHttpsParameters'}, 'azure_dns_zone': {'key': 'properties.azureDnsZone', 'type': 'ResourceReference'}, + 'pre_validated_custom_domain_resource_id': {'key': 'properties.preValidatedCustomDomainResourceId', 'type': 'ResourceReference'}, } def __init__( @@ -354,11 +533,25 @@ def __init__( *, tls_settings: Optional["AFDDomainHttpsParameters"] = None, azure_dns_zone: Optional["ResourceReference"] = None, - **kwargs - ): + pre_validated_custom_domain_resource_id: Optional["ResourceReference"] = None, + **kwargs + ): + """ + :keyword tls_settings: The configuration specifying how to enable HTTPS for the domain - using + AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl + uses AzureFrontDoor managed certificate by default. + :paramtype tls_settings: ~azure.mgmt.cdn.models.AFDDomainHttpsParameters + :keyword azure_dns_zone: Resource reference to the Azure DNS zone. + :paramtype azure_dns_zone: ~azure.mgmt.cdn.models.ResourceReference + :keyword pre_validated_custom_domain_resource_id: Resource reference to the Azure resource + where custom domain ownership was prevalidated. + :paramtype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference + """ super(AFDDomainUpdateParameters, self).__init__(**kwargs) + self.profile_name = None self.tls_settings = tls_settings self.azure_dns_zone = azure_dns_zone + self.pre_validated_custom_domain_resource_id = pre_validated_custom_domain_resource_id class TrackedResource(Resource): @@ -376,10 +569,10 @@ class TrackedResource(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -406,6 +599,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -426,25 +625,29 @@ class AFDEndpoint(TrackedResource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param origin_response_timeout_seconds: Send and receive timeout on forwarding request to the - origin. When timeout is reached, the request fails and returns. - :type origin_response_timeout_seconds: int - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar profile_name: The name of the profile which holds the endpoint. + :vartype profile_name: 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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net. :vartype host_name: str + :ivar auto_generated_domain_name_label_scope: Indicates the endpoint name reuse scope. The + default value is TenantReuse. Possible values include: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", "NoReuse". + :vartype auto_generated_domain_name_label_scope: str or + ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope """ _validation = { @@ -453,7 +656,7 @@ class AFDEndpoint(TrackedResource): 'type': {'readonly': True}, 'system_data': {'readonly': True}, 'location': {'required': True}, - 'origin_response_timeout_seconds': {'minimum': 16}, + 'profile_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, 'host_name': {'readonly': True}, @@ -466,11 +669,12 @@ class AFDEndpoint(TrackedResource): 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'origin_response_timeout_seconds': {'key': 'properties.originResponseTimeoutSeconds', 'type': 'int'}, + 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + 'auto_generated_domain_name_label_scope': {'key': 'properties.autoGeneratedDomainNameLabelScope', 'type': 'str'}, } def __init__( @@ -478,16 +682,31 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - origin_response_timeout_seconds: Optional[int] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, - **kwargs - ): + auto_generated_domain_name_label_scope: Optional[Union[str, "AutoGeneratedDomainNameLabelScope"]] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, 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.cdn.models.EnabledState + :keyword auto_generated_domain_name_label_scope: Indicates the endpoint name reuse scope. The + default value is TenantReuse. Possible values include: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", "NoReuse". + :paramtype auto_generated_domain_name_label_scope: str or + ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope + """ super(AFDEndpoint, self).__init__(location=location, tags=tags, **kwargs) - self.origin_response_timeout_seconds = origin_response_timeout_seconds + self.profile_name = None self.enabled_state = enabled_state self.provisioning_state = None self.deployment_status = None self.host_name = None + self.auto_generated_domain_name_label_scope = auto_generated_domain_name_label_scope class AFDEndpointListResult(msrest.serialization.Model): @@ -497,8 +716,8 @@ class AFDEndpointListResult(msrest.serialization.Model): :ivar value: List of AzureFrontDoor endpoints within a profile. :vartype value: list[~azure.mgmt.cdn.models.AFDEndpoint] - :param next_link: URL to get the next set of endpoint objects if there is any. - :type next_link: str + :ivar next_link: URL to get the next set of endpoint objects if there is any. + :vartype next_link: str """ _validation = { @@ -516,6 +735,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of endpoint objects if there is any. + :paramtype next_link: str + """ super(AFDEndpointListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -524,32 +747,37 @@ def __init__( class AFDEndpointPropertiesUpdateParameters(msrest.serialization.Model): """The JSON object containing endpoint update parameters. - :param origin_response_timeout_seconds: Send and receive timeout on forwarding request to the - origin. When timeout is reached, the request fails and returns. - :type origin_response_timeout_seconds: int - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar profile_name: The name of the profile which holds the endpoint. + :vartype profile_name: 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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ _validation = { - 'origin_response_timeout_seconds': {'minimum': 16}, + 'profile_name': {'readonly': True}, } _attribute_map = { - 'origin_response_timeout_seconds': {'key': 'originResponseTimeoutSeconds', 'type': 'int'}, + 'profile_name': {'key': 'profileName', 'type': 'str'}, 'enabled_state': {'key': 'enabledState', 'type': 'str'}, } def __init__( self, *, - origin_response_timeout_seconds: Optional[int] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, **kwargs ): + """ + :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.cdn.models.EnabledState + """ super(AFDEndpointPropertiesUpdateParameters, self).__init__(**kwargs) - self.origin_response_timeout_seconds = origin_response_timeout_seconds + self.profile_name = None self.enabled_state = enabled_state @@ -558,74 +786,92 @@ class AFDEndpointProperties(AFDStateProperties, AFDEndpointPropertiesUpdateParam Variables are only populated by the server, and will be ignored when sending a request. - :param origin_response_timeout_seconds: Send and receive timeout on forwarding request to the - origin. When timeout is reached, the request fails and returns. - :type origin_response_timeout_seconds: int - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + :ivar profile_name: The name of the profile which holds the endpoint. + :vartype profile_name: 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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net. :vartype host_name: str + :ivar auto_generated_domain_name_label_scope: Indicates the endpoint name reuse scope. The + default value is TenantReuse. Possible values include: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", "NoReuse". + :vartype auto_generated_domain_name_label_scope: str or + ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope """ _validation = { - 'origin_response_timeout_seconds': {'minimum': 16}, + 'profile_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, 'host_name': {'readonly': True}, } _attribute_map = { - 'origin_response_timeout_seconds': {'key': 'originResponseTimeoutSeconds', 'type': 'int'}, + 'profile_name': {'key': 'profileName', 'type': 'str'}, 'enabled_state': {'key': 'enabledState', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, 'host_name': {'key': 'hostName', 'type': 'str'}, + 'auto_generated_domain_name_label_scope': {'key': 'autoGeneratedDomainNameLabelScope', 'type': 'str'}, } def __init__( self, *, - origin_response_timeout_seconds: Optional[int] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, - **kwargs - ): - super(AFDEndpointProperties, self).__init__(origin_response_timeout_seconds=origin_response_timeout_seconds, enabled_state=enabled_state, **kwargs) - self.origin_response_timeout_seconds = origin_response_timeout_seconds + auto_generated_domain_name_label_scope: Optional[Union[str, "AutoGeneratedDomainNameLabelScope"]] = None, + **kwargs + ): + """ + :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.cdn.models.EnabledState + :keyword auto_generated_domain_name_label_scope: Indicates the endpoint name reuse scope. The + default value is TenantReuse. Possible values include: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", "NoReuse". + :paramtype auto_generated_domain_name_label_scope: str or + ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope + """ + super(AFDEndpointProperties, self).__init__(enabled_state=enabled_state, **kwargs) + self.profile_name = None self.enabled_state = enabled_state self.host_name = None + self.auto_generated_domain_name_label_scope = auto_generated_domain_name_label_scope self.provisioning_state = None self.deployment_status = None self.host_name = None + self.auto_generated_domain_name_label_scope = auto_generated_domain_name_label_scope class AFDEndpointUpdateParameters(msrest.serialization.Model): """Properties required to create or update an endpoint. - :param tags: A set of tags. Endpoint tags. - :type tags: dict[str, str] - :param origin_response_timeout_seconds: Send and receive timeout on forwarding request to the - origin. When timeout is reached, the request fails and returns. - :type origin_response_timeout_seconds: int - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tags: A set of tags. Endpoint tags. + :vartype tags: dict[str, str] + :ivar profile_name: The name of the profile which holds the endpoint. + :vartype profile_name: 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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ _validation = { - 'origin_response_timeout_seconds': {'minimum': 16}, + 'profile_name': {'readonly': True}, } _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, - 'origin_response_timeout_seconds': {'key': 'properties.originResponseTimeoutSeconds', 'type': 'int'}, + 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, } @@ -633,38 +879,48 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - origin_response_timeout_seconds: Optional[int] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Endpoint tags. + :paramtype tags: dict[str, 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.cdn.models.EnabledState + """ super(AFDEndpointUpdateParameters, self).__init__(**kwargs) self.tags = tags - self.origin_response_timeout_seconds = origin_response_timeout_seconds + self.profile_name = None self.enabled_state = enabled_state class AfdErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~azure.mgmt.cdn.models.ErrorResponse + :ivar error: The error object. + :vartype error: ~azure.mgmt.cdn.models.ErrorDetail """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponse'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, *, - error: Optional["ErrorResponse"] = None, + error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.cdn.models.ErrorDetail + """ super(AfdErrorResponse, self).__init__(**kwargs) self.error = error -class AFDOrigin(Resource): +class AFDOrigin(ProxyResource): """CDN origin is the source of the content being delivered via CDN. When the edge nodes represented by an endpoint do not have the requested content cached, they attempt to fetch it from one or more of the configured origins. Variables are only populated by the server, and will be ignored when sending a request. @@ -677,38 +933,42 @@ class AFDOrigin(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param azure_origin: Resource reference to the Azure origin resource. - :type azure_origin: ~azure.mgmt.cdn.models.ResourceReference - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + :ivar origin_group_name: The name of the origin group which contains this origin. + :vartype origin_group_name: str + :ivar azure_origin: Resource reference to the Azure origin resource. + :vartype azure_origin: ~azure.mgmt.cdn.models.ResourceReference + :ivar host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you + :vartype host_name: str + :ivar http_port: The value of the HTTP port. Must be between 1 and 65535. + :vartype http_port: int + :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. + :vartype https_port: int + :ivar origin_host_header: The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities + :vartype origin_host_header: str + :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 + :vartype priority: int + :ivar weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. - :type weight: int - :param shared_private_link_resource: The properties of the private link resource for private + :vartype weight: int + :ivar shared_private_link_resource: The properties of the private link resource for private origin. - :type shared_private_link_resource: object - :param enabled_state: Whether to enable health probes to be made against backends defined under + :vartype shared_private_link_resource: any + :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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState + :ivar enforce_certificate_name_check: Whether to enable certificate name check at origin level. + :vartype enforce_certificate_name_check: bool :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ @@ -718,6 +978,7 @@ class AFDOrigin(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, + 'origin_group_name': {'readonly': True}, 'http_port': {'maximum': 65535, 'minimum': 1}, 'https_port': {'maximum': 65535, 'minimum': 1}, 'priority': {'maximum': 5, 'minimum': 1}, @@ -731,6 +992,7 @@ class AFDOrigin(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'origin_group_name': {'key': 'properties.originGroupName', 'type': 'str'}, 'azure_origin': {'key': 'properties.azureOrigin', 'type': 'ResourceReference'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'http_port': {'key': 'properties.httpPort', 'type': 'int'}, @@ -740,6 +1002,7 @@ class AFDOrigin(Resource): 'weight': {'key': 'properties.weight', 'type': 'int'}, 'shared_private_link_resource': {'key': 'properties.sharedPrivateLinkResource', 'type': 'object'}, 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, + 'enforce_certificate_name_check': {'key': 'properties.enforceCertificateNameCheck', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, } @@ -754,11 +1017,46 @@ def __init__( origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, - shared_private_link_resource: Optional[object] = None, + shared_private_link_resource: Optional[Any] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, - **kwargs - ): + enforce_certificate_name_check: Optional[bool] = None, + **kwargs + ): + """ + :keyword azure_origin: Resource reference to the Azure origin resource. + :paramtype azure_origin: ~azure.mgmt.cdn.models.ResourceReference + :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + are supported.This should be unique across all origins in an endpoint. + :paramtype host_name: str + :keyword http_port: The value of the HTTP port. Must be between 1 and 65535. + :paramtype http_port: int + :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. + :paramtype https_port: int + :keyword origin_host_header: The host header value sent to the origin with each request. If you + leave this blank, the request hostname determines this value. Azure CDN origins, such as Web + Apps, Blob Storage, and Cloud Services require this host header value to match the origin + hostname by default. This overrides the host header defined at Endpoint. + :paramtype origin_host_header: str + :keyword priority: Priority of origin in given origin group for load balancing. Higher + priorities will not be used for load balancing if any lower priority origin is healthy.Must be + between 1 and 5. + :paramtype priority: int + :keyword weight: Weight of the origin in given origin group for load balancing. Must be between + 1 and 1000. + :paramtype weight: int + :keyword shared_private_link_resource: The properties of the private link resource for private + origin. + :paramtype shared_private_link_resource: any + :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.cdn.models.EnabledState + :keyword enforce_certificate_name_check: Whether to enable certificate name check at origin + level. + :paramtype enforce_certificate_name_check: bool + """ super(AFDOrigin, self).__init__(**kwargs) + self.origin_group_name = None self.azure_origin = azure_origin self.host_name = host_name self.http_port = http_port @@ -768,11 +1066,12 @@ def __init__( self.weight = weight self.shared_private_link_resource = shared_private_link_resource self.enabled_state = enabled_state + self.enforce_certificate_name_check = enforce_certificate_name_check self.provisioning_state = None self.deployment_status = None -class AFDOriginGroup(Resource): +class AFDOriginGroup(ProxyResource): """AFDOrigin group comprising of origins is used for load balancing to origins when the content cannot be served from CDN. Variables are only populated by the server, and will be ignored when sending a request. @@ -785,27 +1084,29 @@ class AFDOriginGroup(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters - :param health_probe_settings: Health probe settings to the origin that is used to determine the + :ivar profile_name: The name of the profile which holds the origin group. + :vartype profile_name: str + :ivar load_balancing_settings: Load balancing settings for a backend pool. + :vartype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters + :ivar health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift + :vartype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :ivar traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_afd_origin_error_detection_settings: The JSON object that contains the + :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :ivar response_based_afd_origin_error_detection_settings: The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. - :type response_based_afd_origin_error_detection_settings: + :vartype response_based_afd_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - :param session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState + :ivar session_affinity_state: Whether to allow session affinity on this host. Valid options are + 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :vartype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ @@ -815,6 +1116,7 @@ class AFDOriginGroup(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, + 'profile_name': {'readonly': True}, 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, @@ -825,6 +1127,7 @@ class AFDOriginGroup(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, 'load_balancing_settings': {'key': 'properties.loadBalancingSettings', 'type': 'LoadBalancingSettingsParameters'}, 'health_probe_settings': {'key': 'properties.healthProbeSettings', 'type': 'HealthProbeParameters'}, 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'properties.trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, @@ -844,7 +1147,27 @@ def __init__( session_affinity_state: Optional[Union[str, "EnabledState"]] = None, **kwargs ): + """ + :keyword load_balancing_settings: Load balancing settings for a backend pool. + :paramtype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters + :keyword health_probe_settings: Health probe settings to the origin that is used to determine + the health of the origin. + :paramtype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :keyword traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to + shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new + endpoint is added. Default is 10 mins. This property is currently not supported. + :paramtype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :keyword response_based_afd_origin_error_detection_settings: The JSON object that contains the + properties to determine origin health using real requests/responses. This property is currently + not supported. + :paramtype response_based_afd_origin_error_detection_settings: + ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters + :keyword session_affinity_state: Whether to allow session affinity on this host. Valid options + are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState + """ super(AFDOriginGroup, self).__init__(**kwargs) + self.profile_name = None self.load_balancing_settings = load_balancing_settings self.health_probe_settings = health_probe_settings self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = traffic_restoration_time_to_healed_or_new_endpoints_in_minutes @@ -861,8 +1184,8 @@ class AFDOriginGroupListResult(msrest.serialization.Model): :ivar value: List of CDN origin groups within an endpoint. :vartype value: list[~azure.mgmt.cdn.models.AFDOriginGroup] - :param next_link: URL to get the next set of origin objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of origin objects if there are any. + :vartype next_link: str """ _validation = { @@ -880,6 +1203,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of origin objects if there are any. + :paramtype next_link: str + """ super(AFDOriginGroupListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -888,30 +1215,36 @@ def __init__( class AFDOriginGroupUpdatePropertiesParameters(msrest.serialization.Model): """The JSON object that contains the properties of the origin group. - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters - :param health_probe_settings: Health probe settings to the origin that is used to determine the + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar profile_name: The name of the profile which holds the origin group. + :vartype profile_name: str + :ivar load_balancing_settings: Load balancing settings for a backend pool. + :vartype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters + :ivar health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift + :vartype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :ivar traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_afd_origin_error_detection_settings: The JSON object that contains the + :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :ivar response_based_afd_origin_error_detection_settings: The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. - :type response_based_afd_origin_error_detection_settings: + :vartype response_based_afd_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - :param session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState + :ivar session_affinity_state: Whether to allow session affinity on this host. Valid options are + 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :vartype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState """ _validation = { + 'profile_name': {'readonly': True}, 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, } _attribute_map = { + 'profile_name': {'key': 'profileName', 'type': 'str'}, 'load_balancing_settings': {'key': 'loadBalancingSettings', 'type': 'LoadBalancingSettingsParameters'}, 'health_probe_settings': {'key': 'healthProbeSettings', 'type': 'HealthProbeParameters'}, 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, @@ -929,7 +1262,27 @@ def __init__( session_affinity_state: Optional[Union[str, "EnabledState"]] = None, **kwargs ): + """ + :keyword load_balancing_settings: Load balancing settings for a backend pool. + :paramtype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters + :keyword health_probe_settings: Health probe settings to the origin that is used to determine + the health of the origin. + :paramtype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :keyword traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to + shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new + endpoint is added. Default is 10 mins. This property is currently not supported. + :paramtype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :keyword response_based_afd_origin_error_detection_settings: The JSON object that contains the + properties to determine origin health using real requests/responses. This property is currently + not supported. + :paramtype response_based_afd_origin_error_detection_settings: + ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters + :keyword session_affinity_state: Whether to allow session affinity on this host. Valid options + are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState + """ super(AFDOriginGroupUpdatePropertiesParameters, self).__init__(**kwargs) + self.profile_name = None self.load_balancing_settings = load_balancing_settings self.health_probe_settings = health_probe_settings self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = traffic_restoration_time_to_healed_or_new_endpoints_in_minutes @@ -942,38 +1295,42 @@ class AFDOriginGroupProperties(AFDStateProperties, AFDOriginGroupUpdatePropertie Variables are only populated by the server, and will be ignored when sending a request. - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters - :param health_probe_settings: Health probe settings to the origin that is used to determine the + :ivar profile_name: The name of the profile which holds the origin group. + :vartype profile_name: str + :ivar load_balancing_settings: Load balancing settings for a backend pool. + :vartype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters + :ivar health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift + :vartype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :ivar traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_afd_origin_error_detection_settings: The JSON object that contains the + :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :ivar response_based_afd_origin_error_detection_settings: The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. - :type response_based_afd_origin_error_detection_settings: + :vartype response_based_afd_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - :param session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState + :ivar session_affinity_state: Whether to allow session affinity on this host. Valid options are + 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :vartype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ _validation = { + 'profile_name': {'readonly': True}, 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, } _attribute_map = { + 'profile_name': {'key': 'profileName', 'type': 'str'}, 'load_balancing_settings': {'key': 'loadBalancingSettings', 'type': 'LoadBalancingSettingsParameters'}, 'health_probe_settings': {'key': 'healthProbeSettings', 'type': 'HealthProbeParameters'}, 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, @@ -993,7 +1350,27 @@ def __init__( session_affinity_state: Optional[Union[str, "EnabledState"]] = None, **kwargs ): + """ + :keyword load_balancing_settings: Load balancing settings for a backend pool. + :paramtype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters + :keyword health_probe_settings: Health probe settings to the origin that is used to determine + the health of the origin. + :paramtype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :keyword traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to + shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new + endpoint is added. Default is 10 mins. This property is currently not supported. + :paramtype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :keyword response_based_afd_origin_error_detection_settings: The JSON object that contains the + properties to determine origin health using real requests/responses. This property is currently + not supported. + :paramtype response_based_afd_origin_error_detection_settings: + ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters + :keyword session_affinity_state: Whether to allow session affinity on this host. Valid options + are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState + """ super(AFDOriginGroupProperties, self).__init__(load_balancing_settings=load_balancing_settings, health_probe_settings=health_probe_settings, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes=traffic_restoration_time_to_healed_or_new_endpoints_in_minutes, response_based_afd_origin_error_detection_settings=response_based_afd_origin_error_detection_settings, session_affinity_state=session_affinity_state, **kwargs) + self.profile_name = None self.load_balancing_settings = load_balancing_settings self.health_probe_settings = health_probe_settings self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = traffic_restoration_time_to_healed_or_new_endpoints_in_minutes @@ -1006,30 +1383,36 @@ def __init__( class AFDOriginGroupUpdateParameters(msrest.serialization.Model): """AFDOrigin group properties needed for origin group creation or update. - :param load_balancing_settings: Load balancing settings for a backend pool. - :type load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters - :param health_probe_settings: Health probe settings to the origin that is used to determine the + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar profile_name: The name of the profile which holds the origin group. + :vartype profile_name: str + :ivar load_balancing_settings: Load balancing settings for a backend pool. + :vartype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters + :ivar health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift + :vartype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :ivar traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_afd_origin_error_detection_settings: The JSON object that contains the + :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :ivar response_based_afd_origin_error_detection_settings: The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. - :type response_based_afd_origin_error_detection_settings: + :vartype response_based_afd_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters - :param session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState + :ivar session_affinity_state: Whether to allow session affinity on this host. Valid options are + 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :vartype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState """ _validation = { + 'profile_name': {'readonly': True}, 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, } _attribute_map = { + 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, 'load_balancing_settings': {'key': 'properties.loadBalancingSettings', 'type': 'LoadBalancingSettingsParameters'}, 'health_probe_settings': {'key': 'properties.healthProbeSettings', 'type': 'HealthProbeParameters'}, 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'key': 'properties.trafficRestorationTimeToHealedOrNewEndpointsInMinutes', 'type': 'int'}, @@ -1047,7 +1430,27 @@ def __init__( session_affinity_state: Optional[Union[str, "EnabledState"]] = None, **kwargs ): + """ + :keyword load_balancing_settings: Load balancing settings for a backend pool. + :paramtype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters + :keyword health_probe_settings: Health probe settings to the origin that is used to determine + the health of the origin. + :paramtype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :keyword traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to + shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new + endpoint is added. Default is 10 mins. This property is currently not supported. + :paramtype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :keyword response_based_afd_origin_error_detection_settings: The JSON object that contains the + properties to determine origin health using real requests/responses. This property is currently + not supported. + :paramtype response_based_afd_origin_error_detection_settings: + ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters + :keyword session_affinity_state: Whether to allow session affinity on this host. Valid options + are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + :paramtype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState + """ super(AFDOriginGroupUpdateParameters, self).__init__(**kwargs) + self.profile_name = None self.load_balancing_settings = load_balancing_settings self.health_probe_settings = health_probe_settings self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = traffic_restoration_time_to_healed_or_new_endpoints_in_minutes @@ -1062,8 +1465,8 @@ class AFDOriginListResult(msrest.serialization.Model): :ivar value: List of CDN origins within an endpoint. :vartype value: list[~azure.mgmt.cdn.models.AFDOrigin] - :param next_link: URL to get the next set of origin objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of origin objects if there are any. + :vartype next_link: str """ _validation = { @@ -1081,6 +1484,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of origin objects if there are any. + :paramtype next_link: str + """ super(AFDOriginListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -1089,37 +1496,44 @@ def __init__( class AFDOriginUpdatePropertiesParameters(msrest.serialization.Model): """The JSON object that contains the properties of the origin. - :param azure_origin: Resource reference to the Azure origin resource. - :type azure_origin: ~azure.mgmt.cdn.models.ResourceReference - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar origin_group_name: The name of the origin group which contains this origin. + :vartype origin_group_name: str + :ivar azure_origin: Resource reference to the Azure origin resource. + :vartype azure_origin: ~azure.mgmt.cdn.models.ResourceReference + :ivar host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you + :vartype host_name: str + :ivar http_port: The value of the HTTP port. Must be between 1 and 65535. + :vartype http_port: int + :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. + :vartype https_port: int + :ivar origin_host_header: The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities + :vartype origin_host_header: str + :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 + :vartype priority: int + :ivar weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. - :type weight: int - :param shared_private_link_resource: The properties of the private link resource for private + :vartype weight: int + :ivar shared_private_link_resource: The properties of the private link resource for private origin. - :type shared_private_link_resource: object - :param enabled_state: Whether to enable health probes to be made against backends defined under + :vartype shared_private_link_resource: any + :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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState + :ivar enforce_certificate_name_check: Whether to enable certificate name check at origin level. + :vartype enforce_certificate_name_check: bool """ _validation = { + 'origin_group_name': {'readonly': True}, 'http_port': {'maximum': 65535, 'minimum': 1}, 'https_port': {'maximum': 65535, 'minimum': 1}, 'priority': {'maximum': 5, 'minimum': 1}, @@ -1127,6 +1541,7 @@ class AFDOriginUpdatePropertiesParameters(msrest.serialization.Model): } _attribute_map = { + 'origin_group_name': {'key': 'originGroupName', 'type': 'str'}, 'azure_origin': {'key': 'azureOrigin', 'type': 'ResourceReference'}, 'host_name': {'key': 'hostName', 'type': 'str'}, 'http_port': {'key': 'httpPort', 'type': 'int'}, @@ -1136,6 +1551,7 @@ class AFDOriginUpdatePropertiesParameters(msrest.serialization.Model): 'weight': {'key': 'weight', 'type': 'int'}, 'shared_private_link_resource': {'key': 'sharedPrivateLinkResource', 'type': 'object'}, 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'enforce_certificate_name_check': {'key': 'enforceCertificateNameCheck', 'type': 'bool'}, } def __init__( @@ -1148,11 +1564,46 @@ def __init__( origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, - shared_private_link_resource: Optional[object] = None, + shared_private_link_resource: Optional[Any] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, - **kwargs - ): + enforce_certificate_name_check: Optional[bool] = None, + **kwargs + ): + """ + :keyword azure_origin: Resource reference to the Azure origin resource. + :paramtype azure_origin: ~azure.mgmt.cdn.models.ResourceReference + :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + are supported.This should be unique across all origins in an endpoint. + :paramtype host_name: str + :keyword http_port: The value of the HTTP port. Must be between 1 and 65535. + :paramtype http_port: int + :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. + :paramtype https_port: int + :keyword origin_host_header: The host header value sent to the origin with each request. If you + leave this blank, the request hostname determines this value. Azure CDN origins, such as Web + Apps, Blob Storage, and Cloud Services require this host header value to match the origin + hostname by default. This overrides the host header defined at Endpoint. + :paramtype origin_host_header: str + :keyword priority: Priority of origin in given origin group for load balancing. Higher + priorities will not be used for load balancing if any lower priority origin is healthy.Must be + between 1 and 5. + :paramtype priority: int + :keyword weight: Weight of the origin in given origin group for load balancing. Must be between + 1 and 1000. + :paramtype weight: int + :keyword shared_private_link_resource: The properties of the private link resource for private + origin. + :paramtype shared_private_link_resource: any + :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.cdn.models.EnabledState + :keyword enforce_certificate_name_check: Whether to enable certificate name check at origin + level. + :paramtype enforce_certificate_name_check: bool + """ super(AFDOriginUpdatePropertiesParameters, self).__init__(**kwargs) + self.origin_group_name = None self.azure_origin = azure_origin self.host_name = host_name self.http_port = http_port @@ -1162,6 +1613,7 @@ def __init__( self.weight = weight self.shared_private_link_resource = shared_private_link_resource self.enabled_state = enabled_state + self.enforce_certificate_name_check = enforce_certificate_name_check class AFDOriginProperties(AFDStateProperties, AFDOriginUpdatePropertiesParameters): @@ -1169,43 +1621,48 @@ class AFDOriginProperties(AFDStateProperties, AFDOriginUpdatePropertiesParameter Variables are only populated by the server, and will be ignored when sending a request. - :param azure_origin: Resource reference to the Azure origin resource. - :type azure_origin: ~azure.mgmt.cdn.models.ResourceReference - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + :ivar origin_group_name: The name of the origin group which contains this origin. + :vartype origin_group_name: str + :ivar azure_origin: Resource reference to the Azure origin resource. + :vartype azure_origin: ~azure.mgmt.cdn.models.ResourceReference + :ivar host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you + :vartype host_name: str + :ivar http_port: The value of the HTTP port. Must be between 1 and 65535. + :vartype http_port: int + :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. + :vartype https_port: int + :ivar origin_host_header: The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities + :vartype origin_host_header: str + :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 + :vartype priority: int + :ivar weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. - :type weight: int - :param shared_private_link_resource: The properties of the private link resource for private + :vartype weight: int + :ivar shared_private_link_resource: The properties of the private link resource for private origin. - :type shared_private_link_resource: object - :param enabled_state: Whether to enable health probes to be made against backends defined under + :vartype shared_private_link_resource: any + :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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState + :ivar enforce_certificate_name_check: Whether to enable certificate name check at origin level. + :vartype enforce_certificate_name_check: bool :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ _validation = { + 'origin_group_name': {'readonly': True}, 'http_port': {'maximum': 65535, 'minimum': 1}, 'https_port': {'maximum': 65535, 'minimum': 1}, 'priority': {'maximum': 5, 'minimum': 1}, @@ -1215,6 +1672,7 @@ class AFDOriginProperties(AFDStateProperties, AFDOriginUpdatePropertiesParameter } _attribute_map = { + 'origin_group_name': {'key': 'originGroupName', 'type': 'str'}, 'azure_origin': {'key': 'azureOrigin', 'type': 'ResourceReference'}, 'host_name': {'key': 'hostName', 'type': 'str'}, 'http_port': {'key': 'httpPort', 'type': 'int'}, @@ -1224,6 +1682,7 @@ class AFDOriginProperties(AFDStateProperties, AFDOriginUpdatePropertiesParameter 'weight': {'key': 'weight', 'type': 'int'}, 'shared_private_link_resource': {'key': 'sharedPrivateLinkResource', 'type': 'object'}, 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + 'enforce_certificate_name_check': {'key': 'enforceCertificateNameCheck', 'type': 'bool'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, } @@ -1238,11 +1697,46 @@ def __init__( origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, - shared_private_link_resource: Optional[object] = None, + shared_private_link_resource: Optional[Any] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, - **kwargs - ): - super(AFDOriginProperties, self).__init__(azure_origin=azure_origin, host_name=host_name, http_port=http_port, https_port=https_port, origin_host_header=origin_host_header, priority=priority, weight=weight, shared_private_link_resource=shared_private_link_resource, enabled_state=enabled_state, **kwargs) + enforce_certificate_name_check: Optional[bool] = None, + **kwargs + ): + """ + :keyword azure_origin: Resource reference to the Azure origin resource. + :paramtype azure_origin: ~azure.mgmt.cdn.models.ResourceReference + :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + are supported.This should be unique across all origins in an endpoint. + :paramtype host_name: str + :keyword http_port: The value of the HTTP port. Must be between 1 and 65535. + :paramtype http_port: int + :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. + :paramtype https_port: int + :keyword origin_host_header: The host header value sent to the origin with each request. If you + leave this blank, the request hostname determines this value. Azure CDN origins, such as Web + Apps, Blob Storage, and Cloud Services require this host header value to match the origin + hostname by default. This overrides the host header defined at Endpoint. + :paramtype origin_host_header: str + :keyword priority: Priority of origin in given origin group for load balancing. Higher + priorities will not be used for load balancing if any lower priority origin is healthy.Must be + between 1 and 5. + :paramtype priority: int + :keyword weight: Weight of the origin in given origin group for load balancing. Must be between + 1 and 1000. + :paramtype weight: int + :keyword shared_private_link_resource: The properties of the private link resource for private + origin. + :paramtype shared_private_link_resource: any + :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.cdn.models.EnabledState + :keyword enforce_certificate_name_check: Whether to enable certificate name check at origin + level. + :paramtype enforce_certificate_name_check: bool + """ + super(AFDOriginProperties, self).__init__(azure_origin=azure_origin, host_name=host_name, http_port=http_port, https_port=https_port, origin_host_header=origin_host_header, priority=priority, weight=weight, shared_private_link_resource=shared_private_link_resource, enabled_state=enabled_state, enforce_certificate_name_check=enforce_certificate_name_check, **kwargs) + self.origin_group_name = None self.azure_origin = azure_origin self.host_name = host_name self.http_port = http_port @@ -1252,6 +1746,7 @@ def __init__( self.weight = weight self.shared_private_link_resource = shared_private_link_resource self.enabled_state = enabled_state + self.enforce_certificate_name_check = enforce_certificate_name_check self.provisioning_state = None self.deployment_status = None @@ -1259,37 +1754,44 @@ def __init__( class AFDOriginUpdateParameters(msrest.serialization.Model): """AFDOrigin properties needed for origin update. - :param azure_origin: Resource reference to the Azure origin resource. - :type azure_origin: ~azure.mgmt.cdn.models.ResourceReference - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar origin_group_name: The name of the origin group which contains this origin. + :vartype origin_group_name: str + :ivar azure_origin: Resource reference to the Azure origin resource. + :vartype azure_origin: ~azure.mgmt.cdn.models.ResourceReference + :ivar host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you + :vartype host_name: str + :ivar http_port: The value of the HTTP port. Must be between 1 and 65535. + :vartype http_port: int + :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. + :vartype https_port: int + :ivar origin_host_header: The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities + :vartype origin_host_header: str + :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 + :vartype priority: int + :ivar weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. - :type weight: int - :param shared_private_link_resource: The properties of the private link resource for private + :vartype weight: int + :ivar shared_private_link_resource: The properties of the private link resource for private origin. - :type shared_private_link_resource: object - :param enabled_state: Whether to enable health probes to be made against backends defined under + :vartype shared_private_link_resource: any + :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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState + :ivar enforce_certificate_name_check: Whether to enable certificate name check at origin level. + :vartype enforce_certificate_name_check: bool """ _validation = { + 'origin_group_name': {'readonly': True}, 'http_port': {'maximum': 65535, 'minimum': 1}, 'https_port': {'maximum': 65535, 'minimum': 1}, 'priority': {'maximum': 5, 'minimum': 1}, @@ -1297,6 +1799,7 @@ class AFDOriginUpdateParameters(msrest.serialization.Model): } _attribute_map = { + 'origin_group_name': {'key': 'properties.originGroupName', 'type': 'str'}, 'azure_origin': {'key': 'properties.azureOrigin', 'type': 'ResourceReference'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'http_port': {'key': 'properties.httpPort', 'type': 'int'}, @@ -1306,6 +1809,7 @@ class AFDOriginUpdateParameters(msrest.serialization.Model): 'weight': {'key': 'properties.weight', 'type': 'int'}, 'shared_private_link_resource': {'key': 'properties.sharedPrivateLinkResource', 'type': 'object'}, 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, + 'enforce_certificate_name_check': {'key': 'properties.enforceCertificateNameCheck', 'type': 'bool'}, } def __init__( @@ -1318,11 +1822,46 @@ def __init__( origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, - shared_private_link_resource: Optional[object] = None, + shared_private_link_resource: Optional[Any] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, - **kwargs - ): + enforce_certificate_name_check: Optional[bool] = None, + **kwargs + ): + """ + :keyword azure_origin: Resource reference to the Azure origin resource. + :paramtype azure_origin: ~azure.mgmt.cdn.models.ResourceReference + :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + are supported.This should be unique across all origins in an endpoint. + :paramtype host_name: str + :keyword http_port: The value of the HTTP port. Must be between 1 and 65535. + :paramtype http_port: int + :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. + :paramtype https_port: int + :keyword origin_host_header: The host header value sent to the origin with each request. If you + leave this blank, the request hostname determines this value. Azure CDN origins, such as Web + Apps, Blob Storage, and Cloud Services require this host header value to match the origin + hostname by default. This overrides the host header defined at Endpoint. + :paramtype origin_host_header: str + :keyword priority: Priority of origin in given origin group for load balancing. Higher + priorities will not be used for load balancing if any lower priority origin is healthy.Must be + between 1 and 5. + :paramtype priority: int + :keyword weight: Weight of the origin in given origin group for load balancing. Must be between + 1 and 1000. + :paramtype weight: int + :keyword shared_private_link_resource: The properties of the private link resource for private + origin. + :paramtype shared_private_link_resource: any + :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.cdn.models.EnabledState + :keyword enforce_certificate_name_check: Whether to enable certificate name check at origin + level. + :paramtype enforce_certificate_name_check: bool + """ super(AFDOriginUpdateParameters, self).__init__(**kwargs) + self.origin_group_name = None self.azure_origin = azure_origin self.host_name = host_name self.http_port = http_port @@ -1332,6 +1871,7 @@ def __init__( self.weight = weight self.shared_private_link_resource = shared_private_link_resource self.enabled_state = enabled_state + self.enforce_certificate_name_check = enforce_certificate_name_check class AfdPurgeParameters(msrest.serialization.Model): @@ -1339,11 +1879,11 @@ class AfdPurgeParameters(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] - :param domains: List of domains. - :type domains: list[str] + :vartype content_paths: list[str] + :ivar domains: List of domains. + :vartype domains: list[str] """ _validation = { @@ -1362,11 +1902,286 @@ def __init__( domains: Optional[List[str]] = None, **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] + :keyword domains: List of domains. + :paramtype domains: list[str] + """ super(AfdPurgeParameters, self).__init__(**kwargs) self.content_paths = content_paths self.domains = domains +class AfdRouteCacheConfiguration(msrest.serialization.Model): + """Caching settings for a caching-type route. To disable caching, do not provide a cacheConfiguration object. + + :ivar query_string_caching_behavior: Defines how Frontdoor caches requests that include query + strings. You can ignore any query strings when caching, ignore specific query strings, cache + every request with a unique URL, or cache specific query strings. Possible values include: + "IgnoreQueryString", "UseQueryString", "IgnoreSpecifiedQueryStrings", + "IncludeSpecifiedQueryStrings". + :vartype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior + :ivar query_parameters: query parameters to include or exclude (comma separated). + :vartype query_parameters: str + :ivar compression_settings: compression settings. + :vartype compression_settings: any + """ + + _attribute_map = { + 'query_string_caching_behavior': {'key': 'queryStringCachingBehavior', 'type': 'str'}, + 'query_parameters': {'key': 'queryParameters', 'type': 'str'}, + 'compression_settings': {'key': 'compressionSettings', 'type': 'object'}, + } + + def __init__( + self, + *, + query_string_caching_behavior: Optional[Union[str, "AfdQueryStringCachingBehavior"]] = None, + query_parameters: Optional[str] = None, + compression_settings: Optional[Any] = None, + **kwargs + ): + """ + :keyword query_string_caching_behavior: Defines how Frontdoor caches requests that include + query strings. You can ignore any query strings when caching, ignore specific query strings, + cache every request with a unique URL, or cache specific query strings. Possible values + include: "IgnoreQueryString", "UseQueryString", "IgnoreSpecifiedQueryStrings", + "IncludeSpecifiedQueryStrings". + :paramtype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior + :keyword query_parameters: query parameters to include or exclude (comma separated). + :paramtype query_parameters: str + :keyword compression_settings: compression settings. + :paramtype compression_settings: any + """ + super(AfdRouteCacheConfiguration, self).__init__(**kwargs) + self.query_string_caching_behavior = query_string_caching_behavior + self.query_parameters = query_parameters + self.compression_settings = compression_settings + + +class Certificate(msrest.serialization.Model): + """Certificate used for https. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the secret resource. Possible values include: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :vartype type: str or ~azure.mgmt.cdn.models.SecretType + :ivar subject: Subject name in the certificate. + :vartype subject: str + :ivar expiration_date: Certificate expiration date. + :vartype expiration_date: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiration_date': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "SecretType"]] = None, + **kwargs + ): + """ + :keyword type: The type of the secret resource. Possible values include: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :paramtype type: str or ~azure.mgmt.cdn.models.SecretType + """ + super(Certificate, self).__init__(**kwargs) + self.type = type + self.subject = None + self.expiration_date = None + + +class AzureFirstPartyManagedCertificate(Certificate): + """Azure FirstParty Managed Certificate provided by other first party resource providers to enable HTTPS. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the secret resource. Possible values include: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :vartype type: str or ~azure.mgmt.cdn.models.SecretType + :ivar subject: Subject name in the certificate. + :vartype subject: str + :ivar expiration_date: Certificate expiration date. + :vartype expiration_date: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiration_date': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "SecretType"]] = None, + **kwargs + ): + """ + :keyword type: The type of the secret resource. Possible values include: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :paramtype type: str or ~azure.mgmt.cdn.models.SecretType + """ + super(AzureFirstPartyManagedCertificate, self).__init__(type=type, **kwargs) + + +class SecretParameters(msrest.serialization.Model): + """The json object containing secret parameters. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureFirstPartyManagedCertificateParameters, CustomerCertificateParameters, ManagedCertificateParameters, UrlSigningKeyParameters. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the secret resource.Constant filled by server. Possible + values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate", + "AzureFirstPartyManagedCertificate". + :vartype type: str or ~azure.mgmt.cdn.models.SecretType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'AzureFirstPartyManagedCertificate': 'AzureFirstPartyManagedCertificateParameters', 'CustomerCertificate': 'CustomerCertificateParameters', 'ManagedCertificate': 'ManagedCertificateParameters', 'UrlSigningKey': 'UrlSigningKeyParameters'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SecretParameters, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class AzureFirstPartyManagedCertificateParameters(SecretParameters): + """Azure FirstParty Managed Certificate provided by other first party resource providers to enable HTTPS. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the secret resource.Constant filled by server. Possible + values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate", + "AzureFirstPartyManagedCertificate". + :vartype type: str or ~azure.mgmt.cdn.models.SecretType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AzureFirstPartyManagedCertificateParameters, self).__init__(**kwargs) + self.type = 'AzureFirstPartyManagedCertificate' # type: str + + +class CacheConfiguration(msrest.serialization.Model): + """Caching settings for a caching-type route. To disable caching, do not provide a cacheConfiguration object. + + :ivar query_string_caching_behavior: Defines how Frontdoor caches requests that include query + strings. You can ignore any query strings when caching, ignore specific query strings, cache + every request with a unique URL, or cache specific query strings. Possible values include: + "IgnoreQueryString", "UseQueryString", "IgnoreSpecifiedQueryStrings", + "IncludeSpecifiedQueryStrings". + :vartype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.RuleQueryStringCachingBehavior + :ivar query_parameters: query parameters to include or exclude (comma separated). + :vartype query_parameters: str + :ivar is_compression_enabled: Indicates whether content compression is enabled. If compression + is enabled, content will be served as compressed if user requests for a compressed version. + Content won't be compressed on AzureFrontDoor when requested content is smaller than 1 byte or + larger than 1 MB. Possible values include: "Enabled", "Disabled". + :vartype is_compression_enabled: str or ~azure.mgmt.cdn.models.RuleIsCompressionEnabled + :ivar cache_behavior: Caching behavior for the requests. Possible values include: + "HonorOrigin", "OverrideAlways", "OverrideIfOriginMissing". + :vartype cache_behavior: str or ~azure.mgmt.cdn.models.RuleCacheBehavior + :ivar cache_duration: The duration for which the content needs to be cached. Allowed format is + [d.]hh:mm:ss. + :vartype cache_duration: str + """ + + _attribute_map = { + 'query_string_caching_behavior': {'key': 'queryStringCachingBehavior', 'type': 'str'}, + 'query_parameters': {'key': 'queryParameters', 'type': 'str'}, + 'is_compression_enabled': {'key': 'isCompressionEnabled', 'type': 'str'}, + 'cache_behavior': {'key': 'cacheBehavior', 'type': 'str'}, + 'cache_duration': {'key': 'cacheDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + query_string_caching_behavior: Optional[Union[str, "RuleQueryStringCachingBehavior"]] = None, + query_parameters: Optional[str] = None, + is_compression_enabled: Optional[Union[str, "RuleIsCompressionEnabled"]] = None, + cache_behavior: Optional[Union[str, "RuleCacheBehavior"]] = None, + cache_duration: Optional[str] = None, + **kwargs + ): + """ + :keyword query_string_caching_behavior: Defines how Frontdoor caches requests that include + query strings. You can ignore any query strings when caching, ignore specific query strings, + cache every request with a unique URL, or cache specific query strings. Possible values + include: "IgnoreQueryString", "UseQueryString", "IgnoreSpecifiedQueryStrings", + "IncludeSpecifiedQueryStrings". + :paramtype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.RuleQueryStringCachingBehavior + :keyword query_parameters: query parameters to include or exclude (comma separated). + :paramtype query_parameters: str + :keyword is_compression_enabled: Indicates whether content compression is enabled. If + compression is enabled, content will be served as compressed if user requests for a compressed + version. Content won't be compressed on AzureFrontDoor when requested content is smaller than 1 + byte or larger than 1 MB. Possible values include: "Enabled", "Disabled". + :paramtype is_compression_enabled: str or ~azure.mgmt.cdn.models.RuleIsCompressionEnabled + :keyword cache_behavior: Caching behavior for the requests. Possible values include: + "HonorOrigin", "OverrideAlways", "OverrideIfOriginMissing". + :paramtype cache_behavior: str or ~azure.mgmt.cdn.models.RuleCacheBehavior + :keyword cache_duration: The duration for which the content needs to be cached. Allowed format + is [d.]hh:mm:ss. + :paramtype cache_duration: str + """ + super(CacheConfiguration, self).__init__(**kwargs) + self.query_string_caching_behavior = query_string_caching_behavior + self.query_parameters = query_parameters + self.is_compression_enabled = is_compression_enabled + self.cache_behavior = cache_behavior + self.cache_duration = cache_duration + + class CacheExpirationActionParameters(msrest.serialization.Model): """Defines the parameters for the cache expiration action. @@ -1374,34 +2189,33 @@ class CacheExpirationActionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleCacheExpirationActionParameters". - :vartype odata_type: str - :param cache_behavior: Required. Caching behavior for the requests. Possible values include: + :ivar type_name: Has constant value: "DeliveryRuleCacheExpirationActionParameters". + :vartype type_name: str + :ivar cache_behavior: Required. Caching behavior for the requests. Possible values include: "BypassCache", "Override", "SetIfMissing". - :type cache_behavior: str or ~azure.mgmt.cdn.models.CacheBehavior - :param cache_type: Required. The level at which the content needs to be cached. Possible values + :vartype cache_behavior: str or ~azure.mgmt.cdn.models.CacheBehavior + :ivar cache_type: Required. The level at which the content needs to be cached. Possible values include: "All". - :type cache_type: str or ~azure.mgmt.cdn.models.CacheType - :param cache_duration: The duration for which the content needs to be cached. Allowed format is + :vartype cache_type: str or ~azure.mgmt.cdn.models.CacheType + :ivar cache_duration: The duration for which the content needs to be cached. Allowed format is [d.]hh:mm:ss. - :type cache_duration: str + :vartype cache_duration: str """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'cache_behavior': {'required': True}, 'cache_type': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'cache_behavior': {'key': 'cacheBehavior', 'type': 'str'}, 'cache_type': {'key': 'cacheType', 'type': 'str'}, 'cache_duration': {'key': 'cacheDuration', 'type': 'str'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleCacheExpirationActionParameters" + type_name = "DeliveryRuleCacheExpirationActionParameters" def __init__( self, @@ -1411,6 +2225,17 @@ def __init__( cache_duration: Optional[str] = None, **kwargs ): + """ + :keyword cache_behavior: Required. Caching behavior for the requests. Possible values include: + "BypassCache", "Override", "SetIfMissing". + :paramtype cache_behavior: str or ~azure.mgmt.cdn.models.CacheBehavior + :keyword cache_type: Required. The level at which the content needs to be cached. Possible + values include: "All". + :paramtype cache_type: str or ~azure.mgmt.cdn.models.CacheType + :keyword cache_duration: The duration for which the content needs to be cached. Allowed format + is [d.]hh:mm:ss. + :paramtype cache_duration: str + """ super(CacheExpirationActionParameters, self).__init__(**kwargs) self.cache_behavior = cache_behavior self.cache_type = cache_type @@ -1424,28 +2249,28 @@ class CacheKeyQueryStringActionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleCacheKeyQueryStringBehaviorActionParameters". - :vartype odata_type: str - :param query_string_behavior: Required. Caching behavior for the requests. Possible values + :ivar type_name: Has constant value: + "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters". + :vartype type_name: str + :ivar query_string_behavior: Required. Caching behavior for the requests. Possible values include: "Include", "IncludeAll", "Exclude", "ExcludeAll". - :type query_string_behavior: str or ~azure.mgmt.cdn.models.QueryStringBehavior - :param query_parameters: query parameters to include or exclude (comma separated). - :type query_parameters: str + :vartype query_string_behavior: str or ~azure.mgmt.cdn.models.QueryStringBehavior + :ivar query_parameters: query parameters to include or exclude (comma separated). + :vartype query_parameters: str """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'query_string_behavior': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'query_string_behavior': {'key': 'queryStringBehavior', 'type': 'str'}, 'query_parameters': {'key': 'queryParameters', 'type': 'str'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" + type_name = "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" def __init__( self, @@ -1454,6 +2279,13 @@ def __init__( query_parameters: Optional[str] = None, **kwargs ): + """ + :keyword query_string_behavior: Required. Caching behavior for the requests. Possible values + include: "Include", "IncludeAll", "Exclude", "ExcludeAll". + :paramtype query_string_behavior: str or ~azure.mgmt.cdn.models.QueryStringBehavior + :keyword query_parameters: query parameters to include or exclude (comma separated). + :paramtype query_parameters: str + """ super(CacheKeyQueryStringActionParameters, self).__init__(**kwargs) self.query_string_behavior = query_string_behavior self.query_parameters = query_parameters @@ -1466,25 +2298,24 @@ class CdnCertificateSourceParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.CdnCertificateSourceParameters". - :vartype odata_type: str - :param certificate_type: Required. Type of certificate used. Possible values include: "Shared", + :ivar type_name: Has constant value: "CdnCertificateSourceParameters". + :vartype type_name: str + :ivar certificate_type: Required. Type of certificate used. Possible values include: "Shared", "Dedicated". - :type certificate_type: str or ~azure.mgmt.cdn.models.CertificateType + :vartype certificate_type: str or ~azure.mgmt.cdn.models.CertificateType """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'certificate_type': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'certificate_type': {'key': 'certificateType', 'type': 'str'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.CdnCertificateSourceParameters" + type_name = "CdnCertificateSourceParameters" def __init__( self, @@ -1492,6 +2323,11 @@ def __init__( certificate_type: Union[str, "CertificateType"], **kwargs ): + """ + :keyword certificate_type: Required. Type of certificate used. Possible values include: + "Shared", "Dedicated". + :paramtype certificate_type: str or ~azure.mgmt.cdn.models.CertificateType + """ super(CdnCertificateSourceParameters, self).__init__(**kwargs) self.certificate_type = certificate_type @@ -1499,8 +2335,8 @@ def __init__( class CdnEndpoint(msrest.serialization.Model): """Defines the ARM Resource ID for the linked endpoints. - :param id: ARM Resource ID string. - :type id: str + :ivar id: ARM Resource ID string. + :vartype id: str """ _attribute_map = { @@ -1513,6 +2349,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: ARM Resource ID string. + :paramtype id: str + """ super(CdnEndpoint, self).__init__(**kwargs) self.id = id @@ -1525,15 +2365,15 @@ class CustomDomainHttpsParameters(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.Constant filled - by server. Possible values include: "AzureKeyVault", "Cdn". - :type certificate_source: str or ~azure.mgmt.cdn.models.CertificateSource - :param protocol_type: Required. Defines the TLS extension protocol that is used for secure + :ivar certificate_source: Required. Defines the source of the SSL certificate.Constant filled + by server. Possible values include: "AzureKeyVault", "Cdn". + :vartype certificate_source: str or ~azure.mgmt.cdn.models.CertificateSource + :ivar protocol_type: Required. Defines the TLS extension protocol that is used for secure delivery. Possible values include: "ServerNameIndication", "IPBased". - :type protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType - :param minimum_tls_version: TLS protocol version that will be used for Https. Possible values + :vartype protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType + :ivar minimum_tls_version: TLS protocol version that will be used for Https. Possible values include: "None", "TLS10", "TLS12". - :type minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion + :vartype minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion """ _validation = { @@ -1558,6 +2398,14 @@ def __init__( minimum_tls_version: Optional[Union[str, "MinimumTlsVersion"]] = None, **kwargs ): + """ + :keyword protocol_type: Required. Defines the TLS extension protocol that is used for secure + delivery. Possible values include: "ServerNameIndication", "IPBased". + :paramtype protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType + :keyword minimum_tls_version: TLS protocol version that will be used for Https. Possible values + include: "None", "TLS10", "TLS12". + :paramtype minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion + """ super(CustomDomainHttpsParameters, self).__init__(**kwargs) self.certificate_source = None # type: Optional[str] self.protocol_type = protocol_type @@ -1569,18 +2417,18 @@ class CdnManagedHttpsParameters(CustomDomainHttpsParameters): All required parameters must be populated in order to send to Azure. - :param certificate_source: Required. Defines the source of the SSL certificate.Constant filled - by server. Possible values include: "AzureKeyVault", "Cdn". - :type certificate_source: str or ~azure.mgmt.cdn.models.CertificateSource - :param protocol_type: Required. Defines the TLS extension protocol that is used for secure + :ivar certificate_source: Required. Defines the source of the SSL certificate.Constant filled + by server. Possible values include: "AzureKeyVault", "Cdn". + :vartype certificate_source: str or ~azure.mgmt.cdn.models.CertificateSource + :ivar protocol_type: Required. Defines the TLS extension protocol that is used for secure delivery. Possible values include: "ServerNameIndication", "IPBased". - :type protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType - :param minimum_tls_version: TLS protocol version that will be used for Https. Possible values + :vartype protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType + :ivar minimum_tls_version: TLS protocol version that will be used for Https. Possible values include: "None", "TLS10", "TLS12". - :type minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion - :param certificate_source_parameters: Required. Defines the certificate source parameters using + :vartype minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion + :ivar certificate_source_parameters: Required. Defines the certificate source parameters using CDN managed certificate for enabling SSL. - :type certificate_source_parameters: ~azure.mgmt.cdn.models.CdnCertificateSourceParameters + :vartype certificate_source_parameters: ~azure.mgmt.cdn.models.CdnCertificateSourceParameters """ _validation = { @@ -1604,6 +2452,17 @@ def __init__( minimum_tls_version: Optional[Union[str, "MinimumTlsVersion"]] = None, **kwargs ): + """ + :keyword protocol_type: Required. Defines the TLS extension protocol that is used for secure + delivery. Possible values include: "ServerNameIndication", "IPBased". + :paramtype protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType + :keyword minimum_tls_version: TLS protocol version that will be used for Https. Possible values + include: "None", "TLS10", "TLS12". + :paramtype minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion + :keyword certificate_source_parameters: Required. Defines the certificate source parameters + using CDN managed certificate for enabling SSL. + :paramtype certificate_source_parameters: ~azure.mgmt.cdn.models.CdnCertificateSourceParameters + """ super(CdnManagedHttpsParameters, self).__init__(protocol_type=protocol_type, minimum_tls_version=minimum_tls_version, **kwargs) self.certificate_source = 'Cdn' # type: str self.certificate_source_parameters = certificate_source_parameters @@ -1624,23 +2483,23 @@ class CdnWebApplicationFirewallPolicy(TrackedResource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param location: Required. 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: Required. The pricing tier (defines a CDN provider, feature list and rate) of the + :ivar location: Required. 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: Required. The pricing tier (defines a CDN provider, feature list and rate) of the CdnWebApplicationFirewallPolicy. - :type sku: ~azure.mgmt.cdn.models.Sku - :param policy_settings: Describes policySettings for policy. - :type policy_settings: ~azure.mgmt.cdn.models.PolicySettings - :param rate_limit_rules: Describes rate limit rules inside the policy. - :type rate_limit_rules: ~azure.mgmt.cdn.models.RateLimitRuleList - :param custom_rules: Describes custom rules inside the policy. - :type custom_rules: ~azure.mgmt.cdn.models.CustomRuleList - :param managed_rules: Describes managed rules inside the policy. - :type managed_rules: ~azure.mgmt.cdn.models.ManagedRuleSetList + :vartype sku: ~azure.mgmt.cdn.models.Sku + :ivar policy_settings: Describes policySettings for policy. + :vartype policy_settings: ~azure.mgmt.cdn.models.PolicySettings + :ivar rate_limit_rules: Describes rate limit rules inside the policy. + :vartype rate_limit_rules: ~azure.mgmt.cdn.models.RateLimitRuleList + :ivar custom_rules: Describes custom rules inside the policy. + :vartype custom_rules: ~azure.mgmt.cdn.models.CustomRuleList + :ivar managed_rules: Describes managed rules inside the policy. + :vartype managed_rules: ~azure.mgmt.cdn.models.ManagedRuleSetList :ivar endpoint_links: Describes Azure CDN endpoints associated with this Web Application Firewall policy. :vartype endpoint_links: list[~azure.mgmt.cdn.models.CdnEndpoint] @@ -1695,6 +2554,25 @@ def __init__( managed_rules: Optional["ManagedRuleSetList"] = None, **kwargs ): + """ + :keyword location: Required. 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: Required. The pricing tier (defines a CDN provider, feature list and rate) of the + CdnWebApplicationFirewallPolicy. + :paramtype sku: ~azure.mgmt.cdn.models.Sku + :keyword policy_settings: Describes policySettings for policy. + :paramtype policy_settings: ~azure.mgmt.cdn.models.PolicySettings + :keyword rate_limit_rules: Describes rate limit rules inside the policy. + :paramtype rate_limit_rules: ~azure.mgmt.cdn.models.RateLimitRuleList + :keyword custom_rules: Describes custom rules inside the policy. + :paramtype custom_rules: ~azure.mgmt.cdn.models.CustomRuleList + :keyword managed_rules: Describes managed rules inside the policy. + :paramtype managed_rules: ~azure.mgmt.cdn.models.ManagedRuleSetList + """ super(CdnWebApplicationFirewallPolicy, self).__init__(location=location, tags=tags, **kwargs) self.etag = etag self.sku = sku @@ -1714,9 +2592,9 @@ class CdnWebApplicationFirewallPolicyList(msrest.serialization.Model): :ivar value: List of Azure CDN WebApplicationFirewallPolicies within a resource group. :vartype value: list[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] - :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 = { @@ -1734,6 +2612,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(CdnWebApplicationFirewallPolicyList, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -1742,8 +2625,8 @@ def __init__( class CdnWebApplicationFirewallPolicyPatchParameters(msrest.serialization.Model): """Properties required to update a CdnWebApplicationFirewallPolicy. - :param tags: A set of tags. CdnWebApplicationFirewallPolicy tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. CdnWebApplicationFirewallPolicy tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1756,58 +2639,158 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. CdnWebApplicationFirewallPolicy tags. + :paramtype tags: dict[str, str] + """ super(CdnWebApplicationFirewallPolicyPatchParameters, self).__init__(**kwargs) self.tags = tags -class Certificate(msrest.serialization.Model): - """Certificate used for https. +class CheckEndpointNameAvailabilityInput(msrest.serialization.Model): + """Input of CheckNameAvailability API. + + All required parameters must be populated in order to send to Azure. - :param subject: Subject name in the certificate. - :type subject: str - :param expiration_date: Certificate expiration date. - :type expiration_date: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str + :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.Cdn/Profiles/Endpoints", "Microsoft.Cdn/Profiles/AfdEndpoints". + :vartype type: str or ~azure.mgmt.cdn.models.ResourceType + :ivar auto_generated_domain_name_label_scope: Indicates the endpoint name reuse scope. The + default value is TenantReuse. Possible values include: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", "NoReuse". + :vartype auto_generated_domain_name_label_scope: str or + ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope """ + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + _attribute_map = { - 'subject': {'key': 'subject', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'auto_generated_domain_name_label_scope': {'key': 'autoGeneratedDomainNameLabelScope', 'type': 'str'}, } def __init__( self, *, - subject: Optional[str] = None, - expiration_date: Optional[str] = None, - thumbprint: Optional[str] = None, + name: str, + type: Union[str, "ResourceType"], + auto_generated_domain_name_label_scope: Optional[Union[str, "AutoGeneratedDomainNameLabelScope"]] = None, + **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.Cdn/Profiles/Endpoints", "Microsoft.Cdn/Profiles/AfdEndpoints". + :paramtype type: str or ~azure.mgmt.cdn.models.ResourceType + :keyword auto_generated_domain_name_label_scope: Indicates the endpoint name reuse scope. The + default value is TenantReuse. Possible values include: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", "NoReuse". + :paramtype auto_generated_domain_name_label_scope: str or + ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope + """ + super(CheckEndpointNameAvailabilityInput, self).__init__(**kwargs) + self.name = name + self.type = type + self.auto_generated_domain_name_label_scope = auto_generated_domain_name_label_scope + + +class CheckEndpointNameAvailabilityOutput(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_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar available_hostname: Returns the available hostname generated based on the + AutoGeneratedDomainNameLabelScope when the name is available, otherwise it returns empty + string. + :vartype available_hostname: str + :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_available': {'readonly': True}, + 'available_hostname': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'available_hostname': {'key': 'availableHostname', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, **kwargs ): - super(Certificate, self).__init__(**kwargs) - self.subject = subject - self.expiration_date = expiration_date - self.thumbprint = thumbprint + """ + """ + super(CheckEndpointNameAvailabilityOutput, self).__init__(**kwargs) + self.name_available = None + self.available_hostname = None + self.reason = None + self.message = None + + +class CheckHostNameAvailabilityInput(msrest.serialization.Model): + """Input of CheckHostNameAvailability API. + + All required parameters must be populated in order to send to Azure. + + :ivar host_name: Required. The host name to validate. + :vartype host_name: str + """ + + _validation = { + 'host_name': {'required': True}, + } + + _attribute_map = { + 'host_name': {'key': 'hostName', 'type': 'str'}, + } + + def __init__( + self, + *, + host_name: str, + **kwargs + ): + """ + :keyword host_name: Required. The host name to validate. + :paramtype host_name: str + """ + super(CheckHostNameAvailabilityInput, self).__init__(**kwargs) + self.host_name = host_name class CheckNameAvailabilityInput(msrest.serialization.Model): """Input of CheckNameAvailability API. - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - :param name: Required. The resource name to validate. - :type name: str - :ivar type: Required. The type of the resource whose name is to be validated. Default value: - "Microsoft.Cdn/Profiles/Endpoints". - :vartype type: str + :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.Cdn/Profiles/Endpoints", "Microsoft.Cdn/Profiles/AfdEndpoints". + :vartype type: str or ~azure.mgmt.cdn.models.ResourceType """ _validation = { 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, + 'type': {'required': True}, } _attribute_map = { @@ -1815,16 +2798,23 @@ class CheckNameAvailabilityInput(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, } - type = "Microsoft.Cdn/Profiles/Endpoints" - def __init__( self, *, name: str, + 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.Cdn/Profiles/Endpoints", "Microsoft.Cdn/Profiles/AfdEndpoints". + :paramtype type: str or ~azure.mgmt.cdn.models.ResourceType + """ super(CheckNameAvailabilityInput, self).__init__(**kwargs) self.name = name + self.type = type class CheckNameAvailabilityOutput(msrest.serialization.Model): @@ -1856,6 +2846,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityOutput, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -1865,10 +2857,10 @@ def __init__( class CidrIpAddress(msrest.serialization.Model): """CIDR Ip address. - :param base_ip_address: Ip address itself. - :type base_ip_address: str - :param prefix_length: The length of the prefix of the ip address. - :type prefix_length: int + :ivar base_ip_address: Ip address itself. + :vartype base_ip_address: str + :ivar prefix_length: The length of the prefix of the ip address. + :vartype prefix_length: int """ _attribute_map = { @@ -1883,18 +2875,88 @@ def __init__( prefix_length: Optional[int] = None, **kwargs ): - super(CidrIpAddress, self).__init__(**kwargs) - self.base_ip_address = base_ip_address - self.prefix_length = prefix_length + """ + :keyword base_ip_address: Ip address itself. + :paramtype base_ip_address: str + :keyword prefix_length: The length of the prefix of the ip address. + :paramtype prefix_length: int + """ + super(CidrIpAddress, self).__init__(**kwargs) + self.base_ip_address = base_ip_address + self.prefix_length = prefix_length + + +class ClientPortMatchConditionParameters(msrest.serialization.Model): + """Defines the parameters for ClientPort match conditions. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type_name: Has constant value: "DeliveryRuleClientPortConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :vartype operator: str or ~azure.mgmt.cdn.models.ClientPortOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ + + _validation = { + 'type_name': {'required': True, 'constant': True}, + 'operator': {'required': True}, + } + + _attribute_map = { + 'type_name': {'key': 'typeName', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, + 'match_values': {'key': 'matchValues', 'type': '[str]'}, + 'transforms': {'key': 'transforms', 'type': '[str]'}, + } + + type_name = "DeliveryRuleClientPortConditionParameters" + + def __init__( + self, + *, + operator: Union[str, "ClientPortOperator"], + negate_condition: Optional[bool] = None, + match_values: Optional[List[str]] = None, + transforms: Optional[List[Union[str, "Transform"]]] = None, + **kwargs + ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.ClientPortOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ + super(ClientPortMatchConditionParameters, self).__init__(**kwargs) + self.operator = operator + self.negate_condition = negate_condition + self.match_values = match_values + self.transforms = transforms class Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(msrest.serialization.Model): """Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems. - :param date_time: - :type date_time: ~datetime.datetime - :param value: - :type value: float + :ivar date_time: + :vartype date_time: ~datetime.datetime + :ivar value: + :vartype value: float """ _attribute_map = { @@ -1909,6 +2971,12 @@ def __init__( value: Optional[float] = None, **kwargs ): + """ + :keyword date_time: + :paramtype date_time: ~datetime.datetime + :keyword value: + :paramtype value: float + """ super(Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems, self).__init__(**kwargs) self.date_time = date_time self.value = value @@ -1917,10 +2985,10 @@ def __init__( class Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(msrest.serialization.Model): """Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems. - :param date_time: - :type date_time: ~datetime.datetime - :param value: - :type value: float + :ivar date_time: + :vartype date_time: ~datetime.datetime + :ivar value: + :vartype value: float """ _attribute_map = { @@ -1935,6 +3003,12 @@ def __init__( value: Optional[float] = None, **kwargs ): + """ + :keyword date_time: + :paramtype date_time: ~datetime.datetime + :keyword value: + :paramtype value: float + """ super(Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems, self).__init__(**kwargs) self.date_time = date_time self.value = value @@ -1943,12 +3017,12 @@ def __init__( class ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(msrest.serialization.Model): """ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems. - :param metric: - :type metric: str - :param value: - :type value: long - :param percentage: - :type percentage: float + :ivar metric: + :vartype metric: str + :ivar value: + :vartype value: long + :ivar percentage: + :vartype percentage: float """ _attribute_map = { @@ -1965,6 +3039,14 @@ def __init__( percentage: Optional[float] = None, **kwargs ): + """ + :keyword metric: + :paramtype metric: str + :keyword value: + :paramtype value: long + :keyword percentage: + :paramtype percentage: float + """ super(ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems, self).__init__(**kwargs) self.metric = metric self.value = value @@ -1974,14 +3056,14 @@ def __init__( class CompressionSettings(msrest.serialization.Model): """settings for compression. - :param content_types_to_compress: List of content types on which compression applies. The value + :ivar content_types_to_compress: List of content types on which compression applies. The value should be a valid MIME type. - :type content_types_to_compress: list[str] - :param is_compression_enabled: Indicates whether content compression is enabled on + :vartype content_types_to_compress: list[str] + :ivar is_compression_enabled: Indicates whether content compression is enabled on AzureFrontDoor. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. - :type is_compression_enabled: bool + :vartype is_compression_enabled: bool """ _attribute_map = { @@ -1996,6 +3078,16 @@ def __init__( is_compression_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword content_types_to_compress: List of content types on which compression applies. The + value should be a valid MIME type. + :paramtype content_types_to_compress: list[str] + :keyword is_compression_enabled: Indicates whether content compression is enabled on + AzureFrontDoor. Default value is false. If compression is enabled, content will be served as + compressed if user requests for a compressed version. Content won't be compressed on + AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. + :paramtype is_compression_enabled: bool + """ super(CompressionSettings, self).__init__(**kwargs) self.content_types_to_compress = content_types_to_compress self.is_compression_enabled = is_compression_enabled @@ -2004,10 +3096,11 @@ def __init__( class ContinentsResponse(msrest.serialization.Model): """Continents Response. - :param continents: - :type continents: list[~azure.mgmt.cdn.models.ContinentsResponseContinentsItem] - :param country_or_regions: - :type country_or_regions: list[~azure.mgmt.cdn.models.ContinentsResponseCountryOrRegionsItem] + :ivar continents: + :vartype continents: list[~azure.mgmt.cdn.models.ContinentsResponseContinentsItem] + :ivar country_or_regions: + :vartype country_or_regions: + list[~azure.mgmt.cdn.models.ContinentsResponseCountryOrRegionsItem] """ _attribute_map = { @@ -2022,6 +3115,13 @@ def __init__( country_or_regions: Optional[List["ContinentsResponseCountryOrRegionsItem"]] = None, **kwargs ): + """ + :keyword continents: + :paramtype continents: list[~azure.mgmt.cdn.models.ContinentsResponseContinentsItem] + :keyword country_or_regions: + :paramtype country_or_regions: + list[~azure.mgmt.cdn.models.ContinentsResponseCountryOrRegionsItem] + """ super(ContinentsResponse, self).__init__(**kwargs) self.continents = continents self.country_or_regions = country_or_regions @@ -2030,8 +3130,8 @@ def __init__( class ContinentsResponseContinentsItem(msrest.serialization.Model): """ContinentsResponseContinentsItem. - :param id: - :type id: str + :ivar id: + :vartype id: str """ _attribute_map = { @@ -2044,6 +3144,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: + :paramtype id: str + """ super(ContinentsResponseContinentsItem, self).__init__(**kwargs) self.id = id @@ -2051,10 +3155,10 @@ def __init__( class ContinentsResponseCountryOrRegionsItem(msrest.serialization.Model): """ContinentsResponseCountryOrRegionsItem. - :param id: - :type id: str - :param continent_id: - :type continent_id: str + :ivar id: + :vartype id: str + :ivar continent_id: + :vartype continent_id: str """ _attribute_map = { @@ -2069,6 +3173,12 @@ def __init__( continent_id: Optional[str] = None, **kwargs ): + """ + :keyword id: + :paramtype id: str + :keyword continent_id: + :paramtype continent_id: str + """ super(ContinentsResponseCountryOrRegionsItem, self).__init__(**kwargs) self.id = id self.continent_id = continent_id @@ -2081,30 +3191,29 @@ class CookiesMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleCookiesConditionParameters". - :vartype odata_type: str - :param selector: Name of Cookies to be matched. - :type selector: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :ivar type_name: Has constant value: "DeliveryRuleCookiesConditionParameters". + :vartype type_name: str + :ivar selector: Name of Cookies to be matched. + :vartype selector: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.CookiesOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :vartype operator: str or ~azure.mgmt.cdn.models.CookiesOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'selector': {'key': 'selector', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, @@ -2112,7 +3221,7 @@ class CookiesMatchConditionParameters(msrest.serialization.Model): 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleCookiesConditionParameters" + type_name = "DeliveryRuleCookiesConditionParameters" def __init__( self, @@ -2124,6 +3233,20 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword selector: Name of Cookies to be matched. + :paramtype selector: str + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.CookiesOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(CookiesMatchConditionParameters, self).__init__(**kwargs) self.selector = selector self.operator = operator @@ -2132,7 +3255,7 @@ def __init__( self.transforms = transforms -class CustomDomain(Resource): +class CustomDomain(ProxyResource): """Friendly domain name mapping to the endpoint hostname that the customer provides for branding purposes, e.g. www.contoso.com. Variables are only populated by the server, and will be ignored when sending a request. @@ -2145,8 +3268,8 @@ class CustomDomain(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param host_name: The host name of the custom domain. Must be a domain name. - :type host_name: str + :ivar host_name: The host name of the custom domain. Must be a domain name. + :vartype host_name: str :ivar resource_state: Resource status of the custom domain. Possible values include: "Creating", "Active", "Deleting". :vartype resource_state: str or ~azure.mgmt.cdn.models.CustomDomainResourceState @@ -2162,10 +3285,12 @@ class CustomDomain(Resource): "CertificateDeployed", "DeletingCertificate", "CertificateDeleted". :vartype custom_https_provisioning_substate: str or ~azure.mgmt.cdn.models.CustomHttpsProvisioningSubstate - :param validation_data: Special validation or data may be required when delivering CDN to some + :ivar custom_https_parameters: Certificate parameters for securing custom HTTPS. + :vartype custom_https_parameters: ~azure.mgmt.cdn.models.CustomDomainHttpsParameters + :ivar validation_data: Special validation or data may be required when delivering CDN to some regions due to local compliance reasons. E.g. ICP license number of a custom domain is required to deliver content in China. - :type validation_data: str + :vartype validation_data: str :ivar provisioning_state: Provisioning status of the custom domain. :vartype provisioning_state: str """ @@ -2190,6 +3315,7 @@ class CustomDomain(Resource): '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_parameters': {'key': 'properties.customHttpsParameters', 'type': 'CustomDomainHttpsParameters'}, 'validation_data': {'key': 'properties.validationData', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -2198,14 +3324,26 @@ def __init__( self, *, host_name: Optional[str] = None, + custom_https_parameters: Optional["CustomDomainHttpsParameters"] = None, validation_data: Optional[str] = None, **kwargs ): + """ + :keyword host_name: The host name of the custom domain. Must be a domain name. + :paramtype host_name: str + :keyword custom_https_parameters: Certificate parameters for securing custom HTTPS. + :paramtype custom_https_parameters: ~azure.mgmt.cdn.models.CustomDomainHttpsParameters + :keyword validation_data: Special validation or data may be required when delivering CDN to + some regions due to local compliance reasons. E.g. ICP license number of a custom domain is + required to deliver content in China. + :paramtype validation_data: str + """ super(CustomDomain, self).__init__(**kwargs) self.host_name = host_name self.resource_state = None self.custom_https_provisioning_state = None self.custom_https_provisioning_substate = None + self.custom_https_parameters = custom_https_parameters self.validation_data = validation_data self.provisioning_state = None @@ -2217,8 +3355,8 @@ class CustomDomainListResult(msrest.serialization.Model): :ivar value: List of CDN CustomDomains within an endpoint. :vartype value: list[~azure.mgmt.cdn.models.CustomDomain] - :param next_link: URL to get the next set of custom domain objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of custom domain objects if there are any. + :vartype next_link: str """ _validation = { @@ -2236,6 +3374,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of custom domain objects if there are any. + :paramtype next_link: str + """ super(CustomDomainListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -2244,8 +3386,8 @@ def __init__( class CustomDomainParameters(msrest.serialization.Model): """The customDomain JSON object required for custom domain creation or update. - :param host_name: The host name of the custom domain. Must be a domain name. - :type host_name: str + :ivar host_name: The host name of the custom domain. Must be a domain name. + :vartype host_name: str """ _attribute_map = { @@ -2258,6 +3400,10 @@ def __init__( host_name: Optional[str] = None, **kwargs ): + """ + :keyword host_name: The host name of the custom domain. Must be a domain name. + :paramtype host_name: str + """ super(CustomDomainParameters, self).__init__(**kwargs) self.host_name = host_name @@ -2265,127 +3411,134 @@ def __init__( class CustomerCertificate(Certificate): """Customer Certificate used for https. - All required parameters must be populated in order to send to Azure. - - :param subject: Subject name in the certificate. - :type subject: str - :param expiration_date: Certificate expiration date. - :type expiration_date: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param version: Certificate version. - :type version: str - :param certificate_authority: Certificate issuing authority. - :type certificate_authority: str - :param certificate_url: Required. Complete Url to the certificate. - :type certificate_url: str - :param use_latest_version: Whether to use the latest version for the certificate. - :type use_latest_version: bool - :param subject_alternative_names: The list of SANs. - :type subject_alternative_names: list[str] - """ + Variables are only populated by the server, and will be ignored when sending a request. - _validation = { - 'certificate_url': {'required': True}, + :ivar type: The type of the secret resource. Possible values include: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :vartype type: str or ~azure.mgmt.cdn.models.SecretType + :ivar subject: Subject name in the certificate. + :vartype subject: str + :ivar expiration_date: Certificate expiration date. + :vartype expiration_date: str + :ivar secret_source: Resource reference to the Azure Key Vault certificate. Expected to be in + format of + /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + :vartype secret_source: ~azure.mgmt.cdn.models.ResourceReference + :ivar secret_version: Certificate version. + :vartype secret_version: str + :ivar certificate_authority: Certificate issuing authority. + :vartype certificate_authority: str + :ivar use_latest_version: Whether to use the latest version for the certificate. + :vartype use_latest_version: bool + :ivar subject_alternative_names: The list of SANs. + :vartype subject_alternative_names: list[str] + :ivar thumbprint: Certificate thumbprint. + :vartype thumbprint: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'certificate_authority': {'readonly': True}, + 'thumbprint': {'readonly': True}, } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'subject': {'key': 'subject', 'type': 'str'}, 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, + 'secret_source': {'key': 'secretSource', 'type': 'ResourceReference'}, + 'secret_version': {'key': 'secretVersion', 'type': 'str'}, 'certificate_authority': {'key': 'certificateAuthority', 'type': 'str'}, - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, 'use_latest_version': {'key': 'useLatestVersion', 'type': 'bool'}, 'subject_alternative_names': {'key': 'subjectAlternativeNames', 'type': '[str]'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, } def __init__( self, *, - certificate_url: str, - subject: Optional[str] = None, - expiration_date: Optional[str] = None, - thumbprint: Optional[str] = None, - version: Optional[str] = None, - certificate_authority: Optional[str] = None, + type: Optional[Union[str, "SecretType"]] = None, + secret_source: Optional["ResourceReference"] = None, + secret_version: Optional[str] = None, use_latest_version: Optional[bool] = None, subject_alternative_names: Optional[List[str]] = None, **kwargs ): - super(CustomerCertificate, self).__init__(subject=subject, expiration_date=expiration_date, thumbprint=thumbprint, **kwargs) - self.version = version - self.certificate_authority = certificate_authority - self.certificate_url = certificate_url + """ + :keyword type: The type of the secret resource. Possible values include: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :paramtype type: str or ~azure.mgmt.cdn.models.SecretType + :keyword secret_source: Resource reference to the Azure Key Vault certificate. Expected to be + in format of + /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + :paramtype secret_source: ~azure.mgmt.cdn.models.ResourceReference + :keyword secret_version: Certificate version. + :paramtype secret_version: str + :keyword use_latest_version: Whether to use the latest version for the certificate. + :paramtype use_latest_version: bool + :keyword subject_alternative_names: The list of SANs. + :paramtype subject_alternative_names: list[str] + """ + super(CustomerCertificate, self).__init__(type=type, **kwargs) + self.secret_source = secret_source + self.secret_version = secret_version + self.certificate_authority = None self.use_latest_version = use_latest_version self.subject_alternative_names = subject_alternative_names - - -class SecretParameters(msrest.serialization.Model): - """The json object containing secret parameters. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CustomerCertificateParameters, ManagedCertificateParameters, UrlSigningKeyParameters. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of the Secret to create.Constant filled by server. Possible - values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate". - :type type: str or ~azure.mgmt.cdn.models.SecretType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'CustomerCertificate': 'CustomerCertificateParameters', 'ManagedCertificate': 'ManagedCertificateParameters', 'UrlSigningKey': 'UrlSigningKeyParameters'} - } - - def __init__( - self, - **kwargs - ): - super(SecretParameters, self).__init__(**kwargs) - self.type = None # type: Optional[str] + self.thumbprint = None class CustomerCertificateParameters(SecretParameters): """Customer Certificate used for https. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the Secret to create.Constant filled by server. Possible - values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate". - :type type: str or ~azure.mgmt.cdn.models.SecretType - :param secret_source: Required. Resource reference to the KV secret. - :type secret_source: ~azure.mgmt.cdn.models.ResourceReference - :param secret_version: Version of the secret to be used. - :type secret_version: str - :param certificate_authority: Certificate issuing authority. - :type certificate_authority: str - :param use_latest_version: Whether to use the latest version for the certificate. - :type use_latest_version: bool - :param subject_alternative_names: The list of SANs. - :type subject_alternative_names: list[str] + :ivar type: Required. The type of the secret resource.Constant filled by server. Possible + values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate", + "AzureFirstPartyManagedCertificate". + :vartype type: str or ~azure.mgmt.cdn.models.SecretType + :ivar secret_source: Required. Resource reference to the Azure Key Vault certificate. Expected + to be in format of + /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + :vartype secret_source: ~azure.mgmt.cdn.models.ResourceReference + :ivar secret_version: Version of the secret to be used. + :vartype secret_version: str + :ivar use_latest_version: Whether to use the latest version for the certificate. + :vartype use_latest_version: bool + :ivar subject: Subject name in the certificate. + :vartype subject: str + :ivar expiration_date: Certificate expiration date. + :vartype expiration_date: str + :ivar certificate_authority: Certificate issuing authority. + :vartype certificate_authority: str + :ivar subject_alternative_names: The list of SANs. + :vartype subject_alternative_names: list[str] + :ivar thumbprint: Certificate thumbprint. + :vartype thumbprint: str """ _validation = { 'type': {'required': True}, 'secret_source': {'required': True}, + 'subject': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'certificate_authority': {'readonly': True}, + 'thumbprint': {'readonly': True}, } _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'secret_source': {'key': 'secretSource', 'type': 'ResourceReference'}, 'secret_version': {'key': 'secretVersion', 'type': 'str'}, - 'certificate_authority': {'key': 'certificateAuthority', 'type': 'str'}, 'use_latest_version': {'key': 'useLatestVersion', 'type': 'bool'}, + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'certificate_authority': {'key': 'certificateAuthority', 'type': 'str'}, 'subject_alternative_names': {'key': 'subjectAlternativeNames', 'type': '[str]'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, } def __init__( @@ -2393,18 +3546,32 @@ def __init__( *, secret_source: "ResourceReference", secret_version: Optional[str] = None, - certificate_authority: Optional[str] = None, use_latest_version: Optional[bool] = None, subject_alternative_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword secret_source: Required. Resource reference to the Azure Key Vault certificate. + Expected to be in format of + /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + :paramtype secret_source: ~azure.mgmt.cdn.models.ResourceReference + :keyword secret_version: Version of the secret to be used. + :paramtype secret_version: str + :keyword use_latest_version: Whether to use the latest version for the certificate. + :paramtype use_latest_version: bool + :keyword subject_alternative_names: The list of SANs. + :paramtype subject_alternative_names: list[str] + """ super(CustomerCertificateParameters, self).__init__(**kwargs) self.type = 'CustomerCertificate' # type: str self.secret_source = secret_source self.secret_version = secret_version - self.certificate_authority = certificate_authority self.use_latest_version = use_latest_version + self.subject = None + self.expiration_date = None + self.certificate_authority = None self.subject_alternative_names = subject_alternative_names + self.thumbprint = None class CustomRule(msrest.serialization.Model): @@ -2412,19 +3579,19 @@ class CustomRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Defines the name of the custom rule. - :type name: str - :param enabled_state: Describes if the custom rule is in enabled or disabled state. Defaults to + :ivar name: Required. Defines the name of the custom rule. + :vartype name: str + :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.cdn.models.CustomRuleEnabledState - :param priority: Required. Defines in what order this rule be evaluated in the overall list of + :vartype enabled_state: str or ~azure.mgmt.cdn.models.CustomRuleEnabledState + :ivar priority: Required. Defines in what order this rule be evaluated in the overall list of custom rules. - :type priority: int - :param match_conditions: Required. List of match conditions. - :type match_conditions: list[~azure.mgmt.cdn.models.MatchCondition] - :param action: Required. Describes what action to be applied when rule matches. Possible values + :vartype priority: int + :ivar match_conditions: Required. List of match conditions. + :vartype match_conditions: list[~azure.mgmt.cdn.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.cdn.models.ActionType + :vartype action: str or ~azure.mgmt.cdn.models.ActionType """ _validation = { @@ -2452,6 +3619,21 @@ def __init__( enabled_state: Optional[Union[str, "CustomRuleEnabledState"]] = None, **kwargs ): + """ + :keyword name: Required. Defines the name of the custom rule. + :paramtype name: str + :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.cdn.models.CustomRuleEnabledState + :keyword priority: Required. Defines in what order this rule be evaluated in the overall list + of custom rules. + :paramtype priority: int + :keyword match_conditions: Required. List of match conditions. + :paramtype match_conditions: list[~azure.mgmt.cdn.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.cdn.models.ActionType + """ super(CustomRule, self).__init__(**kwargs) self.name = name self.enabled_state = enabled_state @@ -2463,8 +3645,8 @@ def __init__( class CustomRuleList(msrest.serialization.Model): """Defines contents of custom rules. - :param rules: List of rules. - :type rules: list[~azure.mgmt.cdn.models.CustomRule] + :ivar rules: List of rules. + :vartype rules: list[~azure.mgmt.cdn.models.CustomRule] """ _attribute_map = { @@ -2477,6 +3659,10 @@ def __init__( rules: Optional[List["CustomRule"]] = None, **kwargs ): + """ + :keyword rules: List of rules. + :paramtype rules: list[~azure.mgmt.cdn.models.CustomRule] + """ super(CustomRuleList, self).__init__(**kwargs) self.rules = rules @@ -2484,44 +3670,49 @@ def __init__( class DeepCreatedOrigin(msrest.serialization.Model): """The main origin of CDN content which is added when creating a CDN endpoint. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :param name: Required. Origin name which must be unique within the endpoint. - :type name: str - :param host_name: The address of the origin. It can be a domain name, IPv4 address, or IPv6 + :ivar name: Required. Origin name which must be unique within the endpoint. + :vartype name: str + :ivar host_name: The address of the origin. It can be a domain name, IPv4 address, or IPv6 address. This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you + :vartype host_name: str + :ivar http_port: The value of the HTTP port. Must be between 1 and 65535. + :vartype http_port: int + :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. + :vartype https_port: int + :ivar origin_host_header: The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities + :vartype origin_host_header: str + :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 + :vartype priority: int + :ivar weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. - :type weight: int - :param enabled: Origin is enabled for load balancing or not. By default, origin is always + :vartype weight: int + :ivar enabled: Origin is enabled for load balancing or not. By default, origin is always enabled. - :type enabled: bool - :param private_link_alias: The Alias of the Private Link resource. Populating this optional + :vartype enabled: bool + :ivar private_link_alias: The Alias of the Private Link resource. Populating this optional field indicates that this origin 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 - :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 + :vartype private_link_location: str + :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 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.cdn.models.PrivateEndpointStatus """ _validation = { @@ -2530,6 +3721,7 @@ class DeepCreatedOrigin(msrest.serialization.Model): 'https_port': {'maximum': 65535, 'minimum': 1}, 'priority': {'maximum': 5, 'minimum': 1}, 'weight': {'maximum': 1000, 'minimum': 1}, + 'private_endpoint_status': {'readonly': True}, } _attribute_map = { @@ -2545,6 +3737,7 @@ class DeepCreatedOrigin(msrest.serialization.Model): 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, 'private_link_location': {'key': 'properties.privateLinkLocation', 'type': 'str'}, 'private_link_approval_message': {'key': 'properties.privateLinkApprovalMessage', 'type': 'str'}, + 'private_endpoint_status': {'key': 'properties.privateEndpointStatus', 'type': 'str'}, } def __init__( @@ -2564,6 +3757,44 @@ def __init__( private_link_approval_message: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. Origin name which must be unique within the endpoint. + :paramtype name: str + :keyword host_name: The address of the origin. It can be a domain name, IPv4 address, or IPv6 + address. This should be unique across all origins in an endpoint. + :paramtype host_name: str + :keyword http_port: The value of the HTTP port. Must be between 1 and 65535. + :paramtype http_port: int + :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. + :paramtype https_port: int + :keyword origin_host_header: The host header value sent to the origin with each request. If you + leave this blank, the request hostname determines this value. Azure CDN origins, such as Web + Apps, Blob Storage, and Cloud Services require this host header value to match the origin + hostname by default. + :paramtype origin_host_header: str + :keyword priority: Priority of origin in given origin group for load balancing. Higher + priorities will not be used for load balancing if any lower priority origin is healthy.Must be + between 1 and 5. + :paramtype priority: int + :keyword weight: Weight of the origin in given origin group for load balancing. Must be between + 1 and 1000. + :paramtype weight: int + :keyword enabled: Origin is enabled for load balancing or not. By default, origin is always + enabled. + :paramtype enabled: bool + :keyword private_link_alias: The Alias of the Private Link resource. Populating this optional + field indicates that this origin 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 + """ super(DeepCreatedOrigin, self).__init__(**kwargs) self.name = name self.host_name = host_name @@ -2577,6 +3808,7 @@ def __init__( self.private_link_resource_id = private_link_resource_id self.private_link_location = private_link_location self.private_link_approval_message = private_link_approval_message + self.private_endpoint_status = None class DeepCreatedOriginGroup(msrest.serialization.Model): @@ -2584,21 +3816,21 @@ class DeepCreatedOriginGroup(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Origin group name which must be unique within the endpoint. - :type name: str - :param health_probe_settings: Health probe settings to the origin that is used to determine the + :ivar name: Required. Origin group name which must be unique within the endpoint. + :vartype name: str + :ivar health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param origins: The source of the content being delivered via CDN within given origin group. - :type origins: list[~azure.mgmt.cdn.models.ResourceReference] - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift + :vartype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :ivar origins: The source of the content being delivered via CDN within given origin group. + :vartype origins: list[~azure.mgmt.cdn.models.ResourceReference] + :ivar traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_origin_error_detection_settings: The JSON object that contains the + :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :ivar response_based_origin_error_detection_settings: The JSON object that contains the properties to determine origin health using real requests/responses.This property is currently not supported. - :type response_based_origin_error_detection_settings: + :vartype response_based_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters """ @@ -2625,6 +3857,24 @@ def __init__( response_based_origin_error_detection_settings: Optional["ResponseBasedOriginErrorDetectionParameters"] = None, **kwargs ): + """ + :keyword name: Required. Origin group name which must be unique within the endpoint. + :paramtype name: str + :keyword health_probe_settings: Health probe settings to the origin that is used to determine + the health of the origin. + :paramtype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :keyword origins: The source of the content being delivered via CDN within given origin group. + :paramtype origins: list[~azure.mgmt.cdn.models.ResourceReference] + :keyword traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to + shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new + endpoint is added. Default is 10 mins. This property is currently not supported. + :paramtype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :keyword response_based_origin_error_detection_settings: The JSON object that contains the + properties to determine origin health using real requests/responses.This property is currently + not supported. + :paramtype response_based_origin_error_detection_settings: + ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters + """ super(DeepCreatedOriginGroup, self).__init__(**kwargs) self.name = name self.health_probe_settings = health_probe_settings @@ -2638,18 +3888,18 @@ class DeliveryRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Name of the rule. - :type name: str - :param order: Required. The order in which the rules are applied for the endpoint. Possible + :ivar name: Name of the rule. + :vartype name: str + :ivar order: Required. The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. - :type order: int - :param conditions: A list of conditions that must be matched for the actions to be executed. - :type conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] - :param actions: Required. A list of actions that are executed when all the conditions of a rule + :vartype order: int + :ivar conditions: A list of conditions that must be matched for the actions to be executed. + :vartype conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] + :ivar actions: Required. A list of actions that are executed when all the conditions of a rule are satisfied. - :type actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] + :vartype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] """ _validation = { @@ -2673,6 +3923,20 @@ def __init__( conditions: Optional[List["DeliveryRuleCondition"]] = None, **kwargs ): + """ + :keyword name: Name of the rule. + :paramtype name: str + :keyword order: Required. The order in which the rules are applied for the endpoint. Possible + values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater + order. Rule with order 0 is a special rule. It does not require any condition and actions + listed in it will always be applied. + :paramtype order: int + :keyword conditions: A list of conditions that must be matched for the actions to be executed. + :paramtype conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] + :keyword actions: Required. A list of actions that are executed when all the conditions of a + rule are satisfied. + :paramtype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] + """ super(DeliveryRule, self).__init__(**kwargs) self.name = name self.order = order @@ -2684,14 +3948,15 @@ class DeliveryRuleAction(msrest.serialization.Model): """An action for the delivery rule. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DeliveryRuleCacheExpirationAction, DeliveryRuleCacheKeyQueryStringAction, DeliveryRuleRequestHeaderAction, DeliveryRuleResponseHeaderAction, OriginGroupOverrideAction, UrlRedirectAction, UrlRewriteAction, UrlSigningAction. + sub-classes are: DeliveryRuleCacheExpirationAction, DeliveryRuleCacheKeyQueryStringAction, DeliveryRuleRequestHeaderAction, DeliveryRuleResponseHeaderAction, OriginGroupOverrideAction, DeliveryRuleRouteConfigurationOverrideAction, UrlRedirectAction, UrlRewriteAction, UrlSigningAction. All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the action for the delivery rule.Constant filled by server. + :ivar name: Required. The name of the action for the delivery rule.Constant filled by server. Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum + "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", + "RouteConfigurationOverride". + :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum """ _validation = { @@ -2703,13 +3968,15 @@ class DeliveryRuleAction(msrest.serialization.Model): } _subtype_map = { - 'name': {'CacheExpiration': 'DeliveryRuleCacheExpirationAction', 'CacheKeyQueryString': 'DeliveryRuleCacheKeyQueryStringAction', 'ModifyRequestHeader': 'DeliveryRuleRequestHeaderAction', 'ModifyResponseHeader': 'DeliveryRuleResponseHeaderAction', 'OriginGroupOverride': 'OriginGroupOverrideAction', 'UrlRedirect': 'UrlRedirectAction', 'UrlRewrite': 'UrlRewriteAction', 'UrlSigning': 'UrlSigningAction'} + 'name': {'CacheExpiration': 'DeliveryRuleCacheExpirationAction', 'CacheKeyQueryString': 'DeliveryRuleCacheKeyQueryStringAction', 'ModifyRequestHeader': 'DeliveryRuleRequestHeaderAction', 'ModifyResponseHeader': 'DeliveryRuleResponseHeaderAction', 'OriginGroupOverride': 'OriginGroupOverrideAction', 'RouteConfigurationOverride': 'DeliveryRuleRouteConfigurationOverrideAction', 'UrlRedirect': 'UrlRedirectAction', 'UrlRewrite': 'UrlRewriteAction', 'UrlSigning': 'UrlSigningAction'} } def __init__( self, **kwargs ): + """ + """ super(DeliveryRuleAction, self).__init__(**kwargs) self.name = None # type: Optional[str] @@ -2719,12 +3986,13 @@ class DeliveryRuleCacheExpirationAction(DeliveryRuleAction): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the action for the delivery rule.Constant filled by server. + :ivar name: Required. The name of the action for the delivery rule.Constant filled by server. Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.CacheExpirationActionParameters + "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", + "RouteConfigurationOverride". + :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum + :ivar parameters: Required. Defines the parameters for the action. + :vartype parameters: ~azure.mgmt.cdn.models.CacheExpirationActionParameters """ _validation = { @@ -2743,6 +4011,10 @@ def __init__( parameters: "CacheExpirationActionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the action. + :paramtype parameters: ~azure.mgmt.cdn.models.CacheExpirationActionParameters + """ super(DeliveryRuleCacheExpirationAction, self).__init__(**kwargs) self.name = 'CacheExpiration' # type: str self.parameters = parameters @@ -2753,12 +4025,13 @@ class DeliveryRuleCacheKeyQueryStringAction(DeliveryRuleAction): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the action for the delivery rule.Constant filled by server. + :ivar name: Required. The name of the action for the delivery rule.Constant filled by server. Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.CacheKeyQueryStringActionParameters + "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", + "RouteConfigurationOverride". + :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum + :ivar parameters: Required. Defines the parameters for the action. + :vartype parameters: ~azure.mgmt.cdn.models.CacheKeyQueryStringActionParameters """ _validation = { @@ -2777,6 +4050,10 @@ def __init__( parameters: "CacheKeyQueryStringActionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the action. + :paramtype parameters: ~azure.mgmt.cdn.models.CacheKeyQueryStringActionParameters + """ super(DeliveryRuleCacheKeyQueryStringAction, self).__init__(**kwargs) self.name = 'CacheKeyQueryString' # type: str self.parameters = parameters @@ -2786,15 +4063,16 @@ class DeliveryRuleCondition(msrest.serialization.Model): """A condition for the delivery rule. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DeliveryRuleCookiesCondition, DeliveryRuleHttpVersionCondition, DeliveryRuleIsDeviceCondition, DeliveryRulePostArgsCondition, DeliveryRuleQueryStringCondition, DeliveryRuleRemoteAddressCondition, DeliveryRuleRequestBodyCondition, DeliveryRuleRequestHeaderCondition, DeliveryRuleRequestMethodCondition, DeliveryRuleRequestSchemeCondition, DeliveryRuleRequestUriCondition, DeliveryRuleUrlFileExtensionCondition, DeliveryRuleUrlFileNameCondition, DeliveryRuleUrlPathCondition. + sub-classes are: DeliveryRuleClientPortCondition, DeliveryRuleCookiesCondition, DeliveryRuleHostNameCondition, DeliveryRuleHttpVersionCondition, DeliveryRuleIsDeviceCondition, DeliveryRulePostArgsCondition, DeliveryRuleQueryStringCondition, DeliveryRuleRemoteAddressCondition, DeliveryRuleRequestBodyCondition, DeliveryRuleRequestHeaderCondition, DeliveryRuleRequestMethodCondition, DeliveryRuleRequestSchemeCondition, DeliveryRuleRequestUriCondition, DeliveryRuleServerPortCondition, DeliveryRuleSocketAddrCondition, DeliveryRuleSslProtocolCondition, DeliveryRuleUrlFileExtensionCondition, DeliveryRuleUrlFileNameCondition, DeliveryRuleUrlPathCondition. All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable """ _validation = { @@ -2806,29 +4084,72 @@ class DeliveryRuleCondition(msrest.serialization.Model): } _subtype_map = { - 'name': {'Cookies': 'DeliveryRuleCookiesCondition', 'HttpVersion': 'DeliveryRuleHttpVersionCondition', 'IsDevice': 'DeliveryRuleIsDeviceCondition', 'PostArgs': 'DeliveryRulePostArgsCondition', 'QueryString': 'DeliveryRuleQueryStringCondition', 'RemoteAddress': 'DeliveryRuleRemoteAddressCondition', 'RequestBody': 'DeliveryRuleRequestBodyCondition', 'RequestHeader': 'DeliveryRuleRequestHeaderCondition', 'RequestMethod': 'DeliveryRuleRequestMethodCondition', 'RequestScheme': 'DeliveryRuleRequestSchemeCondition', 'RequestUri': 'DeliveryRuleRequestUriCondition', 'UrlFileExtension': 'DeliveryRuleUrlFileExtensionCondition', 'UrlFileName': 'DeliveryRuleUrlFileNameCondition', 'UrlPath': 'DeliveryRuleUrlPathCondition'} + 'name': {'ClientPort': 'DeliveryRuleClientPortCondition', 'Cookies': 'DeliveryRuleCookiesCondition', 'HostName': 'DeliveryRuleHostNameCondition', 'HttpVersion': 'DeliveryRuleHttpVersionCondition', 'IsDevice': 'DeliveryRuleIsDeviceCondition', 'PostArgs': 'DeliveryRulePostArgsCondition', 'QueryString': 'DeliveryRuleQueryStringCondition', 'RemoteAddress': 'DeliveryRuleRemoteAddressCondition', 'RequestBody': 'DeliveryRuleRequestBodyCondition', 'RequestHeader': 'DeliveryRuleRequestHeaderCondition', 'RequestMethod': 'DeliveryRuleRequestMethodCondition', 'RequestScheme': 'DeliveryRuleRequestSchemeCondition', 'RequestUri': 'DeliveryRuleRequestUriCondition', 'ServerPort': 'DeliveryRuleServerPortCondition', 'SocketAddr': 'DeliveryRuleSocketAddrCondition', 'SslProtocol': 'DeliveryRuleSslProtocolCondition', 'UrlFileExtension': 'DeliveryRuleUrlFileExtensionCondition', 'UrlFileName': 'DeliveryRuleUrlFileNameCondition', 'UrlPath': 'DeliveryRuleUrlPathCondition'} } def __init__( self, **kwargs ): + """ + """ super(DeliveryRuleCondition, self).__init__(**kwargs) self.name = None # type: Optional[str] +class DeliveryRuleClientPortCondition(DeliveryRuleCondition): + """Defines the ClientPort condition for the delivery rule. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.ClientPortMatchConditionParameters + """ + + _validation = { + 'name': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'ClientPortMatchConditionParameters'}, + } + + def __init__( + self, + *, + parameters: "ClientPortMatchConditionParameters", + **kwargs + ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.ClientPortMatchConditionParameters + """ + super(DeliveryRuleClientPortCondition, self).__init__(**kwargs) + self.name = 'ClientPort' # type: str + self.parameters = parameters + + class DeliveryRuleCookiesCondition(DeliveryRuleCondition): """Defines the Cookies condition for the delivery rule. All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.CookiesMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.CookiesMatchConditionParameters """ _validation = { @@ -2847,23 +4168,68 @@ def __init__( parameters: "CookiesMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.CookiesMatchConditionParameters + """ super(DeliveryRuleCookiesCondition, self).__init__(**kwargs) self.name = 'Cookies' # type: str self.parameters = parameters +class DeliveryRuleHostNameCondition(DeliveryRuleCondition): + """Defines the HostName condition for the delivery rule. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.HostNameMatchConditionParameters + """ + + _validation = { + 'name': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'HostNameMatchConditionParameters'}, + } + + def __init__( + self, + *, + parameters: "HostNameMatchConditionParameters", + **kwargs + ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.HostNameMatchConditionParameters + """ + super(DeliveryRuleHostNameCondition, self).__init__(**kwargs) + self.name = 'HostName' # type: str + self.parameters = parameters + + class DeliveryRuleHttpVersionCondition(DeliveryRuleCondition): """Defines the HttpVersion condition for the delivery rule. All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.HttpVersionMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.HttpVersionMatchConditionParameters """ _validation = { @@ -2882,6 +4248,10 @@ def __init__( parameters: "HttpVersionMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.HttpVersionMatchConditionParameters + """ super(DeliveryRuleHttpVersionCondition, self).__init__(**kwargs) self.name = 'HttpVersion' # type: str self.parameters = parameters @@ -2892,13 +4262,14 @@ class DeliveryRuleIsDeviceCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.IsDeviceMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.IsDeviceMatchConditionParameters """ _validation = { @@ -2917,6 +4288,10 @@ def __init__( parameters: "IsDeviceMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.IsDeviceMatchConditionParameters + """ super(DeliveryRuleIsDeviceCondition, self).__init__(**kwargs) self.name = 'IsDevice' # type: str self.parameters = parameters @@ -2927,13 +4302,14 @@ class DeliveryRulePostArgsCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.PostArgsMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.PostArgsMatchConditionParameters """ _validation = { @@ -2952,6 +4328,10 @@ def __init__( parameters: "PostArgsMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.PostArgsMatchConditionParameters + """ super(DeliveryRulePostArgsCondition, self).__init__(**kwargs) self.name = 'PostArgs' # type: str self.parameters = parameters @@ -2962,13 +4342,14 @@ class DeliveryRuleQueryStringCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.QueryStringMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.QueryStringMatchConditionParameters """ _validation = { @@ -2987,6 +4368,10 @@ def __init__( parameters: "QueryStringMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.QueryStringMatchConditionParameters + """ super(DeliveryRuleQueryStringCondition, self).__init__(**kwargs) self.name = 'QueryString' # type: str self.parameters = parameters @@ -2997,13 +4382,14 @@ class DeliveryRuleRemoteAddressCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RemoteAddressMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.RemoteAddressMatchConditionParameters """ _validation = { @@ -3022,6 +4408,10 @@ def __init__( parameters: "RemoteAddressMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.RemoteAddressMatchConditionParameters + """ super(DeliveryRuleRemoteAddressCondition, self).__init__(**kwargs) self.name = 'RemoteAddress' # type: str self.parameters = parameters @@ -3032,13 +4422,14 @@ class DeliveryRuleRequestBodyCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RequestBodyMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.RequestBodyMatchConditionParameters """ _validation = { @@ -3057,6 +4448,10 @@ def __init__( parameters: "RequestBodyMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.RequestBodyMatchConditionParameters + """ super(DeliveryRuleRequestBodyCondition, self).__init__(**kwargs) self.name = 'RequestBody' # type: str self.parameters = parameters @@ -3067,12 +4462,13 @@ class DeliveryRuleRequestHeaderAction(DeliveryRuleAction): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the action for the delivery rule.Constant filled by server. + :ivar name: Required. The name of the action for the delivery rule.Constant filled by server. Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.HeaderActionParameters + "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", + "RouteConfigurationOverride". + :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum + :ivar parameters: Required. Defines the parameters for the action. + :vartype parameters: ~azure.mgmt.cdn.models.HeaderActionParameters """ _validation = { @@ -3091,6 +4487,10 @@ def __init__( parameters: "HeaderActionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the action. + :paramtype parameters: ~azure.mgmt.cdn.models.HeaderActionParameters + """ super(DeliveryRuleRequestHeaderAction, self).__init__(**kwargs) self.name = 'ModifyRequestHeader' # type: str self.parameters = parameters @@ -3101,13 +4501,14 @@ class DeliveryRuleRequestHeaderCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RequestHeaderMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.RequestHeaderMatchConditionParameters """ _validation = { @@ -3126,6 +4527,10 @@ def __init__( parameters: "RequestHeaderMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.RequestHeaderMatchConditionParameters + """ super(DeliveryRuleRequestHeaderCondition, self).__init__(**kwargs) self.name = 'RequestHeader' # type: str self.parameters = parameters @@ -3136,13 +4541,14 @@ class DeliveryRuleRequestMethodCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RequestMethodMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.RequestMethodMatchConditionParameters """ _validation = { @@ -3161,6 +4567,10 @@ def __init__( parameters: "RequestMethodMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.RequestMethodMatchConditionParameters + """ super(DeliveryRuleRequestMethodCondition, self).__init__(**kwargs) self.name = 'RequestMethod' # type: str self.parameters = parameters @@ -3171,13 +4581,14 @@ class DeliveryRuleRequestSchemeCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParameters """ _validation = { @@ -3196,6 +4607,10 @@ def __init__( parameters: "RequestSchemeMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParameters + """ super(DeliveryRuleRequestSchemeCondition, self).__init__(**kwargs) self.name = 'RequestScheme' # type: str self.parameters = parameters @@ -3206,13 +4621,14 @@ class DeliveryRuleRequestUriCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.RequestUriMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.RequestUriMatchConditionParameters """ _validation = { @@ -3231,6 +4647,10 @@ def __init__( parameters: "RequestUriMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.RequestUriMatchConditionParameters + """ super(DeliveryRuleRequestUriCondition, self).__init__(**kwargs) self.name = 'RequestUri' # type: str self.parameters = parameters @@ -3241,12 +4661,13 @@ class DeliveryRuleResponseHeaderAction(DeliveryRuleAction): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the action for the delivery rule.Constant filled by server. + :ivar name: Required. The name of the action for the delivery rule.Constant filled by server. Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.HeaderActionParameters + "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", + "RouteConfigurationOverride". + :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum + :ivar parameters: Required. Defines the parameters for the action. + :vartype parameters: ~azure.mgmt.cdn.models.HeaderActionParameters """ _validation = { @@ -3265,23 +4686,187 @@ def __init__( parameters: "HeaderActionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the action. + :paramtype parameters: ~azure.mgmt.cdn.models.HeaderActionParameters + """ super(DeliveryRuleResponseHeaderAction, self).__init__(**kwargs) self.name = 'ModifyResponseHeader' # type: str self.parameters = parameters +class DeliveryRuleRouteConfigurationOverrideAction(DeliveryRuleAction): + """Defines the route configuration override action for the delivery rule. Only applicable to Frontdoor Standard/Premium Profiles. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the action for the delivery rule.Constant filled by server. + Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", + "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", + "RouteConfigurationOverride". + :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum + :ivar parameters: Required. Defines the parameters for the action. + :vartype parameters: ~azure.mgmt.cdn.models.RouteConfigurationOverrideActionParameters + """ + + _validation = { + 'name': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'RouteConfigurationOverrideActionParameters'}, + } + + def __init__( + self, + *, + parameters: "RouteConfigurationOverrideActionParameters", + **kwargs + ): + """ + :keyword parameters: Required. Defines the parameters for the action. + :paramtype parameters: ~azure.mgmt.cdn.models.RouteConfigurationOverrideActionParameters + """ + super(DeliveryRuleRouteConfigurationOverrideAction, self).__init__(**kwargs) + self.name = 'RouteConfigurationOverride' # type: str + self.parameters = parameters + + +class DeliveryRuleServerPortCondition(DeliveryRuleCondition): + """Defines the ServerPort condition for the delivery rule. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.ServerPortMatchConditionParameters + """ + + _validation = { + 'name': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'ServerPortMatchConditionParameters'}, + } + + def __init__( + self, + *, + parameters: "ServerPortMatchConditionParameters", + **kwargs + ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.ServerPortMatchConditionParameters + """ + super(DeliveryRuleServerPortCondition, self).__init__(**kwargs) + self.name = 'ServerPort' # type: str + self.parameters = parameters + + +class DeliveryRuleSocketAddrCondition(DeliveryRuleCondition): + """Defines the SocketAddress condition for the delivery rule. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.SocketAddrMatchConditionParameters + """ + + _validation = { + 'name': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'SocketAddrMatchConditionParameters'}, + } + + def __init__( + self, + *, + parameters: "SocketAddrMatchConditionParameters", + **kwargs + ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.SocketAddrMatchConditionParameters + """ + super(DeliveryRuleSocketAddrCondition, self).__init__(**kwargs) + self.name = 'SocketAddr' # type: str + self.parameters = parameters + + +class DeliveryRuleSslProtocolCondition(DeliveryRuleCondition): + """Defines the SslProtocol condition for the delivery rule. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.SslProtocolMatchConditionParameters + """ + + _validation = { + 'name': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'SslProtocolMatchConditionParameters'}, + } + + def __init__( + self, + *, + parameters: "SslProtocolMatchConditionParameters", + **kwargs + ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.SslProtocolMatchConditionParameters + """ + super(DeliveryRuleSslProtocolCondition, self).__init__(**kwargs) + self.name = 'SslProtocol' # type: str + self.parameters = parameters + + class DeliveryRuleUrlFileExtensionCondition(DeliveryRuleCondition): """Defines the UrlFileExtension condition for the delivery rule. All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.UrlFileExtensionMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.UrlFileExtensionMatchConditionParameters """ _validation = { @@ -3300,6 +4885,10 @@ def __init__( parameters: "UrlFileExtensionMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.UrlFileExtensionMatchConditionParameters + """ super(DeliveryRuleUrlFileExtensionCondition, self).__init__(**kwargs) self.name = 'UrlFileExtension' # type: str self.parameters = parameters @@ -3310,13 +4899,14 @@ class DeliveryRuleUrlFileNameCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.UrlFileNameMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.UrlFileNameMatchConditionParameters """ _validation = { @@ -3335,6 +4925,10 @@ def __init__( parameters: "UrlFileNameMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.UrlFileNameMatchConditionParameters + """ super(DeliveryRuleUrlFileNameCondition, self).__init__(**kwargs) self.name = 'UrlFileName' # type: str self.parameters = parameters @@ -3345,13 +4939,14 @@ class DeliveryRuleUrlPathCondition(DeliveryRuleCondition): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the condition for the delivery rule.Constant filled by - server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", + :ivar name: Required. The name of the condition for the delivery rule.Constant filled by + server. Possible values include: "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", - "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type name: str or ~azure.mgmt.cdn.models.MatchVariable - :param parameters: Required. Defines the parameters for the condition. - :type parameters: ~azure.mgmt.cdn.models.UrlPathMatchConditionParameters + "UrlFileName", "HttpVersion", "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", + "HostName", "SslProtocol". + :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable + :ivar parameters: Required. Defines the parameters for the condition. + :vartype parameters: ~azure.mgmt.cdn.models.UrlPathMatchConditionParameters """ _validation = { @@ -3370,11 +4965,54 @@ def __init__( parameters: "UrlPathMatchConditionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the condition. + :paramtype parameters: ~azure.mgmt.cdn.models.UrlPathMatchConditionParameters + """ super(DeliveryRuleUrlPathCondition, self).__init__(**kwargs) self.name = 'UrlPath' # type: str self.parameters = parameters +class DimensionProperties(msrest.serialization.Model): + """Type of operation: get, read, delete, etc. + + :ivar name: Name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str + :ivar internal_name: Internal name of dimension. + :vartype internal_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'internal_name': {'key': 'internalName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + internal_name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + :keyword internal_name: Internal name of dimension. + :paramtype internal_name: str + """ + super(DimensionProperties, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.internal_name = internal_name + + class DomainValidationProperties(msrest.serialization.Model): """The JSON object that contains the properties to validate a domain. @@ -3400,12 +5038,14 @@ def __init__( self, **kwargs ): + """ + """ super(DomainValidationProperties, self).__init__(**kwargs) self.validation_token = None self.expiration_date = None -class EdgeNode(Resource): +class EdgeNode(ProxyResource): """Edgenode is a global Point of Presence (POP) location used to deliver CDN content to end users. Variables are only populated by the server, and will be ignored when sending a request. @@ -3418,8 +5058,8 @@ class EdgeNode(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param ip_address_groups: List of ip address groups. - :type ip_address_groups: list[~azure.mgmt.cdn.models.IpAddressGroup] + :ivar ip_address_groups: List of ip address groups. + :vartype ip_address_groups: list[~azure.mgmt.cdn.models.IpAddressGroup] """ _validation = { @@ -3443,6 +5083,10 @@ def __init__( ip_address_groups: Optional[List["IpAddressGroup"]] = None, **kwargs ): + """ + :keyword ip_address_groups: List of ip address groups. + :paramtype ip_address_groups: list[~azure.mgmt.cdn.models.IpAddressGroup] + """ super(EdgeNode, self).__init__(**kwargs) self.ip_address_groups = ip_address_groups @@ -3454,8 +5098,8 @@ class EdgenodeResult(msrest.serialization.Model): :ivar value: Edge node of CDN service. :vartype value: list[~azure.mgmt.cdn.models.EdgeNode] - :param next_link: URL to get the next set of edgenode list results if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of edgenode list results if there are any. + :vartype next_link: str """ _validation = { @@ -3473,6 +5117,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of edgenode list results if there are any. + :paramtype next_link: str + """ super(EdgenodeResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -3493,69 +5141,73 @@ class Endpoint(TrackedResource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param origin_path: A directory path on the origin that CDN can use to retrieve content from, + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar origin_path: A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param content_types_to_compress: List of content types on which compression applies. The value + :vartype origin_path: str + :ivar content_types_to_compress: List of content types on which compression applies. The value should be a valid MIME type. - :type content_types_to_compress: list[str] - :param origin_host_header: The host header value sent to the origin with each request. This + :vartype content_types_to_compress: list[str] + :ivar origin_host_header: The host header value sent to the origin with each request. This property at Endpoint is only allowed when endpoint uses single origin and can be overridden by the same property specified at origin.If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. - :type origin_host_header: str - :param is_compression_enabled: Indicates whether content compression is enabled on CDN. Default + :vartype origin_host_header: str + :ivar is_compression_enabled: Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB. - :type is_compression_enabled: bool - :param is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default + :vartype is_compression_enabled: bool + :ivar is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default value + is true. At least one protocol (HTTP or HTTPS) must be allowed. + :vartype is_http_allowed: bool + :ivar is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_http_allowed: bool - :param is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_https_allowed: bool - :param query_string_caching_behavior: Defines how CDN caches requests that include query + :vartype is_https_allowed: bool + :ivar query_string_caching_behavior: Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. Possible values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or ~azure.mgmt.cdn.models.QueryStringCachingBehavior - :param optimization_type: Specifies what scenario the customer wants this CDN endpoint to + :vartype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.QueryStringCachingBehavior + :ivar optimization_type: Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". - :type optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType - :param probe_path: Path to a file hosted on the origin which helps accelerate delivery of the + :vartype optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType + :ivar probe_path: Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path. This property is only relevant when using a single origin. - :type probe_path: str - :param geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each - geo filter defines an access rule to a specified path or content, e.g. block APAC for path + :vartype probe_path: str + :ivar geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each geo + filter defines an access rule to a specified path or content, e.g. block APAC for path /pictures/. - :type geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] - :param default_origin_group: A reference to the origin group. - :type default_origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param url_signing_keys: List of keys used to validate the signed URL hashes. - :type url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] - :param delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. - :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - the endpoint (if applicable). - :type web_application_firewall_policy_link: + :vartype geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] + :ivar default_origin_group: A reference to the origin group. + :vartype default_origin_group: ~azure.mgmt.cdn.models.ResourceReference + :ivar url_signing_keys: List of keys used to validate the signed URL hashes. + :vartype url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] + :ivar delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. + :vartype delivery_policy: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :ivar web_application_firewall_policy_link: Defines the Web Application Firewall policy for the + endpoint (if applicable). + :vartype web_application_firewall_policy_link: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net. :vartype host_name: str - :param origins: The source of the content being delivered via CDN. - :type origins: list[~azure.mgmt.cdn.models.DeepCreatedOrigin] - :param origin_groups: The origin groups comprising of origins that are used for load balancing + :ivar origins: The source of the content being delivered via CDN. + :vartype origins: list[~azure.mgmt.cdn.models.DeepCreatedOrigin] + :ivar origin_groups: The origin groups comprising of origins that are used for load balancing the traffic based on availability. - :type origin_groups: list[~azure.mgmt.cdn.models.DeepCreatedOriginGroup] + :vartype origin_groups: list[~azure.mgmt.cdn.models.DeepCreatedOriginGroup] + :ivar custom_domains: The custom domains under the endpoint. + :vartype custom_domains: list[~azure.mgmt.cdn.models.CustomDomain] :ivar resource_state: Resource status of the endpoint. Possible values include: "Creating", "Deleting", "Running", "Starting", "Stopped", "Stopping". :vartype resource_state: str or ~azure.mgmt.cdn.models.EndpointResourceState @@ -3570,6 +5222,7 @@ class Endpoint(TrackedResource): 'system_data': {'readonly': True}, 'location': {'required': True}, 'host_name': {'readonly': True}, + 'custom_domains': {'readonly': True}, 'resource_state': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -3598,6 +5251,7 @@ class Endpoint(TrackedResource): 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'origins': {'key': 'properties.origins', 'type': '[DeepCreatedOrigin]'}, 'origin_groups': {'key': 'properties.originGroups', 'type': '[DeepCreatedOriginGroup]'}, + 'custom_domains': {'key': 'properties.customDomains', 'type': '[CustomDomain]'}, 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -3625,6 +5279,71 @@ def __init__( origin_groups: Optional[List["DeepCreatedOriginGroup"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword origin_path: A directory path on the origin that CDN can use to retrieve content from, + e.g. contoso.cloudapp.net/originpath. + :paramtype origin_path: str + :keyword content_types_to_compress: List of content types on which compression applies. The + value should be a valid MIME type. + :paramtype content_types_to_compress: list[str] + :keyword origin_host_header: The host header value sent to the origin with each request. This + property at Endpoint is only allowed when endpoint uses single origin and can be overridden by + the same property specified at origin.If you leave this blank, the request hostname determines + this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this + host header value to match the origin hostname by default. + :paramtype origin_host_header: str + :keyword is_compression_enabled: Indicates whether content compression is enabled on CDN. + Default value is false. If compression is enabled, content will be served as compressed if user + requests for a compressed version. Content won't be compressed on CDN when requested content is + smaller than 1 byte or larger than 1 MB. + :paramtype is_compression_enabled: bool + :keyword is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default + value is true. At least one protocol (HTTP or HTTPS) must be allowed. + :paramtype is_http_allowed: bool + :keyword is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default + value is true. At least one protocol (HTTP or HTTPS) must be allowed. + :paramtype is_https_allowed: bool + :keyword query_string_caching_behavior: Defines how CDN caches requests that include query + strings. You can ignore any query strings when caching, bypass caching to prevent requests that + contain query strings from being cached, or cache every request with a unique URL. Possible + values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". + :paramtype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.QueryStringCachingBehavior + :keyword optimization_type: Specifies what scenario the customer wants this CDN endpoint to + optimize for, e.g. Download, Media services. With this information, CDN can apply scenario + driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". + :paramtype optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType + :keyword probe_path: Path to a file hosted on the origin which helps accelerate delivery of the + dynamic content and calculate the most optimal routes for the CDN. This is relative to the + origin path. This property is only relevant when using a single origin. + :paramtype probe_path: str + :keyword geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each + geo filter defines an access rule to a specified path or content, e.g. block APAC for path + /pictures/. + :paramtype geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] + :keyword default_origin_group: A reference to the origin group. + :paramtype default_origin_group: ~azure.mgmt.cdn.models.ResourceReference + :keyword url_signing_keys: List of keys used to validate the signed URL hashes. + :paramtype url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] + :keyword delivery_policy: A policy that specifies the delivery rules to be used for an + endpoint. + :paramtype delivery_policy: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :keyword web_application_firewall_policy_link: Defines the Web Application Firewall policy for + the endpoint (if applicable). + :paramtype web_application_firewall_policy_link: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink + :keyword origins: The source of the content being delivered via CDN. + :paramtype origins: list[~azure.mgmt.cdn.models.DeepCreatedOrigin] + :keyword origin_groups: The origin groups comprising of origins that are used for load + balancing the traffic based on availability. + :paramtype origin_groups: list[~azure.mgmt.cdn.models.DeepCreatedOriginGroup] + """ super(Endpoint, self).__init__(location=location, tags=tags, **kwargs) self.origin_path = origin_path self.content_types_to_compress = content_types_to_compress @@ -3643,6 +5362,7 @@ def __init__( self.host_name = None self.origins = origins self.origin_groups = origin_groups + self.custom_domains = None self.resource_state = None self.provisioning_state = None @@ -3654,8 +5374,8 @@ class EndpointListResult(msrest.serialization.Model): :ivar value: List of CDN endpoints within a profile. :vartype value: list[~azure.mgmt.cdn.models.Endpoint] - :param next_link: URL to get the next set of endpoint objects if there is any. - :type next_link: str + :ivar next_link: URL to get the next set of endpoint objects if there is any. + :vartype next_link: str """ _validation = { @@ -3673,6 +5393,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of endpoint objects if there is any. + :paramtype next_link: str + """ super(EndpointListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -3681,56 +5405,58 @@ def __init__( class EndpointPropertiesUpdateParameters(msrest.serialization.Model): """The JSON object containing endpoint update parameters. - :param origin_path: A directory path on the origin that CDN can use to retrieve content from, + :ivar origin_path: A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param content_types_to_compress: List of content types on which compression applies. The value + :vartype origin_path: str + :ivar content_types_to_compress: List of content types on which compression applies. The value should be a valid MIME type. - :type content_types_to_compress: list[str] - :param origin_host_header: The host header value sent to the origin with each request. This + :vartype content_types_to_compress: list[str] + :ivar origin_host_header: The host header value sent to the origin with each request. This property at Endpoint is only allowed when endpoint uses single origin and can be overridden by the same property specified at origin.If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. - :type origin_host_header: str - :param is_compression_enabled: Indicates whether content compression is enabled on CDN. Default + :vartype origin_host_header: str + :ivar is_compression_enabled: Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB. - :type is_compression_enabled: bool - :param is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_http_allowed: bool - :param is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default + :vartype is_compression_enabled: bool + :ivar is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default value + is true. At least one protocol (HTTP or HTTPS) must be allowed. + :vartype is_http_allowed: bool + :ivar is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_https_allowed: bool - :param query_string_caching_behavior: Defines how CDN caches requests that include query + :vartype is_https_allowed: bool + :ivar query_string_caching_behavior: Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. Possible values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or ~azure.mgmt.cdn.models.QueryStringCachingBehavior - :param optimization_type: Specifies what scenario the customer wants this CDN endpoint to + :vartype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.QueryStringCachingBehavior + :ivar optimization_type: Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". - :type optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType - :param probe_path: Path to a file hosted on the origin which helps accelerate delivery of the + :vartype optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType + :ivar probe_path: Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path. This property is only relevant when using a single origin. - :type probe_path: str - :param geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each - geo filter defines an access rule to a specified path or content, e.g. block APAC for path + :vartype probe_path: str + :ivar geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each geo + filter defines an access rule to a specified path or content, e.g. block APAC for path /pictures/. - :type geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] - :param default_origin_group: A reference to the origin group. - :type default_origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param url_signing_keys: List of keys used to validate the signed URL hashes. - :type url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] - :param delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. - :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - the endpoint (if applicable). - :type web_application_firewall_policy_link: + :vartype geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] + :ivar default_origin_group: A reference to the origin group. + :vartype default_origin_group: ~azure.mgmt.cdn.models.ResourceReference + :ivar url_signing_keys: List of keys used to validate the signed URL hashes. + :vartype url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] + :ivar delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. + :vartype delivery_policy: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :ivar web_application_firewall_policy_link: Defines the Web Application Firewall policy for the + endpoint (if applicable). + :vartype web_application_firewall_policy_link: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink """ @@ -3770,6 +5496,62 @@ def __init__( web_application_firewall_policy_link: Optional["EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink"] = None, **kwargs ): + """ + :keyword origin_path: A directory path on the origin that CDN can use to retrieve content from, + e.g. contoso.cloudapp.net/originpath. + :paramtype origin_path: str + :keyword content_types_to_compress: List of content types on which compression applies. The + value should be a valid MIME type. + :paramtype content_types_to_compress: list[str] + :keyword origin_host_header: The host header value sent to the origin with each request. This + property at Endpoint is only allowed when endpoint uses single origin and can be overridden by + the same property specified at origin.If you leave this blank, the request hostname determines + this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this + host header value to match the origin hostname by default. + :paramtype origin_host_header: str + :keyword is_compression_enabled: Indicates whether content compression is enabled on CDN. + Default value is false. If compression is enabled, content will be served as compressed if user + requests for a compressed version. Content won't be compressed on CDN when requested content is + smaller than 1 byte or larger than 1 MB. + :paramtype is_compression_enabled: bool + :keyword is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default + value is true. At least one protocol (HTTP or HTTPS) must be allowed. + :paramtype is_http_allowed: bool + :keyword is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default + value is true. At least one protocol (HTTP or HTTPS) must be allowed. + :paramtype is_https_allowed: bool + :keyword query_string_caching_behavior: Defines how CDN caches requests that include query + strings. You can ignore any query strings when caching, bypass caching to prevent requests that + contain query strings from being cached, or cache every request with a unique URL. Possible + values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". + :paramtype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.QueryStringCachingBehavior + :keyword optimization_type: Specifies what scenario the customer wants this CDN endpoint to + optimize for, e.g. Download, Media services. With this information, CDN can apply scenario + driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". + :paramtype optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType + :keyword probe_path: Path to a file hosted on the origin which helps accelerate delivery of the + dynamic content and calculate the most optimal routes for the CDN. This is relative to the + origin path. This property is only relevant when using a single origin. + :paramtype probe_path: str + :keyword geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each + geo filter defines an access rule to a specified path or content, e.g. block APAC for path + /pictures/. + :paramtype geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] + :keyword default_origin_group: A reference to the origin group. + :paramtype default_origin_group: ~azure.mgmt.cdn.models.ResourceReference + :keyword url_signing_keys: List of keys used to validate the signed URL hashes. + :paramtype url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] + :keyword delivery_policy: A policy that specifies the delivery rules to be used for an + endpoint. + :paramtype delivery_policy: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :keyword web_application_firewall_policy_link: Defines the Web Application Firewall policy for + the endpoint (if applicable). + :paramtype web_application_firewall_policy_link: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink + """ super(EndpointPropertiesUpdateParameters, self).__init__(**kwargs) self.origin_path = origin_path self.content_types_to_compress = content_types_to_compress @@ -3794,65 +5576,69 @@ class EndpointProperties(EndpointPropertiesUpdateParameters): All required parameters must be populated in order to send to Azure. - :param origin_path: A directory path on the origin that CDN can use to retrieve content from, + :ivar origin_path: A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param content_types_to_compress: List of content types on which compression applies. The value + :vartype origin_path: str + :ivar content_types_to_compress: List of content types on which compression applies. The value should be a valid MIME type. - :type content_types_to_compress: list[str] - :param origin_host_header: The host header value sent to the origin with each request. This + :vartype content_types_to_compress: list[str] + :ivar origin_host_header: The host header value sent to the origin with each request. This property at Endpoint is only allowed when endpoint uses single origin and can be overridden by the same property specified at origin.If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. - :type origin_host_header: str - :param is_compression_enabled: Indicates whether content compression is enabled on CDN. Default + :vartype origin_host_header: str + :ivar is_compression_enabled: Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB. - :type is_compression_enabled: bool - :param is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default + :vartype is_compression_enabled: bool + :ivar is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default value + is true. At least one protocol (HTTP or HTTPS) must be allowed. + :vartype is_http_allowed: bool + :ivar is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_http_allowed: bool - :param is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_https_allowed: bool - :param query_string_caching_behavior: Defines how CDN caches requests that include query + :vartype is_https_allowed: bool + :ivar query_string_caching_behavior: Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. Possible values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or ~azure.mgmt.cdn.models.QueryStringCachingBehavior - :param optimization_type: Specifies what scenario the customer wants this CDN endpoint to + :vartype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.QueryStringCachingBehavior + :ivar optimization_type: Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". - :type optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType - :param probe_path: Path to a file hosted on the origin which helps accelerate delivery of the + :vartype optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType + :ivar probe_path: Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path. This property is only relevant when using a single origin. - :type probe_path: str - :param geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each - geo filter defines an access rule to a specified path or content, e.g. block APAC for path + :vartype probe_path: str + :ivar geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each geo + filter defines an access rule to a specified path or content, e.g. block APAC for path /pictures/. - :type geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] - :param default_origin_group: A reference to the origin group. - :type default_origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param url_signing_keys: List of keys used to validate the signed URL hashes. - :type url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] - :param delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. - :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - the endpoint (if applicable). - :type web_application_firewall_policy_link: + :vartype geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] + :ivar default_origin_group: A reference to the origin group. + :vartype default_origin_group: ~azure.mgmt.cdn.models.ResourceReference + :ivar url_signing_keys: List of keys used to validate the signed URL hashes. + :vartype url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] + :ivar delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. + :vartype delivery_policy: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :ivar web_application_firewall_policy_link: Defines the Web Application Firewall policy for the + endpoint (if applicable). + :vartype web_application_firewall_policy_link: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net. :vartype host_name: str - :param origins: Required. The source of the content being delivered via CDN. - :type origins: list[~azure.mgmt.cdn.models.DeepCreatedOrigin] - :param origin_groups: The origin groups comprising of origins that are used for load balancing + :ivar origins: Required. The source of the content being delivered via CDN. + :vartype origins: list[~azure.mgmt.cdn.models.DeepCreatedOrigin] + :ivar origin_groups: The origin groups comprising of origins that are used for load balancing the traffic based on availability. - :type origin_groups: list[~azure.mgmt.cdn.models.DeepCreatedOriginGroup] + :vartype origin_groups: list[~azure.mgmt.cdn.models.DeepCreatedOriginGroup] + :ivar custom_domains: The custom domains under the endpoint. + :vartype custom_domains: list[~azure.mgmt.cdn.models.CustomDomain] :ivar resource_state: Resource status of the endpoint. Possible values include: "Creating", "Deleting", "Running", "Starting", "Stopped", "Stopping". :vartype resource_state: str or ~azure.mgmt.cdn.models.EndpointResourceState @@ -3863,6 +5649,7 @@ class EndpointProperties(EndpointPropertiesUpdateParameters): _validation = { 'host_name': {'readonly': True}, 'origins': {'required': True}, + 'custom_domains': {'readonly': True}, 'resource_state': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -3885,6 +5672,7 @@ class EndpointProperties(EndpointPropertiesUpdateParameters): 'host_name': {'key': 'hostName', 'type': 'str'}, 'origins': {'key': 'origins', 'type': '[DeepCreatedOrigin]'}, 'origin_groups': {'key': 'originGroups', 'type': '[DeepCreatedOriginGroup]'}, + 'custom_domains': {'key': 'customDomains', 'type': '[CustomDomain]'}, 'resource_state': {'key': 'resourceState', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } @@ -3910,10 +5698,72 @@ def __init__( origin_groups: Optional[List["DeepCreatedOriginGroup"]] = None, **kwargs ): + """ + :keyword origin_path: A directory path on the origin that CDN can use to retrieve content from, + e.g. contoso.cloudapp.net/originpath. + :paramtype origin_path: str + :keyword content_types_to_compress: List of content types on which compression applies. The + value should be a valid MIME type. + :paramtype content_types_to_compress: list[str] + :keyword origin_host_header: The host header value sent to the origin with each request. This + property at Endpoint is only allowed when endpoint uses single origin and can be overridden by + the same property specified at origin.If you leave this blank, the request hostname determines + this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this + host header value to match the origin hostname by default. + :paramtype origin_host_header: str + :keyword is_compression_enabled: Indicates whether content compression is enabled on CDN. + Default value is false. If compression is enabled, content will be served as compressed if user + requests for a compressed version. Content won't be compressed on CDN when requested content is + smaller than 1 byte or larger than 1 MB. + :paramtype is_compression_enabled: bool + :keyword is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default + value is true. At least one protocol (HTTP or HTTPS) must be allowed. + :paramtype is_http_allowed: bool + :keyword is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default + value is true. At least one protocol (HTTP or HTTPS) must be allowed. + :paramtype is_https_allowed: bool + :keyword query_string_caching_behavior: Defines how CDN caches requests that include query + strings. You can ignore any query strings when caching, bypass caching to prevent requests that + contain query strings from being cached, or cache every request with a unique URL. Possible + values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". + :paramtype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.QueryStringCachingBehavior + :keyword optimization_type: Specifies what scenario the customer wants this CDN endpoint to + optimize for, e.g. Download, Media services. With this information, CDN can apply scenario + driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". + :paramtype optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType + :keyword probe_path: Path to a file hosted on the origin which helps accelerate delivery of the + dynamic content and calculate the most optimal routes for the CDN. This is relative to the + origin path. This property is only relevant when using a single origin. + :paramtype probe_path: str + :keyword geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each + geo filter defines an access rule to a specified path or content, e.g. block APAC for path + /pictures/. + :paramtype geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] + :keyword default_origin_group: A reference to the origin group. + :paramtype default_origin_group: ~azure.mgmt.cdn.models.ResourceReference + :keyword url_signing_keys: List of keys used to validate the signed URL hashes. + :paramtype url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] + :keyword delivery_policy: A policy that specifies the delivery rules to be used for an + endpoint. + :paramtype delivery_policy: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :keyword web_application_firewall_policy_link: Defines the Web Application Firewall policy for + the endpoint (if applicable). + :paramtype web_application_firewall_policy_link: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink + :keyword origins: Required. The source of the content being delivered via CDN. + :paramtype origins: list[~azure.mgmt.cdn.models.DeepCreatedOrigin] + :keyword origin_groups: The origin groups comprising of origins that are used for load + balancing the traffic based on availability. + :paramtype origin_groups: list[~azure.mgmt.cdn.models.DeepCreatedOriginGroup] + """ super(EndpointProperties, self).__init__(origin_path=origin_path, content_types_to_compress=content_types_to_compress, origin_host_header=origin_host_header, is_compression_enabled=is_compression_enabled, is_http_allowed=is_http_allowed, is_https_allowed=is_https_allowed, query_string_caching_behavior=query_string_caching_behavior, optimization_type=optimization_type, probe_path=probe_path, geo_filters=geo_filters, default_origin_group=default_origin_group, url_signing_keys=url_signing_keys, delivery_policy=delivery_policy, web_application_firewall_policy_link=web_application_firewall_policy_link, **kwargs) self.host_name = None self.origins = origins self.origin_groups = origin_groups + self.custom_domains = None self.resource_state = None self.provisioning_state = None @@ -3923,10 +5773,10 @@ class EndpointPropertiesUpdateParametersDeliveryPolicy(msrest.serialization.Mode All required parameters must be populated in order to send to Azure. - :param description: User-friendly description of the policy. - :type description: str - :param rules: Required. A list of the delivery rules. - :type rules: list[~azure.mgmt.cdn.models.DeliveryRule] + :ivar description: User-friendly description of the policy. + :vartype description: str + :ivar rules: Required. A list of the delivery rules. + :vartype rules: list[~azure.mgmt.cdn.models.DeliveryRule] """ _validation = { @@ -3945,6 +5795,12 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword description: User-friendly description of the policy. + :paramtype description: str + :keyword rules: Required. A list of the delivery rules. + :paramtype rules: list[~azure.mgmt.cdn.models.DeliveryRule] + """ super(EndpointPropertiesUpdateParametersDeliveryPolicy, self).__init__(**kwargs) self.description = description self.rules = rules @@ -3953,8 +5809,8 @@ def __init__( class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(msrest.serialization.Model): """Defines the Web Application Firewall policy for the endpoint (if applicable). - :param id: Resource ID. - :type id: str + :ivar id: Resource ID. + :vartype id: str """ _attribute_map = { @@ -3967,6 +5823,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ super(EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink, self).__init__(**kwargs) self.id = id @@ -3974,58 +5834,60 @@ def __init__( class EndpointUpdateParameters(msrest.serialization.Model): """Properties required to create or update an endpoint. - :param tags: A set of tags. Endpoint tags. - :type tags: dict[str, str] - :param origin_path: A directory path on the origin that CDN can use to retrieve content from, + :ivar tags: A set of tags. Endpoint tags. + :vartype tags: dict[str, str] + :ivar origin_path: A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param content_types_to_compress: List of content types on which compression applies. The value + :vartype origin_path: str + :ivar content_types_to_compress: List of content types on which compression applies. The value should be a valid MIME type. - :type content_types_to_compress: list[str] - :param origin_host_header: The host header value sent to the origin with each request. This + :vartype content_types_to_compress: list[str] + :ivar origin_host_header: The host header value sent to the origin with each request. This property at Endpoint is only allowed when endpoint uses single origin and can be overridden by the same property specified at origin.If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. - :type origin_host_header: str - :param is_compression_enabled: Indicates whether content compression is enabled on CDN. Default + :vartype origin_host_header: str + :ivar is_compression_enabled: Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB. - :type is_compression_enabled: bool - :param is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default + :vartype is_compression_enabled: bool + :ivar is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default value + is true. At least one protocol (HTTP or HTTPS) must be allowed. + :vartype is_http_allowed: bool + :ivar is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_http_allowed: bool - :param is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default - value is true. At least one protocol (HTTP or HTTPS) must be allowed. - :type is_https_allowed: bool - :param query_string_caching_behavior: Defines how CDN caches requests that include query + :vartype is_https_allowed: bool + :ivar query_string_caching_behavior: Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. Possible values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or ~azure.mgmt.cdn.models.QueryStringCachingBehavior - :param optimization_type: Specifies what scenario the customer wants this CDN endpoint to + :vartype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.QueryStringCachingBehavior + :ivar optimization_type: Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". - :type optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType - :param probe_path: Path to a file hosted on the origin which helps accelerate delivery of the + :vartype optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType + :ivar probe_path: Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path. This property is only relevant when using a single origin. - :type probe_path: str - :param geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each - geo filter defines an access rule to a specified path or content, e.g. block APAC for path + :vartype probe_path: str + :ivar geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each geo + filter defines an access rule to a specified path or content, e.g. block APAC for path /pictures/. - :type geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] - :param default_origin_group: A reference to the origin group. - :type default_origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param url_signing_keys: List of keys used to validate the signed URL hashes. - :type url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] - :param delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. - :type delivery_policy: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy - :param web_application_firewall_policy_link: Defines the Web Application Firewall policy for - the endpoint (if applicable). - :type web_application_firewall_policy_link: + :vartype geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] + :ivar default_origin_group: A reference to the origin group. + :vartype default_origin_group: ~azure.mgmt.cdn.models.ResourceReference + :ivar url_signing_keys: List of keys used to validate the signed URL hashes. + :vartype url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] + :ivar delivery_policy: A policy that specifies the delivery rules to be used for an endpoint. + :vartype delivery_policy: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :ivar web_application_firewall_policy_link: Defines the Web Application Firewall policy for the + endpoint (if applicable). + :vartype web_application_firewall_policy_link: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink """ @@ -4067,6 +5929,64 @@ def __init__( web_application_firewall_policy_link: Optional["EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Endpoint tags. + :paramtype tags: dict[str, str] + :keyword origin_path: A directory path on the origin that CDN can use to retrieve content from, + e.g. contoso.cloudapp.net/originpath. + :paramtype origin_path: str + :keyword content_types_to_compress: List of content types on which compression applies. The + value should be a valid MIME type. + :paramtype content_types_to_compress: list[str] + :keyword origin_host_header: The host header value sent to the origin with each request. This + property at Endpoint is only allowed when endpoint uses single origin and can be overridden by + the same property specified at origin.If you leave this blank, the request hostname determines + this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this + host header value to match the origin hostname by default. + :paramtype origin_host_header: str + :keyword is_compression_enabled: Indicates whether content compression is enabled on CDN. + Default value is false. If compression is enabled, content will be served as compressed if user + requests for a compressed version. Content won't be compressed on CDN when requested content is + smaller than 1 byte or larger than 1 MB. + :paramtype is_compression_enabled: bool + :keyword is_http_allowed: Indicates whether HTTP traffic is allowed on the endpoint. Default + value is true. At least one protocol (HTTP or HTTPS) must be allowed. + :paramtype is_http_allowed: bool + :keyword is_https_allowed: Indicates whether HTTPS traffic is allowed on the endpoint. Default + value is true. At least one protocol (HTTP or HTTPS) must be allowed. + :paramtype is_https_allowed: bool + :keyword query_string_caching_behavior: Defines how CDN caches requests that include query + strings. You can ignore any query strings when caching, bypass caching to prevent requests that + contain query strings from being cached, or cache every request with a unique URL. Possible + values include: "IgnoreQueryString", "BypassCaching", "UseQueryString", "NotSet". + :paramtype query_string_caching_behavior: str or + ~azure.mgmt.cdn.models.QueryStringCachingBehavior + :keyword optimization_type: Specifies what scenario the customer wants this CDN endpoint to + optimize for, e.g. Download, Media services. With this information, CDN can apply scenario + driven optimization. Possible values include: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", "DynamicSiteAcceleration". + :paramtype optimization_type: str or ~azure.mgmt.cdn.models.OptimizationType + :keyword probe_path: Path to a file hosted on the origin which helps accelerate delivery of the + dynamic content and calculate the most optimal routes for the CDN. This is relative to the + origin path. This property is only relevant when using a single origin. + :paramtype probe_path: str + :keyword geo_filters: List of rules defining the user's geo access within a CDN endpoint. Each + geo filter defines an access rule to a specified path or content, e.g. block APAC for path + /pictures/. + :paramtype geo_filters: list[~azure.mgmt.cdn.models.GeoFilter] + :keyword default_origin_group: A reference to the origin group. + :paramtype default_origin_group: ~azure.mgmt.cdn.models.ResourceReference + :keyword url_signing_keys: List of keys used to validate the signed URL hashes. + :paramtype url_signing_keys: list[~azure.mgmt.cdn.models.UrlSigningKey] + :keyword delivery_policy: A policy that specifies the delivery rules to be used for an + endpoint. + :paramtype delivery_policy: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersDeliveryPolicy + :keyword web_application_firewall_policy_link: Defines the Web Application Firewall policy for + the endpoint (if applicable). + :paramtype web_application_firewall_policy_link: + ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink + """ super(EndpointUpdateParameters, self).__init__(**kwargs) self.tags = tags self.origin_path = origin_path @@ -4085,34 +6005,108 @@ def __init__( self.web_application_firewall_policy_link = web_application_firewall_policy_link -class ErrorResponse(msrest.serialization.Model): - """Error response indicates CDN service is not able to process the incoming request. The reason is provided in the error message. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Error code. + :ivar code: The error code. :vartype code: str - :ivar message: Error message indicating why the operation failed. + :ivar message: The error message. :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.cdn.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.cdn.models.ErrorAdditionalInfo] """ _validation = { 'code': {'readonly': True}, 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, } _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( self, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) + """ + """ + super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response indicates Azure Front Door Standard or Azure Front Door Premium or CDN service is not able to process the incoming request. The reason is provided in the error message. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.cdn.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.cdn.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error class GeoFilter(msrest.serialization.Model): @@ -4120,15 +6114,15 @@ class GeoFilter(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param relative_path: Required. Relative path applicable to geo filter. (e.g. '/mypictures', + :ivar relative_path: Required. Relative path applicable to geo filter. (e.g. '/mypictures', '/mypicture/kitty.jpg', and etc.). - :type relative_path: str - :param action: Required. Action of the geo filter, i.e. allow or block access. Possible values + :vartype relative_path: str + :ivar action: Required. Action of the geo filter, i.e. allow or block access. Possible values include: "Block", "Allow". - :type action: str or ~azure.mgmt.cdn.models.GeoFilterActions - :param country_codes: Required. Two letter country codes defining user country access in a geo - filter, e.g. AU, MX, US. - :type country_codes: list[str] + :vartype action: str or ~azure.mgmt.cdn.models.GeoFilterActions + :ivar country_codes: Required. Two letter country or region codes defining user country or + region access in a geo filter, e.g. AU, MX, US. + :vartype country_codes: list[str] """ _validation = { @@ -4151,6 +6145,17 @@ def __init__( country_codes: List[str], **kwargs ): + """ + :keyword relative_path: Required. Relative path applicable to geo filter. (e.g. '/mypictures', + '/mypicture/kitty.jpg', and etc.). + :paramtype relative_path: str + :keyword action: Required. Action of the geo filter, i.e. allow or block access. Possible + values include: "Block", "Allow". + :paramtype action: str or ~azure.mgmt.cdn.models.GeoFilterActions + :keyword country_codes: Required. Two letter country or region codes defining user country or + region access in a geo filter, e.g. AU, MX, US. + :paramtype country_codes: list[str] + """ super(GeoFilter, self).__init__(**kwargs) self.relative_path = relative_path self.action = action @@ -4164,32 +6169,31 @@ class HeaderActionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleHeaderActionParameters". - :vartype odata_type: str - :param header_action: Required. Action to perform. Possible values include: "Append", + :ivar type_name: Has constant value: "DeliveryRuleHeaderActionParameters". + :vartype type_name: str + :ivar header_action: Required. Action to perform. Possible values include: "Append", "Overwrite", "Delete". - :type header_action: str or ~azure.mgmt.cdn.models.HeaderAction - :param header_name: Required. Name of the header to modify. - :type header_name: str - :param value: Value for the specified action. - :type value: str + :vartype header_action: str or ~azure.mgmt.cdn.models.HeaderAction + :ivar header_name: Required. Name of the header to modify. + :vartype header_name: str + :ivar value: Value for the specified action. + :vartype value: str """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'header_action': {'required': True}, 'header_name': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'header_action': {'key': 'headerAction', 'type': 'str'}, 'header_name': {'key': 'headerName', 'type': 'str'}, 'value': {'key': 'value', 'type': 'str'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleHeaderActionParameters" + type_name = "DeliveryRuleHeaderActionParameters" def __init__( self, @@ -4199,6 +6203,15 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword header_action: Required. Action to perform. Possible values include: "Append", + "Overwrite", "Delete". + :paramtype header_action: str or ~azure.mgmt.cdn.models.HeaderAction + :keyword header_name: Required. Name of the header to modify. + :paramtype header_name: str + :keyword value: Value for the specified action. + :paramtype value: str + """ super(HeaderActionParameters, self).__init__(**kwargs) self.header_action = header_action self.header_name = header_name @@ -4208,18 +6221,17 @@ def __init__( class HealthProbeParameters(msrest.serialization.Model): """The JSON object that contains the properties to send health probes to origin. - :param probe_path: The path relative to the origin that is used to determine the health of the + :ivar probe_path: The path relative to the origin that is used to determine the health of the origin. - :type probe_path: str - :param probe_request_type: The type of health probe request that is made. Possible values + :vartype probe_path: str + :ivar probe_request_type: The type of health probe request that is made. Possible values include: "NotSet", "GET", "HEAD". - :type probe_request_type: str or ~azure.mgmt.cdn.models.HealthProbeRequestType - :param probe_protocol: Protocol to use for health probe. Possible values include: "NotSet", + :vartype probe_request_type: str or ~azure.mgmt.cdn.models.HealthProbeRequestType + :ivar probe_protocol: Protocol to use for health probe. Possible values include: "NotSet", "Http", "Https". - :type probe_protocol: str or ~azure.mgmt.cdn.models.ProbeProtocol - :param probe_interval_in_seconds: The number of seconds between health probes.Default is - 240sec. - :type probe_interval_in_seconds: int + :vartype probe_protocol: str or ~azure.mgmt.cdn.models.ProbeProtocol + :ivar probe_interval_in_seconds: The number of seconds between health probes.Default is 240sec. + :vartype probe_interval_in_seconds: int """ _validation = { @@ -4242,6 +6254,20 @@ def __init__( probe_interval_in_seconds: Optional[int] = None, **kwargs ): + """ + :keyword probe_path: The path relative to the origin that is used to determine the health of + the origin. + :paramtype probe_path: str + :keyword probe_request_type: The type of health probe request that is made. Possible values + include: "NotSet", "GET", "HEAD". + :paramtype probe_request_type: str or ~azure.mgmt.cdn.models.HealthProbeRequestType + :keyword probe_protocol: Protocol to use for health probe. Possible values include: "NotSet", + "Http", "Https". + :paramtype probe_protocol: str or ~azure.mgmt.cdn.models.ProbeProtocol + :keyword probe_interval_in_seconds: The number of seconds between health probes.Default is + 240sec. + :paramtype probe_interval_in_seconds: int + """ super(HealthProbeParameters, self).__init__(**kwargs) self.probe_path = probe_path self.probe_request_type = probe_request_type @@ -4249,13 +6275,77 @@ def __init__( self.probe_interval_in_seconds = probe_interval_in_seconds +class HostNameMatchConditionParameters(msrest.serialization.Model): + """Defines the parameters for HostName match conditions. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type_name: Has constant value: "DeliveryRuleHostNameConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :vartype operator: str or ~azure.mgmt.cdn.models.HostNameOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ + + _validation = { + 'type_name': {'required': True, 'constant': True}, + 'operator': {'required': True}, + } + + _attribute_map = { + 'type_name': {'key': 'typeName', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, + 'match_values': {'key': 'matchValues', 'type': '[str]'}, + 'transforms': {'key': 'transforms', 'type': '[str]'}, + } + + type_name = "DeliveryRuleHostNameConditionParameters" + + def __init__( + self, + *, + operator: Union[str, "HostNameOperator"], + negate_condition: Optional[bool] = None, + match_values: Optional[List[str]] = None, + transforms: Optional[List[Union[str, "Transform"]]] = None, + **kwargs + ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.HostNameOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ + super(HostNameMatchConditionParameters, self).__init__(**kwargs) + self.operator = operator + self.negate_condition = negate_condition + self.match_values = match_values + self.transforms = transforms + + class HttpErrorRangeParameters(msrest.serialization.Model): """The JSON object that represents the range for http status codes. - :param begin: The inclusive start of the http status code range. - :type begin: int - :param end: The inclusive end of the http status code range. - :type end: int + :ivar begin: The inclusive start of the http status code range. + :vartype begin: int + :ivar end: The inclusive end of the http status code range. + :vartype end: int """ _validation = { @@ -4275,6 +6365,12 @@ def __init__( end: Optional[int] = None, **kwargs ): + """ + :keyword begin: The inclusive start of the http status code range. + :paramtype begin: int + :keyword end: The inclusive end of the http status code range. + :paramtype end: int + """ super(HttpErrorRangeParameters, self).__init__(**kwargs) self.begin = begin self.end = end @@ -4287,30 +6383,32 @@ class HttpVersionMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleHttpVersionConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Equal". - :type operator: str or ~azure.mgmt.cdn.models.HttpVersionOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] + :ivar type_name: Has constant value: "DeliveryRuleHttpVersionConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Equal". + :vartype operator: str or ~azure.mgmt.cdn.models.HttpVersionOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, + 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleHttpVersionConditionParameters" + type_name = "DeliveryRuleHttpVersionConditionParameters" def __init__( self, @@ -4318,23 +6416,36 @@ def __init__( operator: Union[str, "HttpVersionOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, + transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: + "Equal". + :paramtype operator: str or ~azure.mgmt.cdn.models.HttpVersionOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(HttpVersionMatchConditionParameters, self).__init__(**kwargs) self.operator = operator self.negate_condition = negate_condition self.match_values = match_values + self.transforms = transforms class IpAddressGroup(msrest.serialization.Model): """CDN Ip address group. - :param delivery_region: The delivery region of the ip address group. - :type delivery_region: str - :param ipv4_addresses: The list of ip v4 addresses. - :type ipv4_addresses: list[~azure.mgmt.cdn.models.CidrIpAddress] - :param ipv6_addresses: The list of ip v6 addresses. - :type ipv6_addresses: list[~azure.mgmt.cdn.models.CidrIpAddress] + :ivar delivery_region: The delivery region of the ip address group. + :vartype delivery_region: str + :ivar ipv4_addresses: The list of ip v4 addresses. + :vartype ipv4_addresses: list[~azure.mgmt.cdn.models.CidrIpAddress] + :ivar ipv6_addresses: The list of ip v6 addresses. + :vartype ipv6_addresses: list[~azure.mgmt.cdn.models.CidrIpAddress] """ _attribute_map = { @@ -4351,6 +6462,14 @@ def __init__( ipv6_addresses: Optional[List["CidrIpAddress"]] = None, **kwargs ): + """ + :keyword delivery_region: The delivery region of the ip address group. + :paramtype delivery_region: str + :keyword ipv4_addresses: The list of ip v4 addresses. + :paramtype ipv4_addresses: list[~azure.mgmt.cdn.models.CidrIpAddress] + :keyword ipv6_addresses: The list of ip v6 addresses. + :paramtype ipv6_addresses: list[~azure.mgmt.cdn.models.CidrIpAddress] + """ super(IpAddressGroup, self).__init__(**kwargs) self.delivery_region = delivery_region self.ipv4_addresses = ipv4_addresses @@ -4364,34 +6483,33 @@ class IsDeviceMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleIsDeviceConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Equal". - :type operator: str or ~azure.mgmt.cdn.models.IsDeviceOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str or + :ivar type_name: Has constant value: "DeliveryRuleIsDeviceConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Equal". + :vartype operator: str or ~azure.mgmt.cdn.models.IsDeviceOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str or ~azure.mgmt.cdn.models.IsDeviceMatchConditionParametersMatchValuesItem] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleIsDeviceConditionParameters" + type_name = "DeliveryRuleIsDeviceConditionParameters" def __init__( self, @@ -4402,6 +6520,18 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: + "Equal". + :paramtype operator: str or ~azure.mgmt.cdn.models.IsDeviceOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str or + ~azure.mgmt.cdn.models.IsDeviceMatchConditionParametersMatchValuesItem] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(IsDeviceMatchConditionParameters, self).__init__(**kwargs) self.operator = operator self.negate_condition = negate_condition @@ -4416,32 +6546,31 @@ class KeyVaultCertificateSourceParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.KeyVaultCertificateSourceParameters". - :vartype odata_type: str - :param subscription_id: Required. Subscription Id of the user's Key Vault containing the SSL + :ivar type_name: Has constant value: "KeyVaultCertificateSourceParameters". + :vartype type_name: str + :ivar subscription_id: Required. Subscription Id of the user's Key Vault containing the SSL certificate. - :type subscription_id: str - :param resource_group_name: Required. Resource group of the user's Key Vault containing the SSL + :vartype subscription_id: str + :ivar resource_group_name: Required. Resource group of the user's Key Vault containing the SSL certificate. - :type resource_group_name: str - :param vault_name: Required. The name of the user's Key Vault containing the SSL certificate. - :type vault_name: str - :param secret_name: Required. The name of Key Vault Secret (representing the full certificate + :vartype resource_group_name: str + :ivar vault_name: Required. The name of the user's Key Vault containing the SSL certificate. + :vartype vault_name: str + :ivar secret_name: Required. The name of Key Vault Secret (representing the full certificate PFX) in Key Vault. - :type secret_name: str - :param secret_version: The version(GUID) of Key Vault Secret in Key Vault. - :type secret_version: str - :param update_rule: Required. Describes the action that shall be taken when the certificate is + :vartype secret_name: str + :ivar secret_version: The version(GUID) of Key Vault Secret in Key Vault. + :vartype secret_version: str + :ivar update_rule: Required. Describes the action that shall be taken when the certificate is updated in Key Vault. Possible values include: "NoAction". - :type update_rule: str or ~azure.mgmt.cdn.models.UpdateRule - :param delete_rule: Required. Describes the action that shall be taken when the certificate is + :vartype update_rule: str or ~azure.mgmt.cdn.models.UpdateRule + :ivar delete_rule: Required. Describes the action that shall be taken when the certificate is removed from Key Vault. Possible values include: "NoAction". - :type delete_rule: str or ~azure.mgmt.cdn.models.DeleteRule + :vartype delete_rule: str or ~azure.mgmt.cdn.models.DeleteRule """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'subscription_id': {'required': True}, 'resource_group_name': {'required': True}, 'vault_name': {'required': True}, @@ -4451,7 +6580,7 @@ class KeyVaultCertificateSourceParameters(msrest.serialization.Model): } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, 'vault_name': {'key': 'vaultName', 'type': 'str'}, @@ -4461,7 +6590,7 @@ class KeyVaultCertificateSourceParameters(msrest.serialization.Model): 'delete_rule': {'key': 'deleteRule', 'type': 'str'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.KeyVaultCertificateSourceParameters" + type_name = "KeyVaultCertificateSourceParameters" def __init__( self, @@ -4475,6 +6604,27 @@ def __init__( secret_version: Optional[str] = None, **kwargs ): + """ + :keyword subscription_id: Required. Subscription Id of the user's Key Vault containing the SSL + certificate. + :paramtype subscription_id: str + :keyword resource_group_name: Required. Resource group of the user's Key Vault containing the + SSL certificate. + :paramtype resource_group_name: str + :keyword vault_name: Required. The name of the user's Key Vault containing the SSL certificate. + :paramtype vault_name: str + :keyword secret_name: Required. The name of Key Vault Secret (representing the full certificate + PFX) in Key Vault. + :paramtype secret_name: str + :keyword secret_version: The version(GUID) of Key Vault Secret in Key Vault. + :paramtype secret_version: str + :keyword update_rule: Required. Describes the action that shall be taken when the certificate + is updated in Key Vault. Possible values include: "NoAction". + :paramtype update_rule: str or ~azure.mgmt.cdn.models.UpdateRule + :keyword delete_rule: Required. Describes the action that shall be taken when the certificate + is removed from Key Vault. Possible values include: "NoAction". + :paramtype delete_rule: str or ~azure.mgmt.cdn.models.DeleteRule + """ super(KeyVaultCertificateSourceParameters, self).__init__(**kwargs) self.subscription_id = subscription_id self.resource_group_name = resource_group_name @@ -4492,25 +6642,23 @@ class KeyVaultSigningKeyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.KeyVaultSigningKeyParameters". - :vartype odata_type: str - :param subscription_id: Required. Subscription Id of the user's Key Vault containing the + :ivar type_name: Has constant value: "KeyVaultSigningKeyParameters". + :vartype type_name: str + :ivar subscription_id: Required. Subscription Id of the user's Key Vault containing the secret. + :vartype subscription_id: str + :ivar resource_group_name: Required. Resource group of the user's Key Vault containing the secret. - :type subscription_id: str - :param resource_group_name: Required. Resource group of the user's Key Vault containing the - secret. - :type resource_group_name: str - :param vault_name: Required. The name of the user's Key Vault containing the secret. - :type vault_name: str - :param secret_name: Required. The name of secret in Key Vault. - :type secret_name: str - :param secret_version: Required. The version(GUID) of secret in Key Vault. - :type secret_version: str + :vartype resource_group_name: str + :ivar vault_name: Required. The name of the user's Key Vault containing the secret. + :vartype vault_name: str + :ivar secret_name: Required. The name of secret in Key Vault. + :vartype secret_name: str + :ivar secret_version: Required. The version(GUID) of secret in Key Vault. + :vartype secret_version: str """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'subscription_id': {'required': True}, 'resource_group_name': {'required': True}, 'vault_name': {'required': True}, @@ -4519,7 +6667,7 @@ class KeyVaultSigningKeyParameters(msrest.serialization.Model): } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, 'vault_name': {'key': 'vaultName', 'type': 'str'}, @@ -4527,7 +6675,7 @@ class KeyVaultSigningKeyParameters(msrest.serialization.Model): 'secret_version': {'key': 'secretVersion', 'type': 'str'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.KeyVaultSigningKeyParameters" + type_name = "KeyVaultSigningKeyParameters" def __init__( self, @@ -4539,6 +6687,20 @@ def __init__( secret_version: str, **kwargs ): + """ + :keyword subscription_id: Required. Subscription Id of the user's Key Vault containing the + secret. + :paramtype subscription_id: str + :keyword resource_group_name: Required. Resource group of the user's Key Vault containing the + secret. + :paramtype resource_group_name: str + :keyword vault_name: Required. The name of the user's Key Vault containing the secret. + :paramtype vault_name: str + :keyword secret_name: Required. The name of secret in Key Vault. + :paramtype secret_name: str + :keyword secret_version: Required. The version(GUID) of secret in Key Vault. + :paramtype secret_version: str + """ super(KeyVaultSigningKeyParameters, self).__init__(**kwargs) self.subscription_id = subscription_id self.resource_group_name = resource_group_name @@ -4550,14 +6712,14 @@ def __init__( class LoadBalancingSettingsParameters(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_in_milliseconds: The additional latency in milliseconds for probes to + :vartype successful_samples_required: int + :ivar additional_latency_in_milliseconds: The additional latency in milliseconds for probes to fall into the lowest latency bucket. - :type additional_latency_in_milliseconds: int + :vartype additional_latency_in_milliseconds: int """ _attribute_map = { @@ -4574,6 +6736,16 @@ def __init__( additional_latency_in_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_in_milliseconds: The additional latency in milliseconds for probes + to fall into the lowest latency bucket. + :paramtype additional_latency_in_milliseconds: int + """ super(LoadBalancingSettingsParameters, self).__init__(**kwargs) self.sample_size = sample_size self.successful_samples_required = successful_samples_required @@ -4585,9 +6757,9 @@ class LoadParameters(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 loaded. Path should be a relative + :ivar content_paths: Required. The path to the content to be loaded. Path should be a relative file URL of the origin. - :type content_paths: list[str] + :vartype content_paths: list[str] """ _validation = { @@ -4604,62 +6776,139 @@ def __init__( content_paths: List[str], **kwargs ): + """ + :keyword content_paths: Required. The path to the content to be loaded. Path should be a + relative file URL of the origin. + :paramtype content_paths: list[str] + """ super(LoadParameters, self).__init__(**kwargs) self.content_paths = content_paths +class LogSpecification(msrest.serialization.Model): + """Log specification of operation. + + :ivar name: Name of log specification. + :vartype name: str + :ivar display_name: Display name of log specification. + :vartype display_name: str + :ivar blob_duration: Blob duration of specification. + :vartype blob_duration: str + :ivar log_filter_pattern: Pattern to filter based on name. + :vartype log_filter_pattern: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + 'log_filter_pattern': {'key': 'logFilterPattern', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + log_filter_pattern: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of log specification. + :paramtype name: str + :keyword display_name: Display name of log specification. + :paramtype display_name: str + :keyword blob_duration: Blob duration of specification. + :paramtype blob_duration: str + :keyword log_filter_pattern: Pattern to filter based on name. + :paramtype log_filter_pattern: str + """ + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + self.log_filter_pattern = log_filter_pattern + + class ManagedCertificate(Certificate): """Managed Certificate used for https. - :param subject: Subject name in the certificate. - :type subject: str - :param expiration_date: Certificate expiration date. - :type expiration_date: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the secret resource. Possible values include: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :vartype type: str or ~azure.mgmt.cdn.models.SecretType + :ivar subject: Subject name in the certificate. + :vartype subject: str + :ivar expiration_date: Certificate expiration date. + :vartype expiration_date: str """ + _validation = { + 'subject': {'readonly': True}, + 'expiration_date': {'readonly': True}, + } + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'subject': {'key': 'subject', 'type': 'str'}, 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, } def __init__( self, *, - subject: Optional[str] = None, - expiration_date: Optional[str] = None, - thumbprint: Optional[str] = None, + type: Optional[Union[str, "SecretType"]] = None, **kwargs ): - super(ManagedCertificate, self).__init__(subject=subject, expiration_date=expiration_date, thumbprint=thumbprint, **kwargs) + """ + :keyword type: The type of the secret resource. Possible values include: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :paramtype type: str or ~azure.mgmt.cdn.models.SecretType + """ + super(ManagedCertificate, self).__init__(type=type, **kwargs) class ManagedCertificateParameters(SecretParameters): """Managed Certificate used for https. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the Secret to create.Constant filled by server. Possible - values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate". - :type type: str or ~azure.mgmt.cdn.models.SecretType + :ivar type: Required. The type of the secret resource.Constant filled by server. Possible + values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate", + "AzureFirstPartyManagedCertificate". + :vartype type: str or ~azure.mgmt.cdn.models.SecretType + :ivar subject: Subject name in the certificate. + :vartype subject: str + :ivar expiration_date: Certificate expiration date. + :vartype expiration_date: str """ _validation = { 'type': {'required': True}, + 'subject': {'readonly': True}, + 'expiration_date': {'readonly': True}, } _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, } def __init__( self, **kwargs ): + """ + """ super(ManagedCertificateParameters, self).__init__(**kwargs) self.type = 'ManagedCertificate' # type: str + self.subject = None + self.expiration_date = None class ManagedRuleDefinition(msrest.serialization.Model): @@ -4687,6 +6936,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedRuleDefinition, self).__init__(**kwargs) self.rule_id = None self.description = None @@ -4721,6 +6972,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedRuleGroupDefinition, self).__init__(**kwargs) self.rule_group_name = None self.description = None @@ -4732,12 +6985,12 @@ 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 within the rule set to + :ivar rule_group_name: Required. Describes the managed rule group within the rule set to override. - :type rule_group_name: str - :param rules: List of rules that will be disabled. If none specified, all rules in the group + :vartype rule_group_name: str + :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.cdn.models.ManagedRuleOverride] + :vartype rules: list[~azure.mgmt.cdn.models.ManagedRuleOverride] """ _validation = { @@ -4756,6 +7009,14 @@ def __init__( rules: Optional[List["ManagedRuleOverride"]] = None, **kwargs ): + """ + :keyword rule_group_name: Required. Describes the managed rule group within the rule set to + override. + :paramtype rule_group_name: str + :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.cdn.models.ManagedRuleOverride] + """ super(ManagedRuleGroupOverride, self).__init__(**kwargs) self.rule_group_name = rule_group_name self.rules = rules @@ -4766,14 +7027,14 @@ 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.cdn.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.cdn.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.cdn.models.ActionType + :vartype action: str or ~azure.mgmt.cdn.models.ActionType """ _validation = { @@ -4794,6 +7055,16 @@ def __init__( action: Optional[Union[str, "ActionType"]] = 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.cdn.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.cdn.models.ActionType + """ super(ManagedRuleOverride, self).__init__(**kwargs) self.rule_id = rule_id self.enabled_state = enabled_state @@ -4805,15 +7076,15 @@ 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 anomaly_score: Verizon only : If the rule set supports anomaly detection mode, this + :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 anomaly_score: Verizon only : If the rule set supports anomaly detection mode, this describes the threshold for blocking requests. - :type anomaly_score: int - :param rule_group_overrides: Defines the rule overrides to apply to the rule set. - :type rule_group_overrides: list[~azure.mgmt.cdn.models.ManagedRuleGroupOverride] + :vartype anomaly_score: int + :ivar rule_group_overrides: Defines the rule overrides to apply to the rule set. + :vartype rule_group_overrides: list[~azure.mgmt.cdn.models.ManagedRuleGroupOverride] """ _validation = { @@ -4838,6 +7109,17 @@ 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 anomaly_score: Verizon only : If the rule set supports anomaly detection mode, this + describes the threshold for blocking requests. + :paramtype anomaly_score: int + :keyword rule_group_overrides: Defines the rule overrides to apply to the rule set. + :paramtype rule_group_overrides: list[~azure.mgmt.cdn.models.ManagedRuleGroupOverride] + """ super(ManagedRuleSet, self).__init__(**kwargs) self.rule_set_type = rule_set_type self.rule_set_version = rule_set_version @@ -4858,9 +7140,9 @@ class ManagedRuleSetDefinition(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param sku: The pricing tier (defines a CDN provider, feature list and rate) of the + :ivar sku: The pricing tier (defines a CDN provider, feature list and rate) of the CdnWebApplicationFirewallPolicy. - :type sku: ~azure.mgmt.cdn.models.Sku + :vartype sku: ~azure.mgmt.cdn.models.Sku :ivar provisioning_state: Provisioning state of the managed rule set. :vartype provisioning_state: str :ivar rule_set_type: Type of the managed rule set. @@ -4900,6 +7182,11 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword sku: The pricing tier (defines a CDN provider, feature list and rate) of the + CdnWebApplicationFirewallPolicy. + :paramtype sku: ~azure.mgmt.cdn.models.Sku + """ super(ManagedRuleSetDefinition, self).__init__(**kwargs) self.sku = sku self.provisioning_state = None @@ -4915,8 +7202,8 @@ class ManagedRuleSetDefinitionList(msrest.serialization.Model): :ivar value: List of managed rule set definitions. :vartype value: list[~azure.mgmt.cdn.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 = { @@ -4934,6 +7221,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 @@ -4942,8 +7233,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.cdn.models.ManagedRuleSet] + :ivar managed_rule_sets: List of rule sets. + :vartype managed_rule_sets: list[~azure.mgmt.cdn.models.ManagedRuleSet] """ _attribute_map = { @@ -4956,33 +7247,89 @@ 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.cdn.models.ManagedRuleSet] + """ super(ManagedRuleSetList, self).__init__(**kwargs) self.managed_rule_sets = managed_rule_sets +class ManagedServiceIdentity(msrest.serialization.Model): + """Managed service identity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Type of managed service identity. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :vartype type: str or ~azure.mgmt.cdn.models.ManagedServiceIdentityType + :ivar tenant_id: Tenant of managed service identity. + :vartype tenant_id: str + :ivar principal_id: Principal Id of managed service identity. + :vartype principal_id: str + :ivar user_assigned_identities: The list of user assigned identities associated with the + resource. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.cdn.models.UserAssignedIdentity] + """ + + _validation = { + 'tenant_id': {'readonly': True}, + 'principal_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + """ + :keyword type: Type of managed service identity. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.cdn.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The list of user assigned identities associated with the + resource. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + :paramtype user_assigned_identities: dict[str, ~azure.mgmt.cdn.models.UserAssignedIdentity] + """ + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.type = type + self.tenant_id = None + self.principal_id = None + self.user_assigned_identities = user_assigned_identities + + class MatchCondition(msrest.serialization.Model): """Define match conditions. All required parameters must be populated in order to send to Azure. - :param match_variable: Required. Match variable to compare against. Possible values include: - "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", - "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", - "Cookies", "IsDevice", "RemoteAddr", "SocketAddr". - :type match_variable: str or ~azure.mgmt.cdn.models.MatchVariable - :param selector: Selector can used to match a specific key for QueryString, Cookies, + :ivar match_variable: Required. Match variable to compare against. Possible values include: + "RemoteAddr", "SocketAddr", "RequestMethod", "RequestHeader", "RequestUri", "QueryString", + "RequestBody", "Cookies", "PostArgs". + :vartype match_variable: str or ~azure.mgmt.cdn.models.WafMatchVariable + :ivar selector: Selector can used to match a specific key for QueryString, Cookies, RequestHeader or PostArgs. - :type selector: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :vartype selector: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual", "BeginsWith", "EndsWith", "RegEx". - :type operator: str or ~azure.mgmt.cdn.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.cdn.models.TransformType] + :vartype operator: str or ~azure.mgmt.cdn.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.cdn.models.TransformType] """ _validation = { @@ -5003,7 +7350,7 @@ class MatchCondition(msrest.serialization.Model): def __init__( self, *, - match_variable: Union[str, "MatchVariable"], + match_variable: Union[str, "WafMatchVariable"], operator: Union[str, "Operator"], match_value: List[str], selector: Optional[str] = None, @@ -5011,6 +7358,25 @@ def __init__( transforms: Optional[List[Union[str, "TransformType"]]] = None, **kwargs ): + """ + :keyword match_variable: Required. Match variable to compare against. Possible values include: + "RemoteAddr", "SocketAddr", "RequestMethod", "RequestHeader", "RequestUri", "QueryString", + "RequestBody", "Cookies", "PostArgs". + :paramtype match_variable: str or ~azure.mgmt.cdn.models.WafMatchVariable + :keyword selector: Selector can used to match a specific key for QueryString, Cookies, + RequestHeader or PostArgs. + :paramtype selector: str + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", "GreaterThan", "LessThanOrEqual", + "GreaterThanOrEqual", "BeginsWith", "EndsWith", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.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.cdn.models.TransformType] + """ super(MatchCondition, self).__init__(**kwargs) self.match_variable = match_variable self.selector = selector @@ -5020,17 +7386,146 @@ def __init__( self.transforms = transforms +class MetricAvailability(msrest.serialization.Model): + """Retention policy of a resource metric. + + :ivar time_grain: + :vartype time_grain: str + :ivar blob_duration: + :vartype blob_duration: str + """ + + _attribute_map = { + 'time_grain': {'key': 'timeGrain', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + time_grain: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + """ + :keyword time_grain: + :paramtype time_grain: str + :keyword blob_duration: + :paramtype blob_duration: str + """ + super(MetricAvailability, self).__init__(**kwargs) + self.time_grain = time_grain + self.blob_duration = blob_duration + + +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. + + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :vartype unit: str + :ivar aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :vartype aggregation_type: str + :ivar availabilities: Retention policies of a resource metric. + :vartype availabilities: list[~azure.mgmt.cdn.models.MetricAvailability] + :ivar supported_time_grain_types: The supported time grain types for the metrics. + :vartype supported_time_grain_types: list[str] + :ivar dimensions: The dimensions of metric. + :vartype dimensions: list[~azure.mgmt.cdn.models.DimensionProperties] + :ivar fill_gap_with_zero: Property to specify whether to fill gap with zero. + :vartype fill_gap_with_zero: bool + :ivar metric_filter_pattern: Pattern to filter based on name. + :vartype metric_filter_pattern: str + :ivar is_internal: Property to specify metric is internal or not. + :vartype is_internal: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'availabilities': {'key': 'availabilities', 'type': '[MetricAvailability]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'metric_filter_pattern': {'key': 'metricFilterPattern', 'type': 'str'}, + 'is_internal': {'key': 'isInternal', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + availabilities: Optional[List["MetricAvailability"]] = None, + supported_time_grain_types: Optional[List[str]] = None, + dimensions: Optional[List["DimensionProperties"]] = None, + fill_gap_with_zero: Optional[bool] = None, + metric_filter_pattern: Optional[str] = None, + is_internal: Optional[bool] = None, + **kwargs + ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :paramtype unit: str + :keyword aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :paramtype aggregation_type: str + :keyword availabilities: Retention policies of a resource metric. + :paramtype availabilities: list[~azure.mgmt.cdn.models.MetricAvailability] + :keyword supported_time_grain_types: The supported time grain types for the metrics. + :paramtype supported_time_grain_types: list[str] + :keyword dimensions: The dimensions of metric. + :paramtype dimensions: list[~azure.mgmt.cdn.models.DimensionProperties] + :keyword fill_gap_with_zero: Property to specify whether to fill gap with zero. + :paramtype fill_gap_with_zero: bool + :keyword metric_filter_pattern: Pattern to filter based on name. + :paramtype metric_filter_pattern: str + :keyword is_internal: Property to specify metric is internal or not. + :paramtype is_internal: bool + """ + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.availabilities = availabilities + self.supported_time_grain_types = supported_time_grain_types + self.dimensions = dimensions + self.fill_gap_with_zero = fill_gap_with_zero + self.metric_filter_pattern = metric_filter_pattern + self.is_internal = is_internal + + class MetricsResponse(msrest.serialization.Model): """Metrics Response. - :param date_time_begin: - :type date_time_begin: ~datetime.datetime - :param date_time_end: - :type date_time_end: ~datetime.datetime - :param granularity: Possible values include: "PT5M", "PT1H", "P1D". - :type granularity: str or ~azure.mgmt.cdn.models.MetricsResponseGranularity - :param series: - :type series: list[~azure.mgmt.cdn.models.MetricsResponseSeriesItem] + :ivar date_time_begin: + :vartype date_time_begin: ~datetime.datetime + :ivar date_time_end: + :vartype date_time_end: ~datetime.datetime + :ivar granularity: Possible values include: "PT5M", "PT1H", "P1D". + :vartype granularity: str or ~azure.mgmt.cdn.models.MetricsResponseGranularity + :ivar series: + :vartype series: list[~azure.mgmt.cdn.models.MetricsResponseSeriesItem] """ _attribute_map = { @@ -5049,6 +7544,16 @@ def __init__( series: Optional[List["MetricsResponseSeriesItem"]] = None, **kwargs ): + """ + :keyword date_time_begin: + :paramtype date_time_begin: ~datetime.datetime + :keyword date_time_end: + :paramtype date_time_end: ~datetime.datetime + :keyword granularity: Possible values include: "PT5M", "PT1H", "P1D". + :paramtype granularity: str or ~azure.mgmt.cdn.models.MetricsResponseGranularity + :keyword series: + :paramtype series: list[~azure.mgmt.cdn.models.MetricsResponseSeriesItem] + """ super(MetricsResponse, self).__init__(**kwargs) self.date_time_begin = date_time_begin self.date_time_end = date_time_end @@ -5059,14 +7564,14 @@ def __init__( class MetricsResponseSeriesItem(msrest.serialization.Model): """MetricsResponseSeriesItem. - :param metric: - :type metric: str - :param unit: Possible values include: "count", "bytes", "bitsPerSecond". - :type unit: str or ~azure.mgmt.cdn.models.MetricsResponseSeriesItemUnit - :param groups: - :type groups: list[~azure.mgmt.cdn.models.MetricsResponseSeriesPropertiesItemsItem] - :param data: - :type data: + :ivar metric: + :vartype metric: str + :ivar unit: Possible values include: "count", "bytes", "bitsPerSecond", "milliSeconds". + :vartype unit: str or ~azure.mgmt.cdn.models.MetricsResponseSeriesItemUnit + :ivar groups: + :vartype groups: list[~azure.mgmt.cdn.models.MetricsResponseSeriesPropertiesItemsItem] + :ivar data: + :vartype data: list[~azure.mgmt.cdn.models.Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems] """ @@ -5086,6 +7591,17 @@ def __init__( data: Optional[List["Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems"]] = None, **kwargs ): + """ + :keyword metric: + :paramtype metric: str + :keyword unit: Possible values include: "count", "bytes", "bitsPerSecond", "milliSeconds". + :paramtype unit: str or ~azure.mgmt.cdn.models.MetricsResponseSeriesItemUnit + :keyword groups: + :paramtype groups: list[~azure.mgmt.cdn.models.MetricsResponseSeriesPropertiesItemsItem] + :keyword data: + :paramtype data: + list[~azure.mgmt.cdn.models.Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems] + """ super(MetricsResponseSeriesItem, self).__init__(**kwargs) self.metric = metric self.unit = unit @@ -5096,10 +7612,10 @@ def __init__( class MetricsResponseSeriesPropertiesItemsItem(msrest.serialization.Model): """MetricsResponseSeriesPropertiesItemsItem. - :param name: - :type name: str - :param value: - :type value: str + :ivar name: + :vartype name: str + :ivar value: + :vartype value: str """ _attribute_map = { @@ -5114,6 +7630,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword value: + :paramtype value: str + """ super(MetricsResponseSeriesPropertiesItemsItem, self).__init__(**kwargs) self.name = name self.value = value @@ -5126,28 +7648,51 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.cdn.models.OperationDisplay + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.cdn.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.cdn.models.ServiceSpecification """ _validation = { 'name': {'readonly': True}, + 'origin': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } def __init__( self, *, + is_data_action: Optional[bool] = None, display: Optional["OperationDisplay"] = None, + service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.cdn.models.OperationDisplay + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.cdn.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = None + self.is_data_action = is_data_action self.display = display + self.origin = None + self.service_specification = service_specification class OperationDisplay(msrest.serialization.Model): @@ -5161,45 +7706,46 @@ class OperationDisplay(msrest.serialization.Model): :vartype resource: str :ivar operation: Operation type: Read, write, delete, etc. :vartype operation: str + :ivar description: Description of operation. + :vartype description: str """ _validation = { 'provider': {'readonly': True}, 'resource': {'readonly': True}, 'operation': {'readonly': True}, + 'description': {'readonly': True}, } _attribute_map = { 'provider': {'key': 'provider', 'type': 'str'}, 'resource': {'key': 'resource', 'type': 'str'}, 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, } def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None self.operation = None + self.description = None class OperationsListResult(msrest.serialization.Model): """Result of the request to list CDN operations. It contains a list of operations 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 CDN operations supported by the CDN resource provider. :vartype value: list[~azure.mgmt.cdn.models.Operation] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ - _validation = { - 'value': {'readonly': True}, - } - _attribute_map = { 'value': {'key': 'value', 'type': '[Operation]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, @@ -5208,15 +7754,22 @@ class OperationsListResult(msrest.serialization.Model): def __init__( self, *, + value: Optional[List["Operation"]] = None, next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of CDN operations supported by the CDN resource provider. + :paramtype value: list[~azure.mgmt.cdn.models.Operation] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ super(OperationsListResult, self).__init__(**kwargs) - self.value = None + self.value = value self.next_link = next_link -class Origin(Resource): +class Origin(ProxyResource): """CDN origin is the source of the content being delivered via CDN. When the edge nodes represented by an endpoint do not have the requested content cached, they attempt to fetch it from one or more of the configured origins. Variables are only populated by the server, and will be ignored when sending a request. @@ -5229,39 +7782,39 @@ class Origin(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + :ivar host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you + :vartype host_name: str + :ivar http_port: The value of the HTTP port. Must be between 1 and 65535. + :vartype http_port: int + :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. + :vartype https_port: int + :ivar origin_host_header: The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities + :vartype origin_host_header: str + :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 + :vartype priority: int + :ivar weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. - :type weight: int - :param enabled: Origin is enabled for load balancing or not. - :type enabled: bool - :param private_link_alias: The Alias of the Private Link resource. Populating this optional + :vartype weight: int + :ivar enabled: Origin is enabled for load balancing or not. + :vartype enabled: bool + :ivar private_link_alias: The Alias of the Private Link resource. Populating this optional field indicates that this origin 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 - :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 + :vartype private_link_location: str + :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 resource_state: Resource status of the origin. Possible values include: "Creating", "Active", "Deleting". :vartype resource_state: str or ~azure.mgmt.cdn.models.OriginResourceState @@ -5323,6 +7876,41 @@ def __init__( private_link_approval_message: Optional[str] = None, **kwargs ): + """ + :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + are supported.This should be unique across all origins in an endpoint. + :paramtype host_name: str + :keyword http_port: The value of the HTTP port. Must be between 1 and 65535. + :paramtype http_port: int + :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. + :paramtype https_port: int + :keyword origin_host_header: The host header value sent to the origin with each request. If you + leave this blank, the request hostname determines this value. Azure CDN origins, such as Web + Apps, Blob Storage, and Cloud Services require this host header value to match the origin + hostname by default. This overrides the host header defined at Endpoint. + :paramtype origin_host_header: str + :keyword priority: Priority of origin in given origin group for load balancing. Higher + priorities will not be used for load balancing if any lower priority origin is healthy.Must be + between 1 and 5. + :paramtype priority: int + :keyword weight: Weight of the origin in given origin group for load balancing. Must be between + 1 and 1000. + :paramtype weight: int + :keyword enabled: Origin is enabled for load balancing or not. + :paramtype enabled: bool + :keyword private_link_alias: The Alias of the Private Link resource. Populating this optional + field indicates that this origin 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 + """ super(Origin, self).__init__(**kwargs) self.host_name = host_name self.http_port = http_port @@ -5340,7 +7928,7 @@ def __init__( self.private_endpoint_status = None -class OriginGroup(Resource): +class OriginGroup(ProxyResource): """Origin group comprising of origins is used for load balancing to origins when the content cannot be served from CDN. Variables are only populated by the server, and will be ignored when sending a request. @@ -5353,19 +7941,19 @@ class OriginGroup(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param health_probe_settings: Health probe settings to the origin that is used to determine the + :ivar health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param origins: The source of the content being delivered via CDN within given origin group. - :type origins: list[~azure.mgmt.cdn.models.ResourceReference] - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift + :vartype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :ivar origins: The source of the content being delivered via CDN within given origin group. + :vartype origins: list[~azure.mgmt.cdn.models.ResourceReference] + :ivar traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_origin_error_detection_settings: The JSON object that contains the + :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :ivar response_based_origin_error_detection_settings: The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. - :type response_based_origin_error_detection_settings: + :vartype response_based_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters :ivar resource_state: Resource status of the origin group. Possible values include: "Creating", "Active", "Deleting". @@ -5406,6 +7994,22 @@ def __init__( response_based_origin_error_detection_settings: Optional["ResponseBasedOriginErrorDetectionParameters"] = None, **kwargs ): + """ + :keyword health_probe_settings: Health probe settings to the origin that is used to determine + the health of the origin. + :paramtype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :keyword origins: The source of the content being delivered via CDN within given origin group. + :paramtype origins: list[~azure.mgmt.cdn.models.ResourceReference] + :keyword traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to + shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new + endpoint is added. Default is 10 mins. This property is currently not supported. + :paramtype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :keyword response_based_origin_error_detection_settings: The JSON object that contains the + properties to determine origin health using real requests/responses. This property is currently + not supported. + :paramtype response_based_origin_error_detection_settings: + ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters + """ super(OriginGroup, self).__init__(**kwargs) self.health_probe_settings = health_probe_settings self.origins = origins @@ -5422,8 +8026,8 @@ class OriginGroupListResult(msrest.serialization.Model): :ivar value: List of CDN origin groups within an endpoint. :vartype value: list[~azure.mgmt.cdn.models.OriginGroup] - :param next_link: URL to get the next set of origin objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of origin objects if there are any. + :vartype next_link: str """ _validation = { @@ -5441,22 +8045,63 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of origin objects if there are any. + :paramtype next_link: str + """ super(OriginGroupListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link +class OriginGroupOverride(msrest.serialization.Model): + """Defines the parameters for the origin group override configuration. + + :ivar origin_group: defines the OriginGroup that would override the DefaultOriginGroup on + route. + :vartype origin_group: ~azure.mgmt.cdn.models.ResourceReference + :ivar forwarding_protocol: Protocol this rule will use when forwarding traffic to backends. + Possible values include: "HttpOnly", "HttpsOnly", "MatchRequest". + :vartype forwarding_protocol: str or ~azure.mgmt.cdn.models.ForwardingProtocol + """ + + _attribute_map = { + 'origin_group': {'key': 'originGroup', 'type': 'ResourceReference'}, + 'forwarding_protocol': {'key': 'forwardingProtocol', 'type': 'str'}, + } + + def __init__( + self, + *, + origin_group: Optional["ResourceReference"] = None, + forwarding_protocol: Optional[Union[str, "ForwardingProtocol"]] = None, + **kwargs + ): + """ + :keyword origin_group: defines the OriginGroup that would override the DefaultOriginGroup on + route. + :paramtype origin_group: ~azure.mgmt.cdn.models.ResourceReference + :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.cdn.models.ForwardingProtocol + """ + super(OriginGroupOverride, self).__init__(**kwargs) + self.origin_group = origin_group + self.forwarding_protocol = forwarding_protocol + + class OriginGroupOverrideAction(DeliveryRuleAction): """Defines the origin group override action for the delivery rule. All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the action for the delivery rule.Constant filled by server. + :ivar name: Required. The name of the action for the delivery rule.Constant filled by server. Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.OriginGroupOverrideActionParameters + "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", + "RouteConfigurationOverride". + :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum + :ivar parameters: Required. Defines the parameters for the action. + :vartype parameters: ~azure.mgmt.cdn.models.OriginGroupOverrideActionParameters """ _validation = { @@ -5475,6 +8120,10 @@ def __init__( parameters: "OriginGroupOverrideActionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the action. + :paramtype parameters: ~azure.mgmt.cdn.models.OriginGroupOverrideActionParameters + """ super(OriginGroupOverrideAction, self).__init__(**kwargs) self.name = 'OriginGroupOverride' # type: str self.parameters = parameters @@ -5487,25 +8136,24 @@ class OriginGroupOverrideActionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleOriginGroupOverrideActionParameters". - :vartype odata_type: str - :param origin_group: Required. defines the OriginGroup that would override the + :ivar type_name: Has constant value: "DeliveryRuleOriginGroupOverrideActionParameters". + :vartype type_name: str + :ivar origin_group: Required. defines the OriginGroup that would override the DefaultOriginGroup. - :type origin_group: ~azure.mgmt.cdn.models.ResourceReference + :vartype origin_group: ~azure.mgmt.cdn.models.ResourceReference """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'origin_group': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'origin_group': {'key': 'originGroup', 'type': 'ResourceReference'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleOriginGroupOverrideActionParameters" + type_name = "DeliveryRuleOriginGroupOverrideActionParameters" def __init__( self, @@ -5513,6 +8161,11 @@ def __init__( origin_group: "ResourceReference", **kwargs ): + """ + :keyword origin_group: Required. defines the OriginGroup that would override the + DefaultOriginGroup. + :paramtype origin_group: ~azure.mgmt.cdn.models.ResourceReference + """ super(OriginGroupOverrideActionParameters, self).__init__(**kwargs) self.origin_group = origin_group @@ -5520,19 +8173,19 @@ def __init__( class OriginGroupUpdatePropertiesParameters(msrest.serialization.Model): """The JSON object that contains the properties of the origin group. - :param health_probe_settings: Health probe settings to the origin that is used to determine the + :ivar health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param origins: The source of the content being delivered via CDN within given origin group. - :type origins: list[~azure.mgmt.cdn.models.ResourceReference] - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift + :vartype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :ivar origins: The source of the content being delivered via CDN within given origin group. + :vartype origins: list[~azure.mgmt.cdn.models.ResourceReference] + :ivar traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_origin_error_detection_settings: The JSON object that contains the + :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :ivar response_based_origin_error_detection_settings: The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. - :type response_based_origin_error_detection_settings: + :vartype response_based_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters """ @@ -5556,6 +8209,22 @@ def __init__( response_based_origin_error_detection_settings: Optional["ResponseBasedOriginErrorDetectionParameters"] = None, **kwargs ): + """ + :keyword health_probe_settings: Health probe settings to the origin that is used to determine + the health of the origin. + :paramtype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :keyword origins: The source of the content being delivered via CDN within given origin group. + :paramtype origins: list[~azure.mgmt.cdn.models.ResourceReference] + :keyword traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to + shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new + endpoint is added. Default is 10 mins. This property is currently not supported. + :paramtype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :keyword response_based_origin_error_detection_settings: The JSON object that contains the + properties to determine origin health using real requests/responses. This property is currently + not supported. + :paramtype response_based_origin_error_detection_settings: + ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters + """ super(OriginGroupUpdatePropertiesParameters, self).__init__(**kwargs) self.health_probe_settings = health_probe_settings self.origins = origins @@ -5568,19 +8237,19 @@ class OriginGroupProperties(OriginGroupUpdatePropertiesParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param health_probe_settings: Health probe settings to the origin that is used to determine the + :ivar health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param origins: The source of the content being delivered via CDN within given origin group. - :type origins: list[~azure.mgmt.cdn.models.ResourceReference] - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift + :vartype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :ivar origins: The source of the content being delivered via CDN within given origin group. + :vartype origins: list[~azure.mgmt.cdn.models.ResourceReference] + :ivar traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_origin_error_detection_settings: The JSON object that contains the + :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :ivar response_based_origin_error_detection_settings: The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. - :type response_based_origin_error_detection_settings: + :vartype response_based_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters :ivar resource_state: Resource status of the origin group. Possible values include: "Creating", "Active", "Deleting". @@ -5613,6 +8282,22 @@ def __init__( response_based_origin_error_detection_settings: Optional["ResponseBasedOriginErrorDetectionParameters"] = None, **kwargs ): + """ + :keyword health_probe_settings: Health probe settings to the origin that is used to determine + the health of the origin. + :paramtype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :keyword origins: The source of the content being delivered via CDN within given origin group. + :paramtype origins: list[~azure.mgmt.cdn.models.ResourceReference] + :keyword traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to + shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new + endpoint is added. Default is 10 mins. This property is currently not supported. + :paramtype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :keyword response_based_origin_error_detection_settings: The JSON object that contains the + properties to determine origin health using real requests/responses. This property is currently + not supported. + :paramtype response_based_origin_error_detection_settings: + ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters + """ super(OriginGroupProperties, self).__init__(health_probe_settings=health_probe_settings, origins=origins, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes=traffic_restoration_time_to_healed_or_new_endpoints_in_minutes, response_based_origin_error_detection_settings=response_based_origin_error_detection_settings, **kwargs) self.resource_state = None self.provisioning_state = None @@ -5621,19 +8306,19 @@ def __init__( class OriginGroupUpdateParameters(msrest.serialization.Model): """Origin group properties needed for origin group creation or update. - :param health_probe_settings: Health probe settings to the origin that is used to determine the + :ivar health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. - :type health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters - :param origins: The source of the content being delivered via CDN within given origin group. - :type origins: list[~azure.mgmt.cdn.models.ResourceReference] - :param traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift + :vartype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :ivar origins: The source of the content being delivered via CDN within given origin group. + :vartype origins: list[~azure.mgmt.cdn.models.ResourceReference] + :ivar traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. - :type traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int - :param response_based_origin_error_detection_settings: The JSON object that contains the + :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :ivar response_based_origin_error_detection_settings: The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. - :type response_based_origin_error_detection_settings: + :vartype response_based_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters """ @@ -5657,6 +8342,22 @@ def __init__( response_based_origin_error_detection_settings: Optional["ResponseBasedOriginErrorDetectionParameters"] = None, **kwargs ): + """ + :keyword health_probe_settings: Health probe settings to the origin that is used to determine + the health of the origin. + :paramtype health_probe_settings: ~azure.mgmt.cdn.models.HealthProbeParameters + :keyword origins: The source of the content being delivered via CDN within given origin group. + :paramtype origins: list[~azure.mgmt.cdn.models.ResourceReference] + :keyword traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Time in minutes to + shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new + endpoint is added. Default is 10 mins. This property is currently not supported. + :paramtype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int + :keyword response_based_origin_error_detection_settings: The JSON object that contains the + properties to determine origin health using real requests/responses. This property is currently + not supported. + :paramtype response_based_origin_error_detection_settings: + ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters + """ super(OriginGroupUpdateParameters, self).__init__(**kwargs) self.health_probe_settings = health_probe_settings self.origins = origins @@ -5671,8 +8372,8 @@ class OriginListResult(msrest.serialization.Model): :ivar value: List of CDN origins within an endpoint. :vartype value: list[~azure.mgmt.cdn.models.Origin] - :param next_link: URL to get the next set of origin objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of origin objects if there are any. + :vartype next_link: str """ _validation = { @@ -5690,6 +8391,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of origin objects if there are any. + :paramtype next_link: str + """ super(OriginListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -5698,39 +8403,39 @@ def __init__( class OriginUpdatePropertiesParameters(msrest.serialization.Model): """The JSON object that contains the properties of the origin. - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + :ivar host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you + :vartype host_name: str + :ivar http_port: The value of the HTTP port. Must be between 1 and 65535. + :vartype http_port: int + :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. + :vartype https_port: int + :ivar origin_host_header: The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities + :vartype origin_host_header: str + :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 + :vartype priority: int + :ivar weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. - :type weight: int - :param enabled: Origin is enabled for load balancing or not. - :type enabled: bool - :param private_link_alias: The Alias of the Private Link resource. Populating this optional + :vartype weight: int + :ivar enabled: Origin is enabled for load balancing or not. + :vartype enabled: bool + :ivar private_link_alias: The Alias of the Private Link resource. Populating this optional field indicates that this origin 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 - :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 + :vartype private_link_location: str + :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 """ _validation = { @@ -5770,6 +8475,41 @@ def __init__( private_link_approval_message: Optional[str] = None, **kwargs ): + """ + :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + are supported.This should be unique across all origins in an endpoint. + :paramtype host_name: str + :keyword http_port: The value of the HTTP port. Must be between 1 and 65535. + :paramtype http_port: int + :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. + :paramtype https_port: int + :keyword origin_host_header: The host header value sent to the origin with each request. If you + leave this blank, the request hostname determines this value. Azure CDN origins, such as Web + Apps, Blob Storage, and Cloud Services require this host header value to match the origin + hostname by default. This overrides the host header defined at Endpoint. + :paramtype origin_host_header: str + :keyword priority: Priority of origin in given origin group for load balancing. Higher + priorities will not be used for load balancing if any lower priority origin is healthy.Must be + between 1 and 5. + :paramtype priority: int + :keyword weight: Weight of the origin in given origin group for load balancing. Must be between + 1 and 1000. + :paramtype weight: int + :keyword enabled: Origin is enabled for load balancing or not. + :paramtype enabled: bool + :keyword private_link_alias: The Alias of the Private Link resource. Populating this optional + field indicates that this origin 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 + """ super(OriginUpdatePropertiesParameters, self).__init__(**kwargs) self.host_name = host_name self.http_port = http_port @@ -5789,39 +8529,39 @@ class OriginProperties(OriginUpdatePropertiesParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + :ivar host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you + :vartype host_name: str + :ivar http_port: The value of the HTTP port. Must be between 1 and 65535. + :vartype http_port: int + :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. + :vartype https_port: int + :ivar origin_host_header: The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities + :vartype origin_host_header: str + :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 + :vartype priority: int + :ivar weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. - :type weight: int - :param enabled: Origin is enabled for load balancing or not. - :type enabled: bool - :param private_link_alias: The Alias of the Private Link resource. Populating this optional + :vartype weight: int + :ivar enabled: Origin is enabled for load balancing or not. + :vartype enabled: bool + :ivar private_link_alias: The Alias of the Private Link resource. Populating this optional field indicates that this origin 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 - :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 + :vartype private_link_location: str + :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 resource_state: Resource status of the origin. Possible values include: "Creating", "Active", "Deleting". :vartype resource_state: str or ~azure.mgmt.cdn.models.OriginResourceState @@ -5875,6 +8615,41 @@ def __init__( private_link_approval_message: Optional[str] = None, **kwargs ): + """ + :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + are supported.This should be unique across all origins in an endpoint. + :paramtype host_name: str + :keyword http_port: The value of the HTTP port. Must be between 1 and 65535. + :paramtype http_port: int + :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. + :paramtype https_port: int + :keyword origin_host_header: The host header value sent to the origin with each request. If you + leave this blank, the request hostname determines this value. Azure CDN origins, such as Web + Apps, Blob Storage, and Cloud Services require this host header value to match the origin + hostname by default. This overrides the host header defined at Endpoint. + :paramtype origin_host_header: str + :keyword priority: Priority of origin in given origin group for load balancing. Higher + priorities will not be used for load balancing if any lower priority origin is healthy.Must be + between 1 and 5. + :paramtype priority: int + :keyword weight: Weight of the origin in given origin group for load balancing. Must be between + 1 and 1000. + :paramtype weight: int + :keyword enabled: Origin is enabled for load balancing or not. + :paramtype enabled: bool + :keyword private_link_alias: The Alias of the Private Link resource. Populating this optional + field indicates that this origin 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 + """ super(OriginProperties, self).__init__(host_name=host_name, http_port=http_port, https_port=https_port, origin_host_header=origin_host_header, priority=priority, weight=weight, enabled=enabled, private_link_alias=private_link_alias, private_link_resource_id=private_link_resource_id, private_link_location=private_link_location, private_link_approval_message=private_link_approval_message, **kwargs) self.resource_state = None self.provisioning_state = None @@ -5884,39 +8659,39 @@ def __init__( class OriginUpdateParameters(msrest.serialization.Model): """Origin properties needed for origin update. - :param host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + :ivar host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. - :type host_name: str - :param http_port: The value of the HTTP port. Must be between 1 and 65535. - :type http_port: int - :param https_port: The value of the HTTPS port. Must be between 1 and 65535. - :type https_port: int - :param origin_host_header: The host header value sent to the origin with each request. If you + :vartype host_name: str + :ivar http_port: The value of the HTTP port. Must be between 1 and 65535. + :vartype http_port: int + :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. + :vartype https_port: int + :ivar origin_host_header: The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. - :type origin_host_header: str - :param priority: Priority of origin in given origin group for load balancing. Higher priorities + :vartype origin_host_header: str + :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. - :type priority: int - :param weight: Weight of the origin in given origin group for load balancing. Must be between 1 + :vartype priority: int + :ivar weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. - :type weight: int - :param enabled: Origin is enabled for load balancing or not. - :type enabled: bool - :param private_link_alias: The Alias of the Private Link resource. Populating this optional + :vartype weight: int + :ivar enabled: Origin is enabled for load balancing or not. + :vartype enabled: bool + :ivar private_link_alias: The Alias of the Private Link resource. Populating this optional field indicates that this origin 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 - :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 + :vartype private_link_location: str + :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 """ _validation = { @@ -5956,6 +8731,41 @@ def __init__( private_link_approval_message: Optional[str] = None, **kwargs ): + """ + :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses + are supported.This should be unique across all origins in an endpoint. + :paramtype host_name: str + :keyword http_port: The value of the HTTP port. Must be between 1 and 65535. + :paramtype http_port: int + :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. + :paramtype https_port: int + :keyword origin_host_header: The host header value sent to the origin with each request. If you + leave this blank, the request hostname determines this value. Azure CDN origins, such as Web + Apps, Blob Storage, and Cloud Services require this host header value to match the origin + hostname by default. This overrides the host header defined at Endpoint. + :paramtype origin_host_header: str + :keyword priority: Priority of origin in given origin group for load balancing. Higher + priorities will not be used for load balancing if any lower priority origin is healthy.Must be + between 1 and 5. + :paramtype priority: int + :keyword weight: Weight of the origin in given origin group for load balancing. Must be between + 1 and 1000. + :paramtype weight: int + :keyword enabled: Origin is enabled for load balancing or not. + :paramtype enabled: bool + :keyword private_link_alias: The Alias of the Private Link resource. Populating this optional + field indicates that this origin 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 + """ super(OriginUpdateParameters, self).__init__(**kwargs) self.host_name = host_name self.http_port = http_port @@ -5973,22 +8783,23 @@ def __init__( class PolicySettings(msrest.serialization.Model): """Defines contents of a web application firewall global configuration. - :param enabled_state: describes if the policy is in enabled state or disabled state. Possible + :ivar enabled_state: describes if the policy is in enabled state or disabled state. Possible values include: "Disabled", "Enabled". - :type enabled_state: str or ~azure.mgmt.cdn.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.cdn.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.cdn.models.PolicyMode - :param default_redirect_url: If action type is redirect, this field represents the default + :vartype mode: str or ~azure.mgmt.cdn.models.PolicyMode + :ivar default_redirect_url: If action type is redirect, this field represents the default redirect URL for the client. - :type default_redirect_url: str - :param default_custom_block_response_status_code: If the action type is block, this field + :vartype default_redirect_url: str + :ivar default_custom_block_response_status_code: If the action type is block, this field defines the default customer overridable http response status code. Possible values include: 200, 403, 405, 406, 429. - :type default_custom_block_response_status_code: str or ~azure.mgmt.cdn.models.Enum46 - :param default_custom_block_response_body: If the action type is block, customer can override + :vartype default_custom_block_response_status_code: int or + ~azure.mgmt.cdn.models.PolicySettingsDefaultCustomBlockResponseStatusCode + :ivar default_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 default_custom_block_response_body: str + :vartype default_custom_block_response_body: str """ _validation = { @@ -6009,10 +8820,29 @@ def __init__( enabled_state: Optional[Union[str, "PolicyEnabledState"]] = None, mode: Optional[Union[str, "PolicyMode"]] = None, default_redirect_url: Optional[str] = None, - default_custom_block_response_status_code: Optional[Union[int, "Enum46"]] = None, + default_custom_block_response_status_code: Optional[Union[int, "PolicySettingsDefaultCustomBlockResponseStatusCode"]] = None, default_custom_block_response_body: Optional[str] = None, **kwargs ): + """ + :keyword enabled_state: describes if the policy is in enabled state or disabled state. Possible + values include: "Disabled", "Enabled". + :paramtype enabled_state: str or ~azure.mgmt.cdn.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.cdn.models.PolicyMode + :keyword default_redirect_url: If action type is redirect, this field represents the default + redirect URL for the client. + :paramtype default_redirect_url: str + :keyword default_custom_block_response_status_code: If the action type is block, this field + defines the default customer overridable http response status code. Possible values include: + 200, 403, 405, 406, 429. + :paramtype default_custom_block_response_status_code: int or + ~azure.mgmt.cdn.models.PolicySettingsDefaultCustomBlockResponseStatusCode + :keyword default_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 default_custom_block_response_body: str + """ super(PolicySettings, self).__init__(**kwargs) self.enabled_state = enabled_state self.mode = mode @@ -6028,30 +8858,29 @@ class PostArgsMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRulePostArgsConditionParameters". - :vartype odata_type: str - :param selector: Name of PostArg to be matched. - :type selector: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :ivar type_name: Has constant value: "DeliveryRulePostArgsConditionParameters". + :vartype type_name: str + :ivar selector: Name of PostArg to be matched. + :vartype selector: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.PostArgsOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :vartype operator: str or ~azure.mgmt.cdn.models.PostArgsOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'selector': {'key': 'selector', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, @@ -6059,7 +8888,7 @@ class PostArgsMatchConditionParameters(msrest.serialization.Model): 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRulePostArgsConditionParameters" + type_name = "DeliveryRulePostArgsConditionParameters" def __init__( self, @@ -6071,6 +8900,20 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword selector: Name of PostArg to be matched. + :paramtype selector: str + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.PostArgsOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(PostArgsMatchConditionParameters, self).__init__(**kwargs) self.selector = selector self.operator = operator @@ -6080,7 +8923,7 @@ def __init__( class Profile(TrackedResource): - """CDN profile is a logical grouping of endpoints that share the same settings, such as CDN provider and pricing tier. + """A profile is a logical grouping of endpoints that share the same settings. Variables are only populated by the server, and will be ignored when sending a request. @@ -6094,20 +8937,28 @@ class Profile(TrackedResource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Required. The pricing tier (defines a CDN provider, feature list and rate) of the - CDN profile. - :type sku: ~azure.mgmt.cdn.models.Sku + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Required. The pricing tier (defines Azure Front Door Standard or Premium or a CDN + provider, feature list and rate) of the profile. + :vartype sku: ~azure.mgmt.cdn.models.Sku + :ivar kind: Kind of the profile. Used by portal to differentiate traditional CDN profile and + new AFD profile. + :vartype kind: str :ivar resource_state: Resource status of the profile. Possible values include: "Creating", "Active", "Deleting", "Disabled". :vartype resource_state: str or ~azure.mgmt.cdn.models.ProfileResourceState + :ivar identity: Managed service identity. + :vartype identity: ~azure.mgmt.cdn.models.ManagedServiceIdentity :ivar provisioning_state: Provisioning status of the profile. :vartype provisioning_state: str - :ivar frontdoor_id: The Id of the frontdoor. - :vartype frontdoor_id: str + :ivar front_door_id: The Id of the frontdoor. + :vartype front_door_id: str + :ivar origin_response_timeout_seconds: Send and receive timeout on forwarding request to the + origin. When timeout is reached, the request fails and returns. + :vartype origin_response_timeout_seconds: int """ _validation = { @@ -6117,9 +8968,11 @@ class Profile(TrackedResource): 'system_data': {'readonly': True}, 'location': {'required': True}, 'sku': {'required': True}, + 'kind': {'readonly': True}, 'resource_state': {'readonly': True}, 'provisioning_state': {'readonly': True}, - 'frontdoor_id': {'readonly': True}, + 'front_door_id': {'readonly': True}, + 'origin_response_timeout_seconds': {'minimum': 16}, } _attribute_map = { @@ -6130,9 +8983,12 @@ class Profile(TrackedResource): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'Sku'}, + 'kind': {'key': 'kind', 'type': 'str'}, 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'identity': {'key': 'properties.identity', 'type': 'ManagedServiceIdentity'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'frontdoor_id': {'key': 'properties.frontdoorId', 'type': 'str'}, + 'front_door_id': {'key': 'properties.frontDoorId', 'type': 'str'}, + 'origin_response_timeout_seconds': {'key': 'properties.originResponseTimeoutSeconds', 'type': 'int'}, } def __init__( @@ -6141,13 +8997,32 @@ def __init__( location: str, sku: "Sku", tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + origin_response_timeout_seconds: Optional[int] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Required. The pricing tier (defines Azure Front Door Standard or Premium or a CDN + provider, feature list and rate) of the profile. + :paramtype sku: ~azure.mgmt.cdn.models.Sku + :keyword identity: Managed service identity. + :paramtype identity: ~azure.mgmt.cdn.models.ManagedServiceIdentity + :keyword origin_response_timeout_seconds: Send and receive timeout on forwarding request to the + origin. When timeout is reached, the request fails and returns. + :paramtype origin_response_timeout_seconds: int + """ super(Profile, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku + self.kind = None self.resource_state = None + self.identity = identity self.provisioning_state = None - self.frontdoor_id = None + self.front_door_id = None + self.origin_response_timeout_seconds = origin_response_timeout_seconds class ProfileListResult(msrest.serialization.Model): @@ -6157,8 +9032,8 @@ class ProfileListResult(msrest.serialization.Model): :ivar value: List of CDN profiles within a resource group. :vartype value: list[~azure.mgmt.cdn.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 = { @@ -6176,6 +9051,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(ProfileListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -6184,8 +9063,8 @@ def __init__( class ProfileUpdateParameters(msrest.serialization.Model): """Properties required to update a profile. - :param tags: A set of tags. Profile tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Profile tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -6198,54 +9077,22 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Profile tags. + :paramtype tags: dict[str, str] + """ super(ProfileUpdateParameters, self).__init__(**kwargs) self.tags = tags -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - 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 - :ivar system_data: Read only system data. - :vartype system_data: ~azure.mgmt.cdn.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - 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 + :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 = { @@ -6262,6 +9109,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 @@ -6273,35 +9125,34 @@ class QueryStringMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleQueryStringConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :ivar type_name: Has constant value: "DeliveryRuleQueryStringConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.QueryStringOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :vartype operator: str or ~azure.mgmt.cdn.models.QueryStringOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleQueryStringConditionParameters" + type_name = "DeliveryRuleQueryStringConditionParameters" def __init__( self, @@ -6312,6 +9163,18 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.QueryStringOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(QueryStringMatchConditionParameters, self).__init__(**kwargs) self.operator = operator self.negate_condition = negate_condition @@ -6322,12 +9185,12 @@ def __init__( class RankingsResponse(msrest.serialization.Model): """Rankings Response. - :param date_time_begin: - :type date_time_begin: ~datetime.datetime - :param date_time_end: - :type date_time_end: ~datetime.datetime - :param tables: - :type tables: list[~azure.mgmt.cdn.models.RankingsResponseTablesItem] + :ivar date_time_begin: + :vartype date_time_begin: ~datetime.datetime + :ivar date_time_end: + :vartype date_time_end: ~datetime.datetime + :ivar tables: + :vartype tables: list[~azure.mgmt.cdn.models.RankingsResponseTablesItem] """ _attribute_map = { @@ -6344,6 +9207,14 @@ def __init__( tables: Optional[List["RankingsResponseTablesItem"]] = None, **kwargs ): + """ + :keyword date_time_begin: + :paramtype date_time_begin: ~datetime.datetime + :keyword date_time_end: + :paramtype date_time_end: ~datetime.datetime + :keyword tables: + :paramtype tables: list[~azure.mgmt.cdn.models.RankingsResponseTablesItem] + """ super(RankingsResponse, self).__init__(**kwargs) self.date_time_begin = date_time_begin self.date_time_end = date_time_end @@ -6353,10 +9224,10 @@ def __init__( class RankingsResponseTablesItem(msrest.serialization.Model): """RankingsResponseTablesItem. - :param ranking: - :type ranking: str - :param data: - :type data: list[~azure.mgmt.cdn.models.RankingsResponseTablesPropertiesItemsItem] + :ivar ranking: + :vartype ranking: str + :ivar data: + :vartype data: list[~azure.mgmt.cdn.models.RankingsResponseTablesPropertiesItemsItem] """ _attribute_map = { @@ -6371,6 +9242,12 @@ def __init__( data: Optional[List["RankingsResponseTablesPropertiesItemsItem"]] = None, **kwargs ): + """ + :keyword ranking: + :paramtype ranking: str + :keyword data: + :paramtype data: list[~azure.mgmt.cdn.models.RankingsResponseTablesPropertiesItemsItem] + """ super(RankingsResponseTablesItem, self).__init__(**kwargs) self.ranking = ranking self.data = data @@ -6379,10 +9256,10 @@ def __init__( class RankingsResponseTablesPropertiesItemsItem(msrest.serialization.Model): """RankingsResponseTablesPropertiesItemsItem. - :param name: - :type name: str - :param metrics: - :type metrics: list[~azure.mgmt.cdn.models.RankingsResponseTablesPropertiesItemsMetricsItem] + :ivar name: + :vartype name: str + :ivar metrics: + :vartype metrics: list[~azure.mgmt.cdn.models.RankingsResponseTablesPropertiesItemsMetricsItem] """ _attribute_map = { @@ -6397,6 +9274,13 @@ def __init__( metrics: Optional[List["RankingsResponseTablesPropertiesItemsMetricsItem"]] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword metrics: + :paramtype metrics: + list[~azure.mgmt.cdn.models.RankingsResponseTablesPropertiesItemsMetricsItem] + """ super(RankingsResponseTablesPropertiesItemsItem, self).__init__(**kwargs) self.name = name self.metrics = metrics @@ -6405,12 +9289,12 @@ def __init__( class RankingsResponseTablesPropertiesItemsMetricsItem(msrest.serialization.Model): """RankingsResponseTablesPropertiesItemsMetricsItem. - :param metric: - :type metric: str - :param value: - :type value: long - :param percentage: - :type percentage: float + :ivar metric: + :vartype metric: str + :ivar value: + :vartype value: long + :ivar percentage: + :vartype percentage: float """ _attribute_map = { @@ -6427,6 +9311,14 @@ def __init__( percentage: Optional[float] = None, **kwargs ): + """ + :keyword metric: + :paramtype metric: str + :keyword value: + :paramtype value: long + :keyword percentage: + :paramtype percentage: float + """ super(RankingsResponseTablesPropertiesItemsMetricsItem, self).__init__(**kwargs) self.metric = metric self.value = value @@ -6438,24 +9330,24 @@ class RateLimitRule(CustomRule): All required parameters must be populated in order to send to Azure. - :param name: Required. Defines the name of the custom rule. - :type name: str - :param enabled_state: Describes if the custom rule is in enabled or disabled state. Defaults to + :ivar name: Required. Defines the name of the custom rule. + :vartype name: str + :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.cdn.models.CustomRuleEnabledState - :param priority: Required. Defines in what order this rule be evaluated in the overall list of + :vartype enabled_state: str or ~azure.mgmt.cdn.models.CustomRuleEnabledState + :ivar priority: Required. Defines in what order this rule be evaluated in the overall list of custom rules. - :type priority: int - :param match_conditions: Required. List of match conditions. - :type match_conditions: list[~azure.mgmt.cdn.models.MatchCondition] - :param action: Required. Describes what action to be applied when rule matches. Possible values + :vartype priority: int + :ivar match_conditions: Required. List of match conditions. + :vartype match_conditions: list[~azure.mgmt.cdn.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.cdn.models.ActionType - :param rate_limit_threshold: Required. Defines rate limit threshold. - :type rate_limit_threshold: int - :param rate_limit_duration_in_minutes: Required. Defines rate limit duration. Default is 1 + :vartype action: str or ~azure.mgmt.cdn.models.ActionType + :ivar rate_limit_threshold: Required. Defines rate limit threshold. + :vartype rate_limit_threshold: int + :ivar rate_limit_duration_in_minutes: Required. Defines rate limit duration. Default is 1 minute. - :type rate_limit_duration_in_minutes: int + :vartype rate_limit_duration_in_minutes: int """ _validation = { @@ -6489,6 +9381,26 @@ def __init__( enabled_state: Optional[Union[str, "CustomRuleEnabledState"]] = None, **kwargs ): + """ + :keyword name: Required. Defines the name of the custom rule. + :paramtype name: str + :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.cdn.models.CustomRuleEnabledState + :keyword priority: Required. Defines in what order this rule be evaluated in the overall list + of custom rules. + :paramtype priority: int + :keyword match_conditions: Required. List of match conditions. + :paramtype match_conditions: list[~azure.mgmt.cdn.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.cdn.models.ActionType + :keyword rate_limit_threshold: Required. Defines rate limit threshold. + :paramtype rate_limit_threshold: int + :keyword rate_limit_duration_in_minutes: Required. Defines rate limit duration. Default is 1 + minute. + :paramtype rate_limit_duration_in_minutes: int + """ super(RateLimitRule, self).__init__(name=name, enabled_state=enabled_state, priority=priority, match_conditions=match_conditions, action=action, **kwargs) self.rate_limit_threshold = rate_limit_threshold self.rate_limit_duration_in_minutes = rate_limit_duration_in_minutes @@ -6497,8 +9409,8 @@ def __init__( class RateLimitRuleList(msrest.serialization.Model): """Defines contents of rate limit rules. - :param rules: List of rules. - :type rules: list[~azure.mgmt.cdn.models.RateLimitRule] + :ivar rules: List of rules. + :vartype rules: list[~azure.mgmt.cdn.models.RateLimitRule] """ _attribute_map = { @@ -6511,6 +9423,10 @@ def __init__( rules: Optional[List["RateLimitRule"]] = None, **kwargs ): + """ + :keyword rules: List of rules. + :paramtype rules: list[~azure.mgmt.cdn.models.RateLimitRule] + """ super(RateLimitRuleList, self).__init__(**kwargs) self.rules = rules @@ -6522,36 +9438,35 @@ class RemoteAddressMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRemoteAddressConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :ivar type_name: Has constant value: "DeliveryRuleRemoteAddressConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "IPMatch", "GeoMatch". - :type operator: str or ~azure.mgmt.cdn.models.RemoteAddressOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: Match values to match against. The operator will apply to each value in + :vartype operator: str or ~azure.mgmt.cdn.models.RemoteAddressOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: 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 match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRemoteAddressConditionParameters" + type_name = "DeliveryRuleRemoteAddressConditionParameters" def __init__( self, @@ -6562,6 +9477,19 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "IPMatch", "GeoMatch". + :paramtype operator: str or ~azure.mgmt.cdn.models.RemoteAddressOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: 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 match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(RemoteAddressMatchConditionParameters, self).__init__(**kwargs) self.operator = operator self.negate_condition = negate_condition @@ -6576,35 +9504,34 @@ class RequestBodyMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestBodyConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :ivar type_name: Has constant value: "DeliveryRuleRequestBodyConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.RequestBodyOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :vartype operator: str or ~azure.mgmt.cdn.models.RequestBodyOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestBodyConditionParameters" + type_name = "DeliveryRuleRequestBodyConditionParameters" def __init__( self, @@ -6615,6 +9542,18 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.RequestBodyOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(RequestBodyMatchConditionParameters, self).__init__(**kwargs) self.operator = operator self.negate_condition = negate_condition @@ -6629,30 +9568,29 @@ class RequestHeaderMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestHeaderConditionParameters". - :vartype odata_type: str - :param selector: Name of Header to be matched. - :type selector: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :ivar type_name: Has constant value: "DeliveryRuleRequestHeaderConditionParameters". + :vartype type_name: str + :ivar selector: Name of Header to be matched. + :vartype selector: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.RequestHeaderOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :vartype operator: str or ~azure.mgmt.cdn.models.RequestHeaderOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'selector': {'key': 'selector', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, @@ -6660,7 +9598,7 @@ class RequestHeaderMatchConditionParameters(msrest.serialization.Model): 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestHeaderConditionParameters" + type_name = "DeliveryRuleRequestHeaderConditionParameters" def __init__( self, @@ -6672,6 +9610,20 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword selector: Name of Header to be matched. + :paramtype selector: str + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.RequestHeaderOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(RequestHeaderMatchConditionParameters, self).__init__(**kwargs) self.selector = selector self.operator = operator @@ -6687,43 +9639,59 @@ class RequestMethodMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestMethodConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Equal". - :type operator: str or ~azure.mgmt.cdn.models.RequestMethodOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str or + :ivar type_name: Has constant value: "DeliveryRuleRequestMethodConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Equal". + :vartype operator: str or ~azure.mgmt.cdn.models.RequestMethodOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str or ~azure.mgmt.cdn.models.RequestMethodMatchConditionParametersMatchValuesItem] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, + 'transforms': {'key': 'transforms', 'type': '[str]'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestMethodConditionParameters" + type_name = "DeliveryRuleRequestMethodConditionParameters" def __init__( self, *, operator: Union[str, "RequestMethodOperator"], negate_condition: Optional[bool] = None, + transforms: Optional[List[Union[str, "Transform"]]] = None, match_values: Optional[List[Union[str, "RequestMethodMatchConditionParametersMatchValuesItem"]]] = None, **kwargs ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: + "Equal". + :paramtype operator: str or ~azure.mgmt.cdn.models.RequestMethodOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str or + ~azure.mgmt.cdn.models.RequestMethodMatchConditionParametersMatchValuesItem] + """ super(RequestMethodMatchConditionParameters, self).__init__(**kwargs) self.operator = operator self.negate_condition = negate_condition + self.transforms = transforms self.match_values = match_values @@ -6734,42 +9702,55 @@ class RequestSchemeMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestSchemeConditionParameters". - :vartype odata_type: str - :ivar operator: Required. Describes operator to be matched. Default value: "Equal". + :ivar type_name: Has constant value: "DeliveryRuleRequestSchemeConditionParameters". + :vartype type_name: str + :ivar operator: Describes operator to be matched. Has constant value: "Equal". :vartype operator: str - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str or + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str or ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParametersMatchValuesItem] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True, 'constant': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, + 'transforms': {'key': 'transforms', 'type': '[str]'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestSchemeConditionParameters" + type_name = "DeliveryRuleRequestSchemeConditionParameters" operator = "Equal" def __init__( self, *, negate_condition: Optional[bool] = None, + transforms: Optional[List[Union[str, "Transform"]]] = None, match_values: Optional[List[Union[str, "RequestSchemeMatchConditionParametersMatchValuesItem"]]] = None, **kwargs ): + """ + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str or + ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParametersMatchValuesItem] + """ super(RequestSchemeMatchConditionParameters, self).__init__(**kwargs) self.negate_condition = negate_condition + self.transforms = transforms self.match_values = match_values @@ -6780,35 +9761,34 @@ class RequestUriMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestUriConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :ivar type_name: Has constant value: "DeliveryRuleRequestUriConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.RequestUriOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :vartype operator: str or ~azure.mgmt.cdn.models.RequestUriOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleRequestUriConditionParameters" + type_name = "DeliveryRuleRequestUriConditionParameters" def __init__( self, @@ -6819,6 +9799,18 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.RequestUriOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(RequestUriMatchConditionParameters, self).__init__(**kwargs) self.operator = operator self.negate_condition = negate_condition @@ -6829,8 +9821,8 @@ def __init__( class ResourceReference(msrest.serialization.Model): """Reference to another resource. - :param id: Resource ID. - :type id: str + :ivar id: Resource ID. + :vartype id: str """ _attribute_map = { @@ -6843,6 +9835,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource ID. + :paramtype id: str + """ super(ResourceReference, self).__init__(**kwargs) self.id = id @@ -6850,10 +9846,10 @@ def __init__( class ResourcesResponse(msrest.serialization.Model): """Resources Response. - :param endpoints: - :type endpoints: list[~azure.mgmt.cdn.models.ResourcesResponseEndpointsItem] - :param custom_domains: - :type custom_domains: list[~azure.mgmt.cdn.models.ResourcesResponseCustomDomainsItem] + :ivar endpoints: + :vartype endpoints: list[~azure.mgmt.cdn.models.ResourcesResponseEndpointsItem] + :ivar custom_domains: + :vartype custom_domains: list[~azure.mgmt.cdn.models.ResourcesResponseCustomDomainsItem] """ _attribute_map = { @@ -6868,6 +9864,12 @@ def __init__( custom_domains: Optional[List["ResourcesResponseCustomDomainsItem"]] = None, **kwargs ): + """ + :keyword endpoints: + :paramtype endpoints: list[~azure.mgmt.cdn.models.ResourcesResponseEndpointsItem] + :keyword custom_domains: + :paramtype custom_domains: list[~azure.mgmt.cdn.models.ResourcesResponseCustomDomainsItem] + """ super(ResourcesResponse, self).__init__(**kwargs) self.endpoints = endpoints self.custom_domains = custom_domains @@ -6876,14 +9878,14 @@ def __init__( class ResourcesResponseCustomDomainsItem(msrest.serialization.Model): """ResourcesResponseCustomDomainsItem. - :param id: - :type id: str - :param name: - :type name: str - :param endpoint_id: - :type endpoint_id: str - :param history: - :type history: bool + :ivar id: + :vartype id: str + :ivar name: + :vartype name: str + :ivar endpoint_id: + :vartype endpoint_id: str + :ivar history: + :vartype history: bool """ _attribute_map = { @@ -6902,6 +9904,16 @@ def __init__( history: Optional[bool] = None, **kwargs ): + """ + :keyword id: + :paramtype id: str + :keyword name: + :paramtype name: str + :keyword endpoint_id: + :paramtype endpoint_id: str + :keyword history: + :paramtype history: bool + """ super(ResourcesResponseCustomDomainsItem, self).__init__(**kwargs) self.id = id self.name = name @@ -6912,14 +9924,14 @@ def __init__( class ResourcesResponseEndpointsItem(msrest.serialization.Model): """ResourcesResponseEndpointsItem. - :param id: - :type id: str - :param name: - :type name: str - :param history: - :type history: bool - :param custom_domains: - :type custom_domains: + :ivar id: + :vartype id: str + :ivar name: + :vartype name: str + :ivar history: + :vartype history: bool + :ivar custom_domains: + :vartype custom_domains: list[~azure.mgmt.cdn.models.ResourcesResponseEndpointsPropertiesItemsItem] """ @@ -6939,6 +9951,17 @@ def __init__( custom_domains: Optional[List["ResourcesResponseEndpointsPropertiesItemsItem"]] = None, **kwargs ): + """ + :keyword id: + :paramtype id: str + :keyword name: + :paramtype name: str + :keyword history: + :paramtype history: bool + :keyword custom_domains: + :paramtype custom_domains: + list[~azure.mgmt.cdn.models.ResourcesResponseEndpointsPropertiesItemsItem] + """ super(ResourcesResponseEndpointsItem, self).__init__(**kwargs) self.id = id self.name = name @@ -6949,14 +9972,14 @@ def __init__( class ResourcesResponseEndpointsPropertiesItemsItem(msrest.serialization.Model): """ResourcesResponseEndpointsPropertiesItemsItem. - :param id: - :type id: str - :param name: - :type name: str - :param endpoint_id: - :type endpoint_id: str - :param history: - :type history: bool + :ivar id: + :vartype id: str + :ivar name: + :vartype name: str + :ivar endpoint_id: + :vartype endpoint_id: str + :ivar history: + :vartype history: bool """ _attribute_map = { @@ -6975,6 +9998,16 @@ def __init__( history: Optional[bool] = None, **kwargs ): + """ + :keyword id: + :paramtype id: str + :keyword name: + :paramtype name: str + :keyword endpoint_id: + :paramtype endpoint_id: str + :keyword history: + :paramtype history: bool + """ super(ResourcesResponseEndpointsPropertiesItemsItem, self).__init__(**kwargs) self.id = id self.name = name @@ -7015,6 +10048,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceUsage, self).__init__(**kwargs) self.resource_type = None self.unit = None @@ -7029,8 +10064,8 @@ class ResourceUsageListResult(msrest.serialization.Model): :ivar value: List of resource usages. :vartype value: list[~azure.mgmt.cdn.models.ResourceUsage] - :param next_link: URL to get the next set of custom domain objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of custom domain objects if there are any. + :vartype next_link: str """ _validation = { @@ -7048,6 +10083,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of custom domain objects if there are any. + :paramtype next_link: str + """ super(ResourceUsageListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -7056,17 +10095,17 @@ def __init__( class ResponseBasedOriginErrorDetectionParameters(msrest.serialization.Model): """The JSON object that contains the properties to determine origin health using real requests/responses. - :param response_based_detected_error_types: Type of response errors for real user requests for + :ivar response_based_detected_error_types: Type of response errors for real user requests for which origin will be deemed unhealthy. Possible values include: "None", "TcpErrorsOnly", "TcpAndHttpErrors". - :type response_based_detected_error_types: str or + :vartype response_based_detected_error_types: str or ~azure.mgmt.cdn.models.ResponseBasedDetectedErrorTypes - :param response_based_failover_threshold_percentage: The percentage of failed requests in the + :ivar response_based_failover_threshold_percentage: The percentage of failed requests in the sample where failover should trigger. - :type response_based_failover_threshold_percentage: int - :param http_error_ranges: The list of Http status code ranges that are considered as server + :vartype response_based_failover_threshold_percentage: int + :ivar http_error_ranges: The list of Http status code ranges that are considered as server errors for origin and it is marked as unhealthy. - :type http_error_ranges: list[~azure.mgmt.cdn.models.HttpErrorRangeParameters] + :vartype http_error_ranges: list[~azure.mgmt.cdn.models.HttpErrorRangeParameters] """ _validation = { @@ -7087,13 +10126,26 @@ def __init__( http_error_ranges: Optional[List["HttpErrorRangeParameters"]] = None, **kwargs ): + """ + :keyword response_based_detected_error_types: Type of response errors for real user requests + for which origin will be deemed unhealthy. Possible values include: "None", "TcpErrorsOnly", + "TcpAndHttpErrors". + :paramtype response_based_detected_error_types: str or + ~azure.mgmt.cdn.models.ResponseBasedDetectedErrorTypes + :keyword response_based_failover_threshold_percentage: The percentage of failed requests in the + sample where failover should trigger. + :paramtype response_based_failover_threshold_percentage: int + :keyword http_error_ranges: The list of Http status code ranges that are considered as server + errors for origin and it is marked as unhealthy. + :paramtype http_error_ranges: list[~azure.mgmt.cdn.models.HttpErrorRangeParameters] + """ super(ResponseBasedOriginErrorDetectionParameters, self).__init__(**kwargs) self.response_based_detected_error_types = response_based_detected_error_types self.response_based_failover_threshold_percentage = response_based_failover_threshold_percentage self.http_error_ranges = http_error_ranges -class Route(Resource): +class Route(ProxyResource): """Friendly Routes name mapping to the any Routes or secret related information. Variables are only populated by the server, and will be ignored when sending a request. @@ -7106,44 +10158,41 @@ class Route(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param custom_domains: Domains referenced by this endpoint. - :type custom_domains: list[~azure.mgmt.cdn.models.ResourceReference] - :param origin_group: A reference to the origin group. - :type origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve + :ivar endpoint_name: The name of the endpoint which holds the route. + :vartype endpoint_name: str + :ivar custom_domains: Domains referenced by this endpoint. + :vartype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] + :ivar origin_group: A reference to the origin group. + :vartype origin_group: ~azure.mgmt.cdn.models.ResourceReference + :ivar origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param rule_sets: rule sets referenced by this endpoint. - :type rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] - :param supported_protocols: List of supported protocols for this route. - :type supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param compression_settings: compression settings. - :type compression_settings: object - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or - ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior - :param forwarding_protocol: Protocol this rule will use when forwarding traffic to backends. + :vartype origin_path: str + :ivar rule_sets: rule sets referenced by this endpoint. + :vartype rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] + :ivar supported_protocols: List of supported protocols for this route. + :vartype supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] + :ivar patterns_to_match: The route patterns of the rule. + :vartype patterns_to_match: list[str] + :ivar cache_configuration: The caching configuration for this route. To disable caching, do not + provide a cacheConfiguration object. + :vartype cache_configuration: ~azure.mgmt.cdn.models.AfdRouteCacheConfiguration + :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.cdn.models.ForwardingProtocol - :param link_to_default_domain: whether this route will be linked to the default endpoint - domain. Possible values include: "Enabled", "Disabled". - :type link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain - :param https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note + :vartype forwarding_protocol: str or ~azure.mgmt.cdn.models.ForwardingProtocol + :ivar link_to_default_domain: whether this route will be linked to the default endpoint domain. + Possible values include: "Enabled", "Disabled". + :vartype link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain + :ivar https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. Possible values include: "Enabled", "Disabled". - :type https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + :vartype https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect + :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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ @@ -7153,6 +10202,7 @@ class Route(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, + 'endpoint_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, } @@ -7162,14 +10212,14 @@ class Route(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'custom_domains': {'key': 'properties.customDomains', 'type': '[ResourceReference]'}, + 'endpoint_name': {'key': 'properties.endpointName', 'type': 'str'}, + 'custom_domains': {'key': 'properties.customDomains', 'type': '[ActivatedResourceReference]'}, 'origin_group': {'key': 'properties.originGroup', 'type': 'ResourceReference'}, 'origin_path': {'key': 'properties.originPath', 'type': 'str'}, 'rule_sets': {'key': 'properties.ruleSets', 'type': '[ResourceReference]'}, 'supported_protocols': {'key': 'properties.supportedProtocols', 'type': '[str]'}, 'patterns_to_match': {'key': 'properties.patternsToMatch', 'type': '[str]'}, - 'compression_settings': {'key': 'properties.compressionSettings', 'type': 'object'}, - 'query_string_caching_behavior': {'key': 'properties.queryStringCachingBehavior', 'type': 'str'}, + 'cache_configuration': {'key': 'properties.cacheConfiguration', 'type': 'AfdRouteCacheConfiguration'}, 'forwarding_protocol': {'key': 'properties.forwardingProtocol', 'type': 'str'}, 'link_to_default_domain': {'key': 'properties.linkToDefaultDomain', 'type': 'str'}, 'https_redirect': {'key': 'properties.httpsRedirect', 'type': 'str'}, @@ -7181,29 +10231,59 @@ class Route(Resource): def __init__( self, *, - custom_domains: Optional[List["ResourceReference"]] = None, + custom_domains: Optional[List["ActivatedResourceReference"]] = None, origin_group: Optional["ResourceReference"] = None, origin_path: Optional[str] = None, rule_sets: Optional[List["ResourceReference"]] = None, supported_protocols: Optional[List[Union[str, "AFDEndpointProtocols"]]] = None, patterns_to_match: Optional[List[str]] = None, - compression_settings: Optional[object] = None, - query_string_caching_behavior: Optional[Union[str, "AfdQueryStringCachingBehavior"]] = None, + cache_configuration: Optional["AfdRouteCacheConfiguration"] = None, forwarding_protocol: Optional[Union[str, "ForwardingProtocol"]] = None, link_to_default_domain: Optional[Union[str, "LinkToDefaultDomain"]] = None, https_redirect: Optional[Union[str, "HttpsRedirect"]] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, **kwargs ): + """ + :keyword custom_domains: Domains referenced by this endpoint. + :paramtype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] + :keyword origin_group: A reference to the origin group. + :paramtype origin_group: ~azure.mgmt.cdn.models.ResourceReference + :keyword origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve + content from, e.g. contoso.cloudapp.net/originpath. + :paramtype origin_path: str + :keyword rule_sets: rule sets referenced by this endpoint. + :paramtype rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] + :keyword supported_protocols: List of supported protocols for this route. + :paramtype supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] + :keyword patterns_to_match: The route patterns of the rule. + :paramtype patterns_to_match: list[str] + :keyword cache_configuration: The caching configuration for this route. To disable caching, do + not provide a cacheConfiguration object. + :paramtype cache_configuration: ~azure.mgmt.cdn.models.AfdRouteCacheConfiguration + :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.cdn.models.ForwardingProtocol + :keyword link_to_default_domain: whether this route will be linked to the default endpoint + domain. Possible values include: "Enabled", "Disabled". + :paramtype link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain + :keyword https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note + that this is a easy way to set up this rule and it will be the first rule that gets executed. + Possible values include: "Enabled", "Disabled". + :paramtype https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect + :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.cdn.models.EnabledState + """ super(Route, self).__init__(**kwargs) + self.endpoint_name = None self.custom_domains = custom_domains self.origin_group = origin_group self.origin_path = origin_path self.rule_sets = rule_sets self.supported_protocols = supported_protocols self.patterns_to_match = patterns_to_match - self.compression_settings = compression_settings - self.query_string_caching_behavior = query_string_caching_behavior + self.cache_configuration = cache_configuration self.forwarding_protocol = forwarding_protocol self.link_to_default_domain = link_to_default_domain self.https_redirect = https_redirect @@ -7212,6 +10292,55 @@ def __init__( self.deployment_status = None +class RouteConfigurationOverrideActionParameters(msrest.serialization.Model): + """Defines the parameters for the route configuration override action. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type_name: Has constant value: "DeliveryRuleRouteConfigurationOverrideActionParameters". + :vartype type_name: str + :ivar origin_group_override: A reference to the origin group override configuration. Leave + empty to use the default origin group on route. + :vartype origin_group_override: ~azure.mgmt.cdn.models.OriginGroupOverride + :ivar cache_configuration: The caching configuration associated with this rule. To disable + caching, do not provide a cacheConfiguration object. + :vartype cache_configuration: ~azure.mgmt.cdn.models.CacheConfiguration + """ + + _validation = { + 'type_name': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'type_name': {'key': 'typeName', 'type': 'str'}, + 'origin_group_override': {'key': 'originGroupOverride', 'type': 'OriginGroupOverride'}, + 'cache_configuration': {'key': 'cacheConfiguration', 'type': 'CacheConfiguration'}, + } + + type_name = "DeliveryRuleRouteConfigurationOverrideActionParameters" + + def __init__( + self, + *, + origin_group_override: Optional["OriginGroupOverride"] = None, + cache_configuration: Optional["CacheConfiguration"] = None, + **kwargs + ): + """ + :keyword origin_group_override: A reference to the origin group override configuration. Leave + empty to use the default origin group on route. + :paramtype origin_group_override: ~azure.mgmt.cdn.models.OriginGroupOverride + :keyword cache_configuration: The caching configuration associated with this rule. To disable + caching, do not provide a cacheConfiguration object. + :paramtype cache_configuration: ~azure.mgmt.cdn.models.CacheConfiguration + """ + super(RouteConfigurationOverrideActionParameters, self).__init__(**kwargs) + self.origin_group_override = origin_group_override + self.cache_configuration = cache_configuration + + class RouteListResult(msrest.serialization.Model): """Result of the request to list routes. It contains a list of route objects and a URL link to get the next set of results. @@ -7219,8 +10348,8 @@ class RouteListResult(msrest.serialization.Model): :ivar value: List of AzureFrontDoor routes within a profile. :vartype value: list[~azure.mgmt.cdn.models.Route] - :param next_link: URL to get the next set of route objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of route objects if there are any. + :vartype next_link: str """ _validation = { @@ -7238,6 +10367,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of route objects if there are any. + :paramtype next_link: str + """ super(RouteListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -7246,51 +10379,54 @@ def __init__( class RouteUpdatePropertiesParameters(msrest.serialization.Model): """The JSON object that contains the properties of the domain to create. - :param custom_domains: Domains referenced by this endpoint. - :type custom_domains: list[~azure.mgmt.cdn.models.ResourceReference] - :param origin_group: A reference to the origin group. - :type origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint_name: The name of the endpoint which holds the route. + :vartype endpoint_name: str + :ivar custom_domains: Domains referenced by this endpoint. + :vartype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] + :ivar origin_group: A reference to the origin group. + :vartype origin_group: ~azure.mgmt.cdn.models.ResourceReference + :ivar origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param rule_sets: rule sets referenced by this endpoint. - :type rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] - :param supported_protocols: List of supported protocols for this route. - :type supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param compression_settings: compression settings. - :type compression_settings: object - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or - ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior - :param forwarding_protocol: Protocol this rule will use when forwarding traffic to backends. + :vartype origin_path: str + :ivar rule_sets: rule sets referenced by this endpoint. + :vartype rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] + :ivar supported_protocols: List of supported protocols for this route. + :vartype supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] + :ivar patterns_to_match: The route patterns of the rule. + :vartype patterns_to_match: list[str] + :ivar cache_configuration: The caching configuration for this route. To disable caching, do not + provide a cacheConfiguration object. + :vartype cache_configuration: ~azure.mgmt.cdn.models.AfdRouteCacheConfiguration + :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.cdn.models.ForwardingProtocol - :param link_to_default_domain: whether this route will be linked to the default endpoint - domain. Possible values include: "Enabled", "Disabled". - :type link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain - :param https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note + :vartype forwarding_protocol: str or ~azure.mgmt.cdn.models.ForwardingProtocol + :ivar link_to_default_domain: whether this route will be linked to the default endpoint domain. + Possible values include: "Enabled", "Disabled". + :vartype link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain + :ivar https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. Possible values include: "Enabled", "Disabled". - :type https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + :vartype https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect + :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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ + _validation = { + 'endpoint_name': {'readonly': True}, + } + _attribute_map = { - 'custom_domains': {'key': 'customDomains', 'type': '[ResourceReference]'}, + 'endpoint_name': {'key': 'endpointName', 'type': 'str'}, + 'custom_domains': {'key': 'customDomains', 'type': '[ActivatedResourceReference]'}, 'origin_group': {'key': 'originGroup', 'type': 'ResourceReference'}, 'origin_path': {'key': 'originPath', 'type': 'str'}, 'rule_sets': {'key': 'ruleSets', 'type': '[ResourceReference]'}, 'supported_protocols': {'key': 'supportedProtocols', 'type': '[str]'}, 'patterns_to_match': {'key': 'patternsToMatch', 'type': '[str]'}, - 'compression_settings': {'key': 'compressionSettings', 'type': 'object'}, - 'query_string_caching_behavior': {'key': 'queryStringCachingBehavior', 'type': 'str'}, + 'cache_configuration': {'key': 'cacheConfiguration', 'type': 'AfdRouteCacheConfiguration'}, 'forwarding_protocol': {'key': 'forwardingProtocol', 'type': 'str'}, 'link_to_default_domain': {'key': 'linkToDefaultDomain', 'type': 'str'}, 'https_redirect': {'key': 'httpsRedirect', 'type': 'str'}, @@ -7300,29 +10436,59 @@ class RouteUpdatePropertiesParameters(msrest.serialization.Model): def __init__( self, *, - custom_domains: Optional[List["ResourceReference"]] = None, + custom_domains: Optional[List["ActivatedResourceReference"]] = None, origin_group: Optional["ResourceReference"] = None, origin_path: Optional[str] = None, rule_sets: Optional[List["ResourceReference"]] = None, supported_protocols: Optional[List[Union[str, "AFDEndpointProtocols"]]] = None, patterns_to_match: Optional[List[str]] = None, - compression_settings: Optional[object] = None, - query_string_caching_behavior: Optional[Union[str, "AfdQueryStringCachingBehavior"]] = None, + cache_configuration: Optional["AfdRouteCacheConfiguration"] = None, forwarding_protocol: Optional[Union[str, "ForwardingProtocol"]] = None, link_to_default_domain: Optional[Union[str, "LinkToDefaultDomain"]] = None, https_redirect: Optional[Union[str, "HttpsRedirect"]] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, **kwargs ): + """ + :keyword custom_domains: Domains referenced by this endpoint. + :paramtype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] + :keyword origin_group: A reference to the origin group. + :paramtype origin_group: ~azure.mgmt.cdn.models.ResourceReference + :keyword origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve + content from, e.g. contoso.cloudapp.net/originpath. + :paramtype origin_path: str + :keyword rule_sets: rule sets referenced by this endpoint. + :paramtype rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] + :keyword supported_protocols: List of supported protocols for this route. + :paramtype supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] + :keyword patterns_to_match: The route patterns of the rule. + :paramtype patterns_to_match: list[str] + :keyword cache_configuration: The caching configuration for this route. To disable caching, do + not provide a cacheConfiguration object. + :paramtype cache_configuration: ~azure.mgmt.cdn.models.AfdRouteCacheConfiguration + :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.cdn.models.ForwardingProtocol + :keyword link_to_default_domain: whether this route will be linked to the default endpoint + domain. Possible values include: "Enabled", "Disabled". + :paramtype link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain + :keyword https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note + that this is a easy way to set up this rule and it will be the first rule that gets executed. + Possible values include: "Enabled", "Disabled". + :paramtype https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect + :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.cdn.models.EnabledState + """ super(RouteUpdatePropertiesParameters, self).__init__(**kwargs) + self.endpoint_name = None self.custom_domains = custom_domains self.origin_group = origin_group self.origin_path = origin_path self.rule_sets = rule_sets self.supported_protocols = supported_protocols self.patterns_to_match = patterns_to_match - self.compression_settings = compression_settings - self.query_string_caching_behavior = query_string_caching_behavior + self.cache_configuration = cache_configuration self.forwarding_protocol = forwarding_protocol self.link_to_default_domain = link_to_default_domain self.https_redirect = https_redirect @@ -7334,62 +10500,60 @@ class RouteProperties(AFDStateProperties, RouteUpdatePropertiesParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param custom_domains: Domains referenced by this endpoint. - :type custom_domains: list[~azure.mgmt.cdn.models.ResourceReference] - :param origin_group: A reference to the origin group. - :type origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve + :ivar endpoint_name: The name of the endpoint which holds the route. + :vartype endpoint_name: str + :ivar custom_domains: Domains referenced by this endpoint. + :vartype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] + :ivar origin_group: A reference to the origin group. + :vartype origin_group: ~azure.mgmt.cdn.models.ResourceReference + :ivar origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param rule_sets: rule sets referenced by this endpoint. - :type rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] - :param supported_protocols: List of supported protocols for this route. - :type supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param compression_settings: compression settings. - :type compression_settings: object - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or - ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior - :param forwarding_protocol: Protocol this rule will use when forwarding traffic to backends. + :vartype origin_path: str + :ivar rule_sets: rule sets referenced by this endpoint. + :vartype rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] + :ivar supported_protocols: List of supported protocols for this route. + :vartype supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] + :ivar patterns_to_match: The route patterns of the rule. + :vartype patterns_to_match: list[str] + :ivar cache_configuration: The caching configuration for this route. To disable caching, do not + provide a cacheConfiguration object. + :vartype cache_configuration: ~azure.mgmt.cdn.models.AfdRouteCacheConfiguration + :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.cdn.models.ForwardingProtocol - :param link_to_default_domain: whether this route will be linked to the default endpoint - domain. Possible values include: "Enabled", "Disabled". - :type link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain - :param https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note + :vartype forwarding_protocol: str or ~azure.mgmt.cdn.models.ForwardingProtocol + :ivar link_to_default_domain: whether this route will be linked to the default endpoint domain. + Possible values include: "Enabled", "Disabled". + :vartype link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain + :ivar https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. Possible values include: "Enabled", "Disabled". - :type https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + :vartype https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect + :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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ _validation = { + 'endpoint_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, } _attribute_map = { - 'custom_domains': {'key': 'customDomains', 'type': '[ResourceReference]'}, + 'endpoint_name': {'key': 'endpointName', 'type': 'str'}, + 'custom_domains': {'key': 'customDomains', 'type': '[ActivatedResourceReference]'}, 'origin_group': {'key': 'originGroup', 'type': 'ResourceReference'}, 'origin_path': {'key': 'originPath', 'type': 'str'}, 'rule_sets': {'key': 'ruleSets', 'type': '[ResourceReference]'}, 'supported_protocols': {'key': 'supportedProtocols', 'type': '[str]'}, 'patterns_to_match': {'key': 'patternsToMatch', 'type': '[str]'}, - 'compression_settings': {'key': 'compressionSettings', 'type': 'object'}, - 'query_string_caching_behavior': {'key': 'queryStringCachingBehavior', 'type': 'str'}, + 'cache_configuration': {'key': 'cacheConfiguration', 'type': 'AfdRouteCacheConfiguration'}, 'forwarding_protocol': {'key': 'forwardingProtocol', 'type': 'str'}, 'link_to_default_domain': {'key': 'linkToDefaultDomain', 'type': 'str'}, 'https_redirect': {'key': 'httpsRedirect', 'type': 'str'}, @@ -7401,29 +10565,59 @@ class RouteProperties(AFDStateProperties, RouteUpdatePropertiesParameters): def __init__( self, *, - custom_domains: Optional[List["ResourceReference"]] = None, + custom_domains: Optional[List["ActivatedResourceReference"]] = None, origin_group: Optional["ResourceReference"] = None, origin_path: Optional[str] = None, rule_sets: Optional[List["ResourceReference"]] = None, supported_protocols: Optional[List[Union[str, "AFDEndpointProtocols"]]] = None, patterns_to_match: Optional[List[str]] = None, - compression_settings: Optional[object] = None, - query_string_caching_behavior: Optional[Union[str, "AfdQueryStringCachingBehavior"]] = None, + cache_configuration: Optional["AfdRouteCacheConfiguration"] = None, forwarding_protocol: Optional[Union[str, "ForwardingProtocol"]] = None, link_to_default_domain: Optional[Union[str, "LinkToDefaultDomain"]] = None, https_redirect: Optional[Union[str, "HttpsRedirect"]] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, **kwargs ): - super(RouteProperties, self).__init__(custom_domains=custom_domains, origin_group=origin_group, origin_path=origin_path, rule_sets=rule_sets, supported_protocols=supported_protocols, patterns_to_match=patterns_to_match, compression_settings=compression_settings, query_string_caching_behavior=query_string_caching_behavior, forwarding_protocol=forwarding_protocol, link_to_default_domain=link_to_default_domain, https_redirect=https_redirect, enabled_state=enabled_state, **kwargs) + """ + :keyword custom_domains: Domains referenced by this endpoint. + :paramtype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] + :keyword origin_group: A reference to the origin group. + :paramtype origin_group: ~azure.mgmt.cdn.models.ResourceReference + :keyword origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve + content from, e.g. contoso.cloudapp.net/originpath. + :paramtype origin_path: str + :keyword rule_sets: rule sets referenced by this endpoint. + :paramtype rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] + :keyword supported_protocols: List of supported protocols for this route. + :paramtype supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] + :keyword patterns_to_match: The route patterns of the rule. + :paramtype patterns_to_match: list[str] + :keyword cache_configuration: The caching configuration for this route. To disable caching, do + not provide a cacheConfiguration object. + :paramtype cache_configuration: ~azure.mgmt.cdn.models.AfdRouteCacheConfiguration + :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.cdn.models.ForwardingProtocol + :keyword link_to_default_domain: whether this route will be linked to the default endpoint + domain. Possible values include: "Enabled", "Disabled". + :paramtype link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain + :keyword https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note + that this is a easy way to set up this rule and it will be the first rule that gets executed. + Possible values include: "Enabled", "Disabled". + :paramtype https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect + :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.cdn.models.EnabledState + """ + super(RouteProperties, self).__init__(custom_domains=custom_domains, origin_group=origin_group, origin_path=origin_path, rule_sets=rule_sets, supported_protocols=supported_protocols, patterns_to_match=patterns_to_match, cache_configuration=cache_configuration, forwarding_protocol=forwarding_protocol, link_to_default_domain=link_to_default_domain, https_redirect=https_redirect, enabled_state=enabled_state, **kwargs) + self.endpoint_name = None self.custom_domains = custom_domains self.origin_group = origin_group self.origin_path = origin_path self.rule_sets = rule_sets self.supported_protocols = supported_protocols self.patterns_to_match = patterns_to_match - self.compression_settings = compression_settings - self.query_string_caching_behavior = query_string_caching_behavior + self.cache_configuration = cache_configuration self.forwarding_protocol = forwarding_protocol self.link_to_default_domain = link_to_default_domain self.https_redirect = https_redirect @@ -7435,51 +10629,54 @@ def __init__( class RouteUpdateParameters(msrest.serialization.Model): """The domain JSON object required for domain creation or update. - :param custom_domains: Domains referenced by this endpoint. - :type custom_domains: list[~azure.mgmt.cdn.models.ResourceReference] - :param origin_group: A reference to the origin group. - :type origin_group: ~azure.mgmt.cdn.models.ResourceReference - :param origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint_name: The name of the endpoint which holds the route. + :vartype endpoint_name: str + :ivar custom_domains: Domains referenced by this endpoint. + :vartype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] + :ivar origin_group: A reference to the origin group. + :vartype origin_group: ~azure.mgmt.cdn.models.ResourceReference + :ivar origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. - :type origin_path: str - :param rule_sets: rule sets referenced by this endpoint. - :type rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] - :param supported_protocols: List of supported protocols for this route. - :type supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] - :param patterns_to_match: The route patterns of the rule. - :type patterns_to_match: list[str] - :param compression_settings: compression settings. - :type compression_settings: object - :param query_string_caching_behavior: Defines how CDN caches requests that include query - strings. You can ignore any query strings when caching, bypass caching to prevent requests that - contain query strings from being cached, or cache every request with a unique URL. Possible - values include: "IgnoreQueryString", "UseQueryString", "NotSet". - :type query_string_caching_behavior: str or - ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior - :param forwarding_protocol: Protocol this rule will use when forwarding traffic to backends. + :vartype origin_path: str + :ivar rule_sets: rule sets referenced by this endpoint. + :vartype rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] + :ivar supported_protocols: List of supported protocols for this route. + :vartype supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] + :ivar patterns_to_match: The route patterns of the rule. + :vartype patterns_to_match: list[str] + :ivar cache_configuration: The caching configuration for this route. To disable caching, do not + provide a cacheConfiguration object. + :vartype cache_configuration: ~azure.mgmt.cdn.models.AfdRouteCacheConfiguration + :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.cdn.models.ForwardingProtocol - :param link_to_default_domain: whether this route will be linked to the default endpoint - domain. Possible values include: "Enabled", "Disabled". - :type link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain - :param https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note + :vartype forwarding_protocol: str or ~azure.mgmt.cdn.models.ForwardingProtocol + :ivar link_to_default_domain: whether this route will be linked to the default endpoint domain. + Possible values include: "Enabled", "Disabled". + :vartype link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain + :ivar https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. Possible values include: "Enabled", "Disabled". - :type https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect - :param enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or + :vartype https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect + :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.cdn.models.EnabledState + :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ + _validation = { + 'endpoint_name': {'readonly': True}, + } + _attribute_map = { - 'custom_domains': {'key': 'properties.customDomains', 'type': '[ResourceReference]'}, + 'endpoint_name': {'key': 'properties.endpointName', 'type': 'str'}, + 'custom_domains': {'key': 'properties.customDomains', 'type': '[ActivatedResourceReference]'}, 'origin_group': {'key': 'properties.originGroup', 'type': 'ResourceReference'}, 'origin_path': {'key': 'properties.originPath', 'type': 'str'}, 'rule_sets': {'key': 'properties.ruleSets', 'type': '[ResourceReference]'}, 'supported_protocols': {'key': 'properties.supportedProtocols', 'type': '[str]'}, 'patterns_to_match': {'key': 'properties.patternsToMatch', 'type': '[str]'}, - 'compression_settings': {'key': 'properties.compressionSettings', 'type': 'object'}, - 'query_string_caching_behavior': {'key': 'properties.queryStringCachingBehavior', 'type': 'str'}, + 'cache_configuration': {'key': 'properties.cacheConfiguration', 'type': 'AfdRouteCacheConfiguration'}, 'forwarding_protocol': {'key': 'properties.forwardingProtocol', 'type': 'str'}, 'link_to_default_domain': {'key': 'properties.linkToDefaultDomain', 'type': 'str'}, 'https_redirect': {'key': 'properties.httpsRedirect', 'type': 'str'}, @@ -7489,36 +10686,66 @@ class RouteUpdateParameters(msrest.serialization.Model): def __init__( self, *, - custom_domains: Optional[List["ResourceReference"]] = None, + custom_domains: Optional[List["ActivatedResourceReference"]] = None, origin_group: Optional["ResourceReference"] = None, origin_path: Optional[str] = None, rule_sets: Optional[List["ResourceReference"]] = None, supported_protocols: Optional[List[Union[str, "AFDEndpointProtocols"]]] = None, patterns_to_match: Optional[List[str]] = None, - compression_settings: Optional[object] = None, - query_string_caching_behavior: Optional[Union[str, "AfdQueryStringCachingBehavior"]] = None, + cache_configuration: Optional["AfdRouteCacheConfiguration"] = None, forwarding_protocol: Optional[Union[str, "ForwardingProtocol"]] = None, link_to_default_domain: Optional[Union[str, "LinkToDefaultDomain"]] = None, https_redirect: Optional[Union[str, "HttpsRedirect"]] = None, enabled_state: Optional[Union[str, "EnabledState"]] = None, **kwargs ): + """ + :keyword custom_domains: Domains referenced by this endpoint. + :paramtype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] + :keyword origin_group: A reference to the origin group. + :paramtype origin_group: ~azure.mgmt.cdn.models.ResourceReference + :keyword origin_path: A directory path on the origin that AzureFrontDoor can use to retrieve + content from, e.g. contoso.cloudapp.net/originpath. + :paramtype origin_path: str + :keyword rule_sets: rule sets referenced by this endpoint. + :paramtype rule_sets: list[~azure.mgmt.cdn.models.ResourceReference] + :keyword supported_protocols: List of supported protocols for this route. + :paramtype supported_protocols: list[str or ~azure.mgmt.cdn.models.AFDEndpointProtocols] + :keyword patterns_to_match: The route patterns of the rule. + :paramtype patterns_to_match: list[str] + :keyword cache_configuration: The caching configuration for this route. To disable caching, do + not provide a cacheConfiguration object. + :paramtype cache_configuration: ~azure.mgmt.cdn.models.AfdRouteCacheConfiguration + :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.cdn.models.ForwardingProtocol + :keyword link_to_default_domain: whether this route will be linked to the default endpoint + domain. Possible values include: "Enabled", "Disabled". + :paramtype link_to_default_domain: str or ~azure.mgmt.cdn.models.LinkToDefaultDomain + :keyword https_redirect: Whether to automatically redirect HTTP traffic to HTTPS traffic. Note + that this is a easy way to set up this rule and it will be the first rule that gets executed. + Possible values include: "Enabled", "Disabled". + :paramtype https_redirect: str or ~azure.mgmt.cdn.models.HttpsRedirect + :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.cdn.models.EnabledState + """ super(RouteUpdateParameters, self).__init__(**kwargs) + self.endpoint_name = None self.custom_domains = custom_domains self.origin_group = origin_group self.origin_path = origin_path self.rule_sets = rule_sets self.supported_protocols = supported_protocols self.patterns_to_match = patterns_to_match - self.compression_settings = compression_settings - self.query_string_caching_behavior = query_string_caching_behavior + self.cache_configuration = cache_configuration self.forwarding_protocol = forwarding_protocol self.link_to_default_domain = link_to_default_domain self.https_redirect = https_redirect self.enabled_state = enabled_state -class Rule(Resource): +class Rule(ProxyResource): """Friendly Rules name mapping to the any Rules or secret related information. Variables are only populated by the server, and will be ignored when sending a request. @@ -7531,24 +10758,26 @@ class Rule(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :param order: The order in which the rules are applied for the endpoint. Possible values + :ivar rule_set_name: The name of the rule set containing the rule. + :vartype rule_set_name: str + :ivar order: The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. - :type order: int - :param conditions: A list of conditions that must be matched for the actions to be executed. - :type conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] - :param actions: A list of actions that are executed when all the conditions of a rule are + :vartype order: int + :ivar conditions: A list of conditions that must be matched for the actions to be executed. + :vartype conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] + :ivar actions: A list of actions that are executed when all the conditions of a rule are satisfied. - :type actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] - :param match_processing_behavior: If this rule is a match should the rules engine continue + :vartype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] + :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.cdn.models.MatchProcessingBehavior + :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ @@ -7558,6 +10787,7 @@ class Rule(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, + 'rule_set_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, } @@ -7567,6 +10797,7 @@ class Rule(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'rule_set_name': {'key': 'properties.ruleSetName', 'type': 'str'}, 'order': {'key': 'properties.order', 'type': 'int'}, 'conditions': {'key': 'properties.conditions', 'type': '[DeliveryRuleCondition]'}, 'actions': {'key': 'properties.actions', 'type': '[DeliveryRuleAction]'}, @@ -7584,7 +10815,24 @@ def __init__( match_processing_behavior: Optional[Union[str, "MatchProcessingBehavior"]] = None, **kwargs ): + """ + :keyword order: The order in which the rules are applied for the endpoint. Possible values + {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. + Rule with order 0 is a special rule. It does not require any condition and actions listed in it + will always be applied. + :paramtype order: int + :keyword conditions: A list of conditions that must be matched for the actions to be executed. + :paramtype conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] + :keyword actions: A list of actions that are executed when all the conditions of a rule are + satisfied. + :paramtype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] + :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.cdn.models.MatchProcessingBehavior + """ super(Rule, self).__init__(**kwargs) + self.rule_set_name = None self.order = order self.conditions = conditions self.actions = actions @@ -7600,8 +10848,8 @@ class RuleListResult(msrest.serialization.Model): :ivar value: List of AzureFrontDoor rules within a rule set. :vartype value: list[~azure.mgmt.cdn.models.Rule] - :param next_link: URL to get the next set of rule objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of rule objects if there are any. + :vartype next_link: str """ _validation = { @@ -7619,31 +10867,44 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of rule objects if there are any. + :paramtype next_link: str + """ super(RuleListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link class RuleUpdatePropertiesParameters(msrest.serialization.Model): - """The JSON object that contains the properties of the domain to create. + """The JSON object that contains the properties of the rule to update. - :param order: The order in which the rules are applied for the endpoint. Possible values + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar rule_set_name: The name of the rule set containing the rule. + :vartype rule_set_name: str + :ivar order: The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. - :type order: int - :param conditions: A list of conditions that must be matched for the actions to be executed. - :type conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] - :param actions: A list of actions that are executed when all the conditions of a rule are + :vartype order: int + :ivar conditions: A list of conditions that must be matched for the actions to be executed. + :vartype conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] + :ivar actions: A list of actions that are executed when all the conditions of a rule are satisfied. - :type actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] - :param match_processing_behavior: If this rule is a match should the rules engine continue + :vartype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] + :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.cdn.models.MatchProcessingBehavior + :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ + _validation = { + 'rule_set_name': {'readonly': True}, + } + _attribute_map = { + 'rule_set_name': {'key': 'ruleSetName', 'type': 'str'}, 'order': {'key': 'order', 'type': 'int'}, 'conditions': {'key': 'conditions', 'type': '[DeliveryRuleCondition]'}, 'actions': {'key': 'actions', 'type': '[DeliveryRuleAction]'}, @@ -7659,7 +10920,24 @@ def __init__( match_processing_behavior: Optional[Union[str, "MatchProcessingBehavior"]] = None, **kwargs ): + """ + :keyword order: The order in which the rules are applied for the endpoint. Possible values + {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. + Rule with order 0 is a special rule. It does not require any condition and actions listed in it + will always be applied. + :paramtype order: int + :keyword conditions: A list of conditions that must be matched for the actions to be executed. + :paramtype conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] + :keyword actions: A list of actions that are executed when all the conditions of a rule are + satisfied. + :paramtype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] + :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.cdn.models.MatchProcessingBehavior + """ super(RuleUpdatePropertiesParameters, self).__init__(**kwargs) + self.rule_set_name = None self.order = order self.conditions = conditions self.actions = actions @@ -7671,34 +10949,38 @@ class RuleProperties(AFDStateProperties, RuleUpdatePropertiesParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param order: The order in which the rules are applied for the endpoint. Possible values + :ivar rule_set_name: The name of the rule set containing the rule. + :vartype rule_set_name: str + :ivar order: The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. - :type order: int - :param conditions: A list of conditions that must be matched for the actions to be executed. - :type conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] - :param actions: A list of actions that are executed when all the conditions of a rule are + :vartype order: int + :ivar conditions: A list of conditions that must be matched for the actions to be executed. + :vartype conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] + :ivar actions: A list of actions that are executed when all the conditions of a rule are satisfied. - :type actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] - :param match_processing_behavior: If this rule is a match should the rules engine continue + :vartype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] + :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.cdn.models.MatchProcessingBehavior + :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ _validation = { + 'rule_set_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, } _attribute_map = { + 'rule_set_name': {'key': 'ruleSetName', 'type': 'str'}, 'order': {'key': 'order', 'type': 'int'}, 'conditions': {'key': 'conditions', 'type': '[DeliveryRuleCondition]'}, 'actions': {'key': 'actions', 'type': '[DeliveryRuleAction]'}, @@ -7716,7 +10998,24 @@ def __init__( match_processing_behavior: Optional[Union[str, "MatchProcessingBehavior"]] = None, **kwargs ): + """ + :keyword order: The order in which the rules are applied for the endpoint. Possible values + {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. + Rule with order 0 is a special rule. It does not require any condition and actions listed in it + will always be applied. + :paramtype order: int + :keyword conditions: A list of conditions that must be matched for the actions to be executed. + :paramtype conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] + :keyword actions: A list of actions that are executed when all the conditions of a rule are + satisfied. + :paramtype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] + :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.cdn.models.MatchProcessingBehavior + """ super(RuleProperties, self).__init__(order=order, conditions=conditions, actions=actions, match_processing_behavior=match_processing_behavior, **kwargs) + self.rule_set_name = None self.order = order self.conditions = conditions self.actions = actions @@ -7725,7 +11024,7 @@ def __init__( self.deployment_status = None -class RuleSet(Resource): +class RuleSet(ProxyResource): """Friendly RuleSet name mapping to the any RuleSet or secret related information. Variables are only populated by the server, and will be ignored when sending a request. @@ -7741,9 +11040,11 @@ class RuleSet(Resource): :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus + :ivar profile_name: The name of the profile which holds the rule set. + :vartype profile_name: str """ _validation = { @@ -7753,6 +11054,7 @@ class RuleSet(Resource): 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, + 'profile_name': {'readonly': True}, } _attribute_map = { @@ -7762,15 +11064,19 @@ class RuleSet(Resource): 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, + 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, } def __init__( self, **kwargs ): + """ + """ super(RuleSet, self).__init__(**kwargs) self.provisioning_state = None self.deployment_status = None + self.profile_name = None class RuleSetListResult(msrest.serialization.Model): @@ -7780,8 +11086,8 @@ class RuleSetListResult(msrest.serialization.Model): :ivar value: List of AzureFrontDoor rule sets within a profile. :vartype value: list[~azure.mgmt.cdn.models.RuleSet] - :param next_link: URL to get the next set of rule set objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of rule set objects if there are any. + :vartype next_link: str """ _validation = { @@ -7799,6 +11105,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of rule set objects if there are any. + :paramtype next_link: str + """ super(RuleSetListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -7812,48 +11122,64 @@ class RuleSetProperties(AFDStateProperties): :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus + :ivar profile_name: The name of the profile which holds the rule set. + :vartype profile_name: str """ _validation = { 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, + 'profile_name': {'readonly': True}, } _attribute_map = { 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, + 'profile_name': {'key': 'profileName', 'type': 'str'}, } def __init__( self, **kwargs ): + """ + """ super(RuleSetProperties, self).__init__(**kwargs) + self.profile_name = None class RuleUpdateParameters(msrest.serialization.Model): """The domain JSON object required for domain creation or update. - :param order: The order in which the rules are applied for the endpoint. Possible values + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar rule_set_name: The name of the rule set containing the rule. + :vartype rule_set_name: str + :ivar order: The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. - :type order: int - :param conditions: A list of conditions that must be matched for the actions to be executed. - :type conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] - :param actions: A list of actions that are executed when all the conditions of a rule are + :vartype order: int + :ivar conditions: A list of conditions that must be matched for the actions to be executed. + :vartype conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] + :ivar actions: A list of actions that are executed when all the conditions of a rule are satisfied. - :type actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] - :param match_processing_behavior: If this rule is a match should the rules engine continue + :vartype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] + :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.cdn.models.MatchProcessingBehavior + :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ + _validation = { + 'rule_set_name': {'readonly': True}, + } + _attribute_map = { + 'rule_set_name': {'key': 'properties.ruleSetName', 'type': 'str'}, 'order': {'key': 'properties.order', 'type': 'int'}, 'conditions': {'key': 'properties.conditions', 'type': '[DeliveryRuleCondition]'}, 'actions': {'key': 'properties.actions', 'type': '[DeliveryRuleAction]'}, @@ -7869,14 +11195,31 @@ def __init__( match_processing_behavior: Optional[Union[str, "MatchProcessingBehavior"]] = None, **kwargs ): + """ + :keyword order: The order in which the rules are applied for the endpoint. Possible values + {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. + Rule with order 0 is a special rule. It does not require any condition and actions listed in it + will always be applied. + :paramtype order: int + :keyword conditions: A list of conditions that must be matched for the actions to be executed. + :paramtype conditions: list[~azure.mgmt.cdn.models.DeliveryRuleCondition] + :keyword actions: A list of actions that are executed when all the conditions of a rule are + satisfied. + :paramtype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] + :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.cdn.models.MatchProcessingBehavior + """ super(RuleUpdateParameters, self).__init__(**kwargs) + self.rule_set_name = None self.order = order self.conditions = conditions self.actions = actions self.match_processing_behavior = match_processing_behavior -class Secret(Resource): +class Secret(ProxyResource): """Friendly Secret name mapping to the any Secret or secret related information. Variables are only populated by the server, and will be ignored when sending a request. @@ -7892,11 +11235,13 @@ class Secret(Resource): :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :param parameters: object which contains secret parameters. - :type parameters: ~azure.mgmt.cdn.models.SecretParameters + :ivar profile_name: The name of the profile which holds the secret. + :vartype profile_name: str + :ivar parameters: object which contains secret parameters. + :vartype parameters: ~azure.mgmt.cdn.models.SecretParameters """ _validation = { @@ -7906,6 +11251,7 @@ class Secret(Resource): 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, + 'profile_name': {'readonly': True}, } _attribute_map = { @@ -7915,6 +11261,7 @@ class Secret(Resource): 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, + 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, 'parameters': {'key': 'properties.parameters', 'type': 'SecretParameters'}, } @@ -7924,9 +11271,14 @@ def __init__( parameters: Optional["SecretParameters"] = None, **kwargs ): + """ + :keyword parameters: object which contains secret parameters. + :paramtype parameters: ~azure.mgmt.cdn.models.SecretParameters + """ super(Secret, self).__init__(**kwargs) self.provisioning_state = None self.deployment_status = None + self.profile_name = None self.parameters = parameters @@ -7937,8 +11289,8 @@ class SecretListResult(msrest.serialization.Model): :ivar value: List of AzureFrontDoor secrets within a profile. :vartype value: list[~azure.mgmt.cdn.models.Secret] - :param next_link: URL to get the next set of Secret objects if there are any. - :type next_link: str + :ivar next_link: URL to get the next set of Secret objects if there are any. + :vartype next_link: str """ _validation = { @@ -7956,6 +11308,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of Secret objects if there are any. + :paramtype next_link: str + """ super(SecretListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -7969,21 +11325,25 @@ class SecretProperties(AFDStateProperties): :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :param parameters: object which contains secret parameters. - :type parameters: ~azure.mgmt.cdn.models.SecretParameters + :ivar profile_name: The name of the profile which holds the secret. + :vartype profile_name: str + :ivar parameters: object which contains secret parameters. + :vartype parameters: ~azure.mgmt.cdn.models.SecretParameters """ _validation = { 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, + 'profile_name': {'readonly': True}, } _attribute_map = { 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, + 'profile_name': {'key': 'profileName', 'type': 'str'}, 'parameters': {'key': 'parameters', 'type': 'SecretParameters'}, } @@ -7993,11 +11353,16 @@ def __init__( parameters: Optional["SecretParameters"] = None, **kwargs ): + """ + :keyword parameters: object which contains secret parameters. + :paramtype parameters: ~azure.mgmt.cdn.models.SecretParameters + """ super(SecretProperties, self).__init__(**kwargs) + self.profile_name = None self.parameters = parameters -class SecurityPolicy(Resource): +class SecurityPolicy(ProxyResource): """SecurityPolicy association for AzureFrontDoor profile. Variables are only populated by the server, and will be ignored when sending a request. @@ -8013,11 +11378,13 @@ class SecurityPolicy(Resource): :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", "Updating", "Deleting", "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :param parameters: object which contains security policy parameters. - :type parameters: ~azure.mgmt.cdn.models.SecurityPolicyParameters + :ivar profile_name: The name of the profile which holds the security policy. + :vartype profile_name: str + :ivar parameters: object which contains security policy parameters. + :vartype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters """ _validation = { @@ -8027,6 +11394,7 @@ class SecurityPolicy(Resource): 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, + 'profile_name': {'readonly': True}, } _attribute_map = { @@ -8036,18 +11404,24 @@ class SecurityPolicy(Resource): 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - 'parameters': {'key': 'properties.parameters', 'type': 'SecurityPolicyParameters'}, + 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': 'SecurityPolicyPropertiesParameters'}, } def __init__( self, *, - parameters: Optional["SecurityPolicyParameters"] = None, + parameters: Optional["SecurityPolicyPropertiesParameters"] = None, **kwargs ): + """ + :keyword parameters: object which contains security policy parameters. + :paramtype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters + """ super(SecurityPolicy, self).__init__(**kwargs) self.provisioning_state = None self.deployment_status = None + self.profile_name = None self.parameters = parameters @@ -8058,8 +11432,8 @@ class SecurityPolicyListResult(msrest.serialization.Model): :ivar value: List of Security policies within a profile. :vartype value: list[~azure.mgmt.cdn.models.SecurityPolicy] - :param next_link: URL to get the next set of security policy objects if there is any. - :type next_link: str + :ivar next_link: URL to get the next set of security policy objects if there is any. + :vartype next_link: str """ _validation = { @@ -8077,12 +11451,61 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to get the next set of security policy objects if there is any. + :paramtype next_link: str + """ super(SecurityPolicyListResult, self).__init__(**kwargs) self.value = None self.next_link = next_link -class SecurityPolicyParameters(msrest.serialization.Model): +class SecurityPolicyProperties(AFDStateProperties): + """The json object that contains properties required to create a security policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", + "Updating", "Deleting", "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState + :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + "Failed". + :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus + :ivar profile_name: The name of the profile which holds the security policy. + :vartype profile_name: str + :ivar parameters: object which contains security policy parameters. + :vartype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'deployment_status': {'readonly': True}, + 'profile_name': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, + 'profile_name': {'key': 'profileName', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'SecurityPolicyPropertiesParameters'}, + } + + def __init__( + self, + *, + parameters: Optional["SecurityPolicyPropertiesParameters"] = None, + **kwargs + ): + """ + :keyword parameters: object which contains security policy parameters. + :paramtype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters + """ + super(SecurityPolicyProperties, self).__init__(**kwargs) + self.profile_name = None + self.parameters = parameters + + +class SecurityPolicyPropertiesParameters(msrest.serialization.Model): """The json object containing security policy parameters. You probably want to use the sub-classes and not this class directly. Known @@ -8090,9 +11513,9 @@ class SecurityPolicyParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the Security policy to create.Constant filled by server. + :ivar type: Required. The type of the Security policy to create.Constant filled by server. Possible values include: "WebApplicationFirewall". - :type type: str or ~azure.mgmt.cdn.models.SecurityPolicyType + :vartype type: str or ~azure.mgmt.cdn.models.SecurityPolicyType """ _validation = { @@ -8111,84 +11534,81 @@ def __init__( self, **kwargs ): - super(SecurityPolicyParameters, self).__init__(**kwargs) + """ + """ + super(SecurityPolicyPropertiesParameters, self).__init__(**kwargs) self.type = None # type: Optional[str] -class SecurityPolicyProperties(AFDStateProperties): - """The json object that contains properties required to create a security policy. - - Variables are only populated by the server, and will be ignored when sending a request. +class SecurityPolicyUpdateParameters(msrest.serialization.Model): + """The JSON object containing security policy update parameters. - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus - :param parameters: object which contains security policy parameters. - :type parameters: ~azure.mgmt.cdn.models.SecurityPolicyParameters + :ivar parameters: object which contains security policy parameters. + :vartype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters """ - _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - } - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'SecurityPolicyParameters'}, + 'parameters': {'key': 'properties.parameters', 'type': 'SecurityPolicyPropertiesParameters'}, } def __init__( self, *, - parameters: Optional["SecurityPolicyParameters"] = None, + parameters: Optional["SecurityPolicyPropertiesParameters"] = None, **kwargs ): - super(SecurityPolicyProperties, self).__init__(**kwargs) + """ + :keyword parameters: object which contains security policy parameters. + :paramtype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters + """ + super(SecurityPolicyUpdateParameters, self).__init__(**kwargs) self.parameters = parameters class SecurityPolicyWebApplicationFirewallAssociation(msrest.serialization.Model): """settings for security policy patterns to match. - :param domains: List of domains. - :type domains: list[~azure.mgmt.cdn.models.ResourceReference] - :param patterns_to_match: List of paths. - :type patterns_to_match: list[str] + :ivar domains: List of domains. + :vartype domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] + :ivar patterns_to_match: List of paths. + :vartype patterns_to_match: list[str] """ _attribute_map = { - 'domains': {'key': 'domains', 'type': '[ResourceReference]'}, + 'domains': {'key': 'domains', 'type': '[ActivatedResourceReference]'}, 'patterns_to_match': {'key': 'patternsToMatch', 'type': '[str]'}, } def __init__( self, *, - domains: Optional[List["ResourceReference"]] = None, + domains: Optional[List["ActivatedResourceReference"]] = None, patterns_to_match: Optional[List[str]] = None, **kwargs ): + """ + :keyword domains: List of domains. + :paramtype domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] + :keyword patterns_to_match: List of paths. + :paramtype patterns_to_match: list[str] + """ super(SecurityPolicyWebApplicationFirewallAssociation, self).__init__(**kwargs) self.domains = domains self.patterns_to_match = patterns_to_match -class SecurityPolicyWebApplicationFirewallParameters(SecurityPolicyParameters): +class SecurityPolicyWebApplicationFirewallParameters(SecurityPolicyPropertiesParameters): """The json object containing security policy waf parameters. All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the Security policy to create.Constant filled by server. + :ivar type: Required. The type of the Security policy to create.Constant filled by server. Possible values include: "WebApplicationFirewall". - :type type: str or ~azure.mgmt.cdn.models.SecurityPolicyType - :param waf_policy: Resource ID. - :type waf_policy: ~azure.mgmt.cdn.models.ResourceReference - :param associations: Waf associations. - :type associations: + :vartype type: str or ~azure.mgmt.cdn.models.SecurityPolicyType + :ivar waf_policy: Resource ID. + :vartype waf_policy: ~azure.mgmt.cdn.models.ResourceReference + :ivar associations: Waf associations. + :vartype associations: list[~azure.mgmt.cdn.models.SecurityPolicyWebApplicationFirewallAssociation] """ @@ -8209,29 +11629,132 @@ def __init__( associations: Optional[List["SecurityPolicyWebApplicationFirewallAssociation"]] = None, **kwargs ): + """ + :keyword waf_policy: Resource ID. + :paramtype waf_policy: ~azure.mgmt.cdn.models.ResourceReference + :keyword associations: Waf associations. + :paramtype associations: + list[~azure.mgmt.cdn.models.SecurityPolicyWebApplicationFirewallAssociation] + """ super(SecurityPolicyWebApplicationFirewallParameters, self).__init__(**kwargs) self.type = 'WebApplicationFirewall' # type: str self.waf_policy = waf_policy self.associations = associations +class ServerPortMatchConditionParameters(msrest.serialization.Model): + """Defines the parameters for ServerPort match conditions. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type_name: Has constant value: "DeliveryRuleServerPortConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :vartype operator: str or ~azure.mgmt.cdn.models.ServerPortOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ + + _validation = { + 'type_name': {'required': True, 'constant': True}, + 'operator': {'required': True}, + } + + _attribute_map = { + 'type_name': {'key': 'typeName', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, + 'match_values': {'key': 'matchValues', 'type': '[str]'}, + 'transforms': {'key': 'transforms', 'type': '[str]'}, + } + + type_name = "DeliveryRuleServerPortConditionParameters" + + def __init__( + self, + *, + operator: Union[str, "ServerPortOperator"], + negate_condition: Optional[bool] = None, + match_values: Optional[List[str]] = None, + transforms: Optional[List[Union[str, "Transform"]]] = None, + **kwargs + ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.ServerPortOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ + super(ServerPortMatchConditionParameters, self).__init__(**kwargs) + self.operator = operator + self.negate_condition = negate_condition + self.match_values = match_values + self.transforms = transforms + + +class ServiceSpecification(msrest.serialization.Model): + """One property of operation, include log specifications. + + :ivar log_specifications: Log specifications of operation. + :vartype log_specifications: list[~azure.mgmt.cdn.models.LogSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: list[~azure.mgmt.cdn.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): + """ + :keyword log_specifications: Log specifications of operation. + :paramtype log_specifications: list[~azure.mgmt.cdn.models.LogSpecification] + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: list[~azure.mgmt.cdn.models.MetricSpecification] + """ + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + class SharedPrivateLinkResourceProperties(msrest.serialization.Model): """Describes the properties of an existing Shared Private Link Resource to use when connecting to a private origin. - :param private_link: The resource id of the resource the shared private link resource is for. - :type private_link: ~azure.mgmt.cdn.models.ResourceReference - :param private_link_location: The location of the shared private link resource. - :type private_link_location: str - :param group_id: The group id from the provider of resource the shared private link resource is + :ivar private_link: The resource id of the resource the shared private link resource is for. + :vartype private_link: ~azure.mgmt.cdn.models.ResourceReference + :ivar private_link_location: The location of the shared private link resource. + :vartype private_link_location: str + :ivar group_id: The group id from the provider of resource the shared private link resource is for. - :type group_id: str - :param request_message: The request message for requesting approval of the shared private link + :vartype group_id: str + :ivar request_message: The request message for requesting approval of the shared private link resource. - :type request_message: str - :param status: Status of the shared private link resource. Can be Pending, Approved, Rejected, + :vartype request_message: str + :ivar status: Status of the shared private link resource. Can be Pending, Approved, Rejected, Disconnected, or Timeout. Possible values include: "Pending", "Approved", "Rejected", "Disconnected", "Timeout". - :type status: str or ~azure.mgmt.cdn.models.SharedPrivateLinkResourceStatus + :vartype status: str or ~azure.mgmt.cdn.models.SharedPrivateLinkResourceStatus """ _attribute_map = { @@ -8252,6 +11775,22 @@ def __init__( status: Optional[Union[str, "SharedPrivateLinkResourceStatus"]] = None, **kwargs ): + """ + :keyword private_link: The resource id of the resource the shared private link resource is for. + :paramtype private_link: ~azure.mgmt.cdn.models.ResourceReference + :keyword private_link_location: The location of the shared private link resource. + :paramtype private_link_location: str + :keyword group_id: The group id from the provider of resource the shared private link resource + is for. + :paramtype group_id: str + :keyword request_message: The request message for requesting approval of the shared private + link resource. + :paramtype request_message: str + :keyword status: Status of the shared private link resource. Can be Pending, Approved, + Rejected, Disconnected, or Timeout. Possible values include: "Pending", "Approved", "Rejected", + "Disconnected", "Timeout". + :paramtype status: str or ~azure.mgmt.cdn.models.SharedPrivateLinkResourceStatus + """ super(SharedPrivateLinkResourceProperties, self).__init__(**kwargs) self.private_link = private_link self.private_link_location = private_link_location @@ -8261,14 +11800,26 @@ def __init__( class Sku(msrest.serialization.Model): - """The pricing tier (defines a CDN provider, feature list and rate) of the CDN profile. - - :param name: Name of the pricing tier. Possible values include: "Standard_Verizon", + """Standard_Verizon = The SKU name for a Standard Verizon CDN profile. +Premium_Verizon = The SKU name for a Premium Verizon CDN profile. +Custom_Verizon = The SKU name for a Custom Verizon CDN profile. +Standard_Akamai = The SKU name for an Akamai CDN profile. +Standard_ChinaCdn = The SKU name for a China CDN profile for VOD, Web and download scenarios using GB based billing model. +Standard_Microsoft = The SKU name for a Standard Microsoft CDN profile. +Standard_AzureFrontDoor = The SKU name for an Azure Front Door Standard profile. +Premium_AzureFrontDoor = The SKU name for an Azure Front Door Premium profile. +Standard_955BandWidth_ChinaCdn = The SKU name for a China CDN profile for VOD, Web and download scenarios using 95-5 peak bandwidth billing model. +Standard_AvgBandWidth_ChinaCdn = The SKU name for a China CDN profile for VOD, Web and download scenarios using monthly average peak bandwidth billing model. +StandardPlus_ChinaCdn = The SKU name for a China CDN profile for live-streaming using GB based billing model. +StandardPlus_955BandWidth_ChinaCdn = The SKU name for a China CDN live-streaming profile using 95-5 peak bandwidth billing model. +StandardPlus_AvgBandWidth_ChinaCdn = The SKU name for a China CDN live-streaming profile using monthly average peak bandwidth billing model. + + :ivar name: Name of the pricing tier. Possible values include: "Standard_Verizon", "Premium_Verizon", "Custom_Verizon", "Standard_Akamai", "Standard_ChinaCdn", - "Standard_Microsoft", "Premium_ChinaCdn", "Standard_AzureFrontDoor", "Premium_AzureFrontDoor", + "Standard_Microsoft", "Standard_AzureFrontDoor", "Premium_AzureFrontDoor", "Standard_955BandWidth_ChinaCdn", "Standard_AvgBandWidth_ChinaCdn", "StandardPlus_ChinaCdn", "StandardPlus_955BandWidth_ChinaCdn", "StandardPlus_AvgBandWidth_ChinaCdn". - :type name: str or ~azure.mgmt.cdn.models.SkuName + :vartype name: str or ~azure.mgmt.cdn.models.SkuName """ _attribute_map = { @@ -8281,10 +11832,141 @@ def __init__( name: Optional[Union[str, "SkuName"]] = None, **kwargs ): + """ + :keyword name: Name of the pricing tier. Possible values include: "Standard_Verizon", + "Premium_Verizon", "Custom_Verizon", "Standard_Akamai", "Standard_ChinaCdn", + "Standard_Microsoft", "Standard_AzureFrontDoor", "Premium_AzureFrontDoor", + "Standard_955BandWidth_ChinaCdn", "Standard_AvgBandWidth_ChinaCdn", "StandardPlus_ChinaCdn", + "StandardPlus_955BandWidth_ChinaCdn", "StandardPlus_AvgBandWidth_ChinaCdn". + :paramtype name: str or ~azure.mgmt.cdn.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name +class SocketAddrMatchConditionParameters(msrest.serialization.Model): + """Defines the parameters for SocketAddress match conditions. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type_name: Has constant value: "DeliveryRuleSocketAddrConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", + "IPMatch". + :vartype operator: str or ~azure.mgmt.cdn.models.SocketAddrOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ + + _validation = { + 'type_name': {'required': True, 'constant': True}, + 'operator': {'required': True}, + } + + _attribute_map = { + 'type_name': {'key': 'typeName', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, + 'match_values': {'key': 'matchValues', 'type': '[str]'}, + 'transforms': {'key': 'transforms', 'type': '[str]'}, + } + + type_name = "DeliveryRuleSocketAddrConditionParameters" + + def __init__( + self, + *, + operator: Union[str, "SocketAddrOperator"], + negate_condition: Optional[bool] = None, + match_values: Optional[List[str]] = None, + transforms: Optional[List[Union[str, "Transform"]]] = None, + **kwargs + ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "IPMatch". + :paramtype operator: str or ~azure.mgmt.cdn.models.SocketAddrOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ + super(SocketAddrMatchConditionParameters, self).__init__(**kwargs) + self.operator = operator + self.negate_condition = negate_condition + self.match_values = match_values + self.transforms = transforms + + +class SslProtocolMatchConditionParameters(msrest.serialization.Model): + """Defines the parameters for SslProtocol match conditions. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type_name: Has constant value: "DeliveryRuleSslProtocolConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Equal". + :vartype operator: str or ~azure.mgmt.cdn.models.SslProtocolOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str or ~azure.mgmt.cdn.models.SslProtocol] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ + + _validation = { + 'type_name': {'required': True, 'constant': True}, + 'operator': {'required': True}, + } + + _attribute_map = { + 'type_name': {'key': 'typeName', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, + 'match_values': {'key': 'matchValues', 'type': '[str]'}, + 'transforms': {'key': 'transforms', 'type': '[str]'}, + } + + type_name = "DeliveryRuleSslProtocolConditionParameters" + + def __init__( + self, + *, + operator: Union[str, "SslProtocolOperator"], + negate_condition: Optional[bool] = None, + match_values: Optional[List[Union[str, "SslProtocol"]]] = None, + transforms: Optional[List[Union[str, "Transform"]]] = None, + **kwargs + ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: + "Equal". + :paramtype operator: str or ~azure.mgmt.cdn.models.SslProtocolOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str or ~azure.mgmt.cdn.models.SslProtocol] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ + super(SslProtocolMatchConditionParameters, self).__init__(**kwargs) + self.operator = operator + self.negate_condition = negate_condition + self.match_values = match_values + self.transforms = transforms + + class SsoUri(msrest.serialization.Model): """The URI required to login to the supplemental portal from the Azure portal. @@ -8306,6 +11988,8 @@ def __init__( self, **kwargs ): + """ + """ super(SsoUri, self).__init__(**kwargs) self.sso_uri_value = None @@ -8331,6 +12015,8 @@ def __init__( self, **kwargs ): + """ + """ super(SupportedOptimizationTypesListResult, self).__init__(**kwargs) self.supported_optimization_types = None @@ -8338,20 +12024,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Read only system data. - :param created_by: An identifier for the identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "user", "application", "managedIdentity", "key". - :type created_by_type: str or ~azure.mgmt.cdn.models.IdentityType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: An identifier for the identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: An identifier for the identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "user", "application", "managedIdentity", "key". + :vartype created_by_type: str or ~azure.mgmt.cdn.models.IdentityType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: An identifier for the identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "user", "application", "managedIdentity", "key". - :type last_modified_by_type: str or ~azure.mgmt.cdn.models.IdentityType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.cdn.models.IdentityType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -8374,6 +12060,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: An identifier for the identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "user", "application", "managedIdentity", "key". + :paramtype created_by_type: str or ~azure.mgmt.cdn.models.IdentityType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: An identifier for the identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "user", "application", "managedIdentity", "key". + :paramtype last_modified_by_type: str or ~azure.mgmt.cdn.models.IdentityType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -8390,35 +12092,34 @@ class UrlFileExtensionMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFileExtensionMatchConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :ivar type_name: Has constant value: "DeliveryRuleUrlFileExtensionMatchConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.UrlFileExtensionOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :vartype operator: str or ~azure.mgmt.cdn.models.UrlFileExtensionOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFileExtensionMatchConditionParameters" + type_name = "DeliveryRuleUrlFileExtensionMatchConditionParameters" def __init__( self, @@ -8429,6 +12130,18 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.UrlFileExtensionOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(UrlFileExtensionMatchConditionParameters, self).__init__(**kwargs) self.operator = operator self.negate_condition = negate_condition @@ -8443,35 +12156,34 @@ class UrlFileNameMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFilenameConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :ivar type_name: Has constant value: "DeliveryRuleUrlFilenameConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", "GreaterThanOrEqual", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.UrlFileNameOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :vartype operator: str or ~azure.mgmt.cdn.models.UrlFileNameOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFilenameConditionParameters" + type_name = "DeliveryRuleUrlFilenameConditionParameters" def __init__( self, @@ -8482,6 +12194,18 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.UrlFileNameOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(UrlFileNameMatchConditionParameters, self).__init__(**kwargs) self.operator = operator self.negate_condition = negate_condition @@ -8496,35 +12220,34 @@ class UrlPathMatchConditionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlPathMatchConditionParameters". - :vartype odata_type: str - :param operator: Required. Describes operator to be matched. Possible values include: "Any", + :ivar type_name: Has constant value: "DeliveryRuleUrlPathMatchConditionParameters". + :vartype type_name: str + :ivar operator: Required. Describes operator to be matched. Possible values include: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", "GreaterThanOrEqual", "Wildcard", "RegEx". - :type operator: str or ~azure.mgmt.cdn.models.UrlPathOperator - :param negate_condition: Describes if this is negate condition or not. - :type negate_condition: bool - :param match_values: The match value for the condition of the delivery rule. - :type match_values: list[str] - :param transforms: List of transforms. - :type transforms: list[str or ~azure.mgmt.cdn.models.Transform] + :vartype operator: str or ~azure.mgmt.cdn.models.UrlPathOperator + :ivar negate_condition: Describes if this is negate condition or not. + :vartype negate_condition: bool + :ivar match_values: The match value for the condition of the delivery rule. + :vartype match_values: list[str] + :ivar transforms: List of transforms. + :vartype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'operator': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'operator': {'key': 'operator', 'type': 'str'}, 'negate_condition': {'key': 'negateCondition', 'type': 'bool'}, 'match_values': {'key': 'matchValues', 'type': '[str]'}, 'transforms': {'key': 'transforms', 'type': '[str]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlPathMatchConditionParameters" + type_name = "DeliveryRuleUrlPathMatchConditionParameters" def __init__( self, @@ -8535,6 +12258,18 @@ def __init__( transforms: Optional[List[Union[str, "Transform"]]] = None, **kwargs ): + """ + :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "Wildcard", "RegEx". + :paramtype operator: str or ~azure.mgmt.cdn.models.UrlPathOperator + :keyword negate_condition: Describes if this is negate condition or not. + :paramtype negate_condition: bool + :keyword match_values: The match value for the condition of the delivery rule. + :paramtype match_values: list[str] + :keyword transforms: List of transforms. + :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] + """ super(UrlPathMatchConditionParameters, self).__init__(**kwargs) self.operator = operator self.negate_condition = negate_condition @@ -8547,12 +12282,13 @@ class UrlRedirectAction(DeliveryRuleAction): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the action for the delivery rule.Constant filled by server. + :ivar name: Required. The name of the action for the delivery rule.Constant filled by server. Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.UrlRedirectActionParameters + "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", + "RouteConfigurationOverride". + :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum + :ivar parameters: Required. Defines the parameters for the action. + :vartype parameters: ~azure.mgmt.cdn.models.UrlRedirectActionParameters """ _validation = { @@ -8571,6 +12307,10 @@ def __init__( parameters: "UrlRedirectActionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the action. + :paramtype parameters: ~azure.mgmt.cdn.models.UrlRedirectActionParameters + """ super(UrlRedirectAction, self).__init__(**kwargs) self.name = 'UrlRedirect' # type: str self.parameters = parameters @@ -8583,38 +12323,37 @@ class UrlRedirectActionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlRedirectActionParameters". - :vartype odata_type: str - :param redirect_type: Required. The redirect type the rule will use when redirecting traffic. + :ivar type_name: Has constant value: "DeliveryRuleUrlRedirectActionParameters". + :vartype type_name: str + :ivar redirect_type: Required. The redirect type the rule will use when redirecting traffic. Possible values include: "Moved", "Found", "TemporaryRedirect", "PermanentRedirect". - :type redirect_type: str or ~azure.mgmt.cdn.models.RedirectType - :param destination_protocol: Protocol to use for the redirect. The default value is + :vartype redirect_type: str or ~azure.mgmt.cdn.models.RedirectType + :ivar destination_protocol: Protocol to use for the redirect. The default value is MatchRequest. Possible values include: "MatchRequest", "Http", "Https". - :type destination_protocol: str or ~azure.mgmt.cdn.models.DestinationProtocol - :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_hostname: Host to redirect. Leave empty to use the incoming host as the + :vartype destination_protocol: str or ~azure.mgmt.cdn.models.DestinationProtocol + :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_hostname: Host to redirect. Leave empty to use the incoming host as the destination host. - :type custom_hostname: str - :param custom_query_string: The set of query strings to be placed in the redirect URL. Setting + :vartype custom_hostname: 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. ? and & will be added automatically so do not include them. - :type custom_query_string: str - :param custom_fragment: Fragment to add to the redirect URL. Fragment is the part of the URL + :vartype custom_query_string: 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 + :vartype custom_fragment: str """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'redirect_type': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'redirect_type': {'key': 'redirectType', 'type': 'str'}, 'destination_protocol': {'key': 'destinationProtocol', 'type': 'str'}, 'custom_path': {'key': 'customPath', 'type': 'str'}, @@ -8623,7 +12362,7 @@ class UrlRedirectActionParameters(msrest.serialization.Model): 'custom_fragment': {'key': 'customFragment', 'type': 'str'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlRedirectActionParameters" + type_name = "DeliveryRuleUrlRedirectActionParameters" def __init__( self, @@ -8636,6 +12375,28 @@ def __init__( custom_fragment: Optional[str] = None, **kwargs ): + """ + :keyword redirect_type: Required. The redirect type the rule will use when redirecting traffic. + Possible values include: "Moved", "Found", "TemporaryRedirect", "PermanentRedirect". + :paramtype redirect_type: str or ~azure.mgmt.cdn.models.RedirectType + :keyword destination_protocol: Protocol to use for the redirect. The default value is + MatchRequest. Possible values include: "MatchRequest", "Http", "Https". + :paramtype destination_protocol: str or ~azure.mgmt.cdn.models.DestinationProtocol + :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_hostname: Host to redirect. Leave empty to use the incoming host as the + destination host. + :paramtype custom_hostname: 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. ? and & + will be added automatically so do not include them. + :paramtype custom_query_string: 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 + """ super(UrlRedirectActionParameters, self).__init__(**kwargs) self.redirect_type = redirect_type self.destination_protocol = destination_protocol @@ -8650,12 +12411,13 @@ class UrlRewriteAction(DeliveryRuleAction): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the action for the delivery rule.Constant filled by server. + :ivar name: Required. The name of the action for the delivery rule.Constant filled by server. Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.UrlRewriteActionParameters + "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", + "RouteConfigurationOverride". + :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum + :ivar parameters: Required. Defines the parameters for the action. + :vartype parameters: ~azure.mgmt.cdn.models.UrlRewriteActionParameters """ _validation = { @@ -8674,6 +12436,10 @@ def __init__( parameters: "UrlRewriteActionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the action. + :paramtype parameters: ~azure.mgmt.cdn.models.UrlRewriteActionParameters + """ super(UrlRewriteAction, self).__init__(**kwargs) self.name = 'UrlRewrite' # type: str self.parameters = parameters @@ -8686,33 +12452,32 @@ class UrlRewriteActionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlRewriteActionParameters". - :vartype odata_type: str - :param source_pattern: Required. define a request URI pattern that identifies the type of + :ivar type_name: Has constant value: "DeliveryRuleUrlRewriteActionParameters". + :vartype type_name: str + :ivar source_pattern: Required. define a request URI pattern that identifies the type of requests that may be rewritten. If value is blank, all strings are matched. - :type source_pattern: str - :param destination: Required. Define the relative URL to which the above requests will be + :vartype source_pattern: str + :ivar destination: Required. Define the relative URL to which the above requests will be rewritten by. - :type destination: str - :param preserve_unmatched_path: Whether to preserve unmatched path. Default value is true. - :type preserve_unmatched_path: bool + :vartype destination: str + :ivar preserve_unmatched_path: Whether to preserve unmatched path. Default value is true. + :vartype preserve_unmatched_path: bool """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, 'source_pattern': {'required': True}, 'destination': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'source_pattern': {'key': 'sourcePattern', 'type': 'str'}, 'destination': {'key': 'destination', 'type': 'str'}, 'preserve_unmatched_path': {'key': 'preserveUnmatchedPath', 'type': 'bool'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlRewriteActionParameters" + type_name = "DeliveryRuleUrlRewriteActionParameters" def __init__( self, @@ -8722,6 +12487,16 @@ def __init__( preserve_unmatched_path: Optional[bool] = None, **kwargs ): + """ + :keyword source_pattern: Required. define a request URI pattern that identifies the type of + requests that may be rewritten. If value is blank, all strings are matched. + :paramtype source_pattern: str + :keyword destination: Required. Define the relative URL to which the above requests will be + rewritten by. + :paramtype destination: str + :keyword preserve_unmatched_path: Whether to preserve unmatched path. Default value is true. + :paramtype preserve_unmatched_path: bool + """ super(UrlRewriteActionParameters, self).__init__(**kwargs) self.source_pattern = source_pattern self.destination = destination @@ -8733,12 +12508,13 @@ class UrlSigningAction(DeliveryRuleAction): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the action for the delivery rule.Constant filled by server. + :ivar name: Required. The name of the action for the delivery rule.Constant filled by server. Possible values include: "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", - "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride". - :type name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :param parameters: Required. Defines the parameters for the action. - :type parameters: ~azure.mgmt.cdn.models.UrlSigningActionParameters + "ModifyResponseHeader", "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", + "RouteConfigurationOverride". + :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum + :ivar parameters: Required. Defines the parameters for the action. + :vartype parameters: ~azure.mgmt.cdn.models.UrlSigningActionParameters """ _validation = { @@ -8757,6 +12533,10 @@ def __init__( parameters: "UrlSigningActionParameters", **kwargs ): + """ + :keyword parameters: Required. Defines the parameters for the action. + :paramtype parameters: ~azure.mgmt.cdn.models.UrlSigningActionParameters + """ super(UrlSigningAction, self).__init__(**kwargs) self.name = 'UrlSigning' # type: str self.parameters = parameters @@ -8769,27 +12549,26 @@ class UrlSigningActionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar odata_type: Required. Default value: - "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlSigningActionParameters". - :vartype odata_type: str - :param algorithm: Algorithm to use for URL signing. Possible values include: "SHA256". - :type algorithm: str or ~azure.mgmt.cdn.models.Algorithm - :param parameter_name_override: Defines which query string parameters in the url to be + :ivar type_name: Has constant value: "DeliveryRuleUrlSigningActionParameters". + :vartype type_name: str + :ivar algorithm: Algorithm to use for URL signing. Possible values include: "SHA256". + :vartype algorithm: str or ~azure.mgmt.cdn.models.Algorithm + :ivar parameter_name_override: Defines which query string parameters in the url to be considered for expires, key id etc. - :type parameter_name_override: list[~azure.mgmt.cdn.models.UrlSigningParamIdentifier] + :vartype parameter_name_override: list[~azure.mgmt.cdn.models.UrlSigningParamIdentifier] """ _validation = { - 'odata_type': {'required': True, 'constant': True}, + 'type_name': {'required': True, 'constant': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, 'algorithm': {'key': 'algorithm', 'type': 'str'}, 'parameter_name_override': {'key': 'parameterNameOverride', 'type': '[UrlSigningParamIdentifier]'}, } - odata_type = "#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlSigningActionParameters" + type_name = "DeliveryRuleUrlSigningActionParameters" def __init__( self, @@ -8798,6 +12577,13 @@ def __init__( parameter_name_override: Optional[List["UrlSigningParamIdentifier"]] = None, **kwargs ): + """ + :keyword algorithm: Algorithm to use for URL signing. Possible values include: "SHA256". + :paramtype algorithm: str or ~azure.mgmt.cdn.models.Algorithm + :keyword parameter_name_override: Defines which query string parameters in the url to be + considered for expires, key id etc. + :paramtype parameter_name_override: list[~azure.mgmt.cdn.models.UrlSigningParamIdentifier] + """ super(UrlSigningActionParameters, self).__init__(**kwargs) self.algorithm = algorithm self.parameter_name_override = parameter_name_override @@ -8808,12 +12594,12 @@ class UrlSigningKey(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_id: Required. Defines the customer defined key Id. This id will exist in the - incoming request to indicate the key used to form the hash. - :type key_id: str - :param key_source_parameters: Required. Defines the parameters for using customer key vault for + :ivar key_id: Required. Defines the customer defined key Id. This id will exist in the incoming + request to indicate the key used to form the hash. + :vartype key_id: str + :ivar key_source_parameters: Required. Defines the parameters for using customer key vault for Url Signing Key. - :type key_source_parameters: ~azure.mgmt.cdn.models.KeyVaultSigningKeyParameters + :vartype key_source_parameters: ~azure.mgmt.cdn.models.KeyVaultSigningKeyParameters """ _validation = { @@ -8833,6 +12619,14 @@ def __init__( key_source_parameters: "KeyVaultSigningKeyParameters", **kwargs ): + """ + :keyword key_id: Required. Defines the customer defined key Id. This id will exist in the + incoming request to indicate the key used to form the hash. + :paramtype key_id: str + :keyword key_source_parameters: Required. Defines the parameters for using customer key vault + for Url Signing Key. + :paramtype key_source_parameters: ~azure.mgmt.cdn.models.KeyVaultSigningKeyParameters + """ super(UrlSigningKey, self).__init__(**kwargs) self.key_id = key_id self.key_source_parameters = key_source_parameters @@ -8843,16 +12637,19 @@ class UrlSigningKeyParameters(SecretParameters): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the Secret to create.Constant filled by server. Possible - values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate". - :type type: str or ~azure.mgmt.cdn.models.SecretType - :param key_id: Required. Defines the customer defined key Id. This id will exist in the - incoming request to indicate the key used to form the hash. - :type key_id: str - :param secret_source: Required. Resource reference to the KV secret. - :type secret_source: ~azure.mgmt.cdn.models.ResourceReference - :param secret_version: Version of the secret to be used. - :type secret_version: str + :ivar type: Required. The type of the secret resource.Constant filled by server. Possible + values include: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate", + "AzureFirstPartyManagedCertificate". + :vartype type: str or ~azure.mgmt.cdn.models.SecretType + :ivar key_id: Required. Defines the customer defined key Id. This id will exist in the incoming + request to indicate the key used to form the hash. + :vartype key_id: str + :ivar secret_source: Required. Resource reference to the Azure Key Vault secret. Expected to be + in format of + /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + :vartype secret_source: ~azure.mgmt.cdn.models.ResourceReference + :ivar secret_version: Version of the secret to be used. + :vartype secret_version: str """ _validation = { @@ -8876,6 +12673,17 @@ def __init__( secret_version: Optional[str] = None, **kwargs ): + """ + :keyword key_id: Required. Defines the customer defined key Id. This id will exist in the + incoming request to indicate the key used to form the hash. + :paramtype key_id: str + :keyword secret_source: Required. Resource reference to the Azure Key Vault secret. Expected to + be in format of + /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + :paramtype secret_source: ~azure.mgmt.cdn.models.ResourceReference + :keyword secret_version: Version of the secret to be used. + :paramtype secret_version: str + """ super(UrlSigningKeyParameters, self).__init__(**kwargs) self.type = 'UrlSigningKey' # type: str self.key_id = key_id @@ -8888,11 +12696,11 @@ class UrlSigningParamIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param param_indicator: Required. Indicates the purpose of the parameter. Possible values + :ivar param_indicator: Required. Indicates the purpose of the parameter. Possible values include: "Expires", "KeyId", "Signature". - :type param_indicator: str or ~azure.mgmt.cdn.models.ParamIndicator - :param param_name: Required. Parameter name. - :type param_name: str + :vartype param_indicator: str or ~azure.mgmt.cdn.models.ParamIndicator + :ivar param_name: Required. Parameter name. + :vartype param_name: str """ _validation = { @@ -8912,6 +12720,13 @@ def __init__( param_name: str, **kwargs ): + """ + :keyword param_indicator: Required. Indicates the purpose of the parameter. Possible values + include: "Expires", "KeyId", "Signature". + :paramtype param_indicator: str or ~azure.mgmt.cdn.models.ParamIndicator + :keyword param_name: Required. Parameter name. + :paramtype param_name: str + """ super(UrlSigningParamIdentifier, self).__init__(**kwargs) self.param_indicator = param_indicator self.param_name = param_name @@ -8926,15 +12741,15 @@ class Usage(msrest.serialization.Model): :ivar id: Resource identifier. :vartype id: str - :param unit: Required. An enum describing the unit of measurement. Possible values include: + :ivar unit: Required. An enum describing the unit of measurement. Possible values include: "Count". - :type unit: str or ~azure.mgmt.cdn.models.UsageUnit - :param current_value: Required. The current value of the usage. - :type current_value: long - :param limit: Required. The limit of usage. - :type limit: long - :param name: Required. The name of the type of usage. - :type name: ~azure.mgmt.cdn.models.UsageName + :vartype unit: str or ~azure.mgmt.cdn.models.UsageUnit + :ivar current_value: Required. The current value of the usage. + :vartype current_value: long + :ivar limit: Required. The limit of usage. + :vartype limit: long + :ivar name: Required. The name of the type of usage. + :vartype name: ~azure.mgmt.cdn.models.UsageName """ _validation = { @@ -8962,6 +12777,17 @@ def __init__( name: "UsageName", **kwargs ): + """ + :keyword unit: Required. An enum describing the unit of measurement. Possible values include: + "Count". + :paramtype unit: str or ~azure.mgmt.cdn.models.UsageUnit + :keyword current_value: Required. The current value of the usage. + :paramtype current_value: long + :keyword limit: Required. The limit of usage. + :paramtype limit: long + :keyword name: Required. The name of the type of usage. + :paramtype name: ~azure.mgmt.cdn.models.UsageName + """ super(Usage, self).__init__(**kwargs) self.id = None self.unit = unit @@ -8973,10 +12799,10 @@ def __init__( class UsageName(msrest.serialization.Model): """The usage names. - :param value: A string describing the resource name. - :type value: str - :param localized_value: A localized string describing the resource name. - :type localized_value: str + :ivar value: A string describing the resource name. + :vartype value: str + :ivar localized_value: A localized string describing the resource name. + :vartype localized_value: str """ _attribute_map = { @@ -8991,6 +12817,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: A string describing the resource name. + :paramtype value: str + :keyword localized_value: A localized string describing the resource name. + :paramtype localized_value: str + """ super(UsageName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -8999,10 +12831,10 @@ def __init__( class UsagesListResult(msrest.serialization.Model): """The list usages operation response. - :param value: The list of resource usages. - :type value: list[~azure.mgmt.cdn.models.Usage] - :param next_link: URL to get the next set of results. - :type next_link: str + :ivar value: The list of resource usages. + :vartype value: list[~azure.mgmt.cdn.models.Usage] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -9017,28 +12849,67 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of resource usages. + :paramtype value: list[~azure.mgmt.cdn.models.Usage] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ super(UsagesListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link +class UserAssignedIdentity(msrest.serialization.Model): + """User Assigned identity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user assigned identity. + :vartype principal_id: str + :ivar client_id: Client Id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + class UserManagedHttpsParameters(CustomDomainHttpsParameters): """Defines the certificate source parameters using user's keyvault certificate for enabling SSL. All required parameters must be populated in order to send to Azure. - :param certificate_source: Required. Defines the source of the SSL certificate.Constant filled - by server. Possible values include: "AzureKeyVault", "Cdn". - :type certificate_source: str or ~azure.mgmt.cdn.models.CertificateSource - :param protocol_type: Required. Defines the TLS extension protocol that is used for secure + :ivar certificate_source: Required. Defines the source of the SSL certificate.Constant filled + by server. Possible values include: "AzureKeyVault", "Cdn". + :vartype certificate_source: str or ~azure.mgmt.cdn.models.CertificateSource + :ivar protocol_type: Required. Defines the TLS extension protocol that is used for secure delivery. Possible values include: "ServerNameIndication", "IPBased". - :type protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType - :param minimum_tls_version: TLS protocol version that will be used for Https. Possible values + :vartype protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType + :ivar minimum_tls_version: TLS protocol version that will be used for Https. Possible values include: "None", "TLS10", "TLS12". - :type minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion - :param certificate_source_parameters: Required. Defines the certificate source parameters using + :vartype minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion + :ivar certificate_source_parameters: Required. Defines the certificate source parameters using user's keyvault certificate for enabling SSL. - :type certificate_source_parameters: ~azure.mgmt.cdn.models.KeyVaultCertificateSourceParameters + :vartype certificate_source_parameters: + ~azure.mgmt.cdn.models.KeyVaultCertificateSourceParameters """ _validation = { @@ -9062,6 +12933,18 @@ def __init__( minimum_tls_version: Optional[Union[str, "MinimumTlsVersion"]] = None, **kwargs ): + """ + :keyword protocol_type: Required. Defines the TLS extension protocol that is used for secure + delivery. Possible values include: "ServerNameIndication", "IPBased". + :paramtype protocol_type: str or ~azure.mgmt.cdn.models.ProtocolType + :keyword minimum_tls_version: TLS protocol version that will be used for Https. Possible values + include: "None", "TLS10", "TLS12". + :paramtype minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion + :keyword certificate_source_parameters: Required. Defines the certificate source parameters + using user's keyvault certificate for enabling SSL. + :paramtype certificate_source_parameters: + ~azure.mgmt.cdn.models.KeyVaultCertificateSourceParameters + """ super(UserManagedHttpsParameters, self).__init__(protocol_type=protocol_type, minimum_tls_version=minimum_tls_version, **kwargs) self.certificate_source = 'AzureKeyVault' # type: str self.certificate_source_parameters = certificate_source_parameters @@ -9072,8 +12955,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 = { @@ -9090,6 +12973,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 @@ -9123,6 +13010,8 @@ def __init__( self, **kwargs ): + """ + """ super(ValidateCustomDomainOutput, self).__init__(**kwargs) self.custom_domain_validated = None self.reason = None @@ -9134,8 +13023,8 @@ class ValidateProbeInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param probe_url: Required. The probe URL to validate. - :type probe_url: str + :ivar probe_url: Required. The probe URL to validate. + :vartype probe_url: str """ _validation = { @@ -9152,6 +13041,10 @@ def __init__( probe_url: str, **kwargs ): + """ + :keyword probe_url: Required. The probe URL to validate. + :paramtype probe_url: str + """ super(ValidateProbeInput, self).__init__(**kwargs) self.probe_url = probe_url @@ -9185,6 +13078,8 @@ def __init__( self, **kwargs ): + """ + """ super(ValidateProbeOutput, self).__init__(**kwargs) self.is_valid = None self.error_code = None @@ -9196,43 +13091,61 @@ class ValidateSecretInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param secret_source: Required. The secret source. - :type secret_source: ~azure.mgmt.cdn.models.ResourceReference - :param secret_type: Required. The secret type. Possible values include: "UrlSigningKey", - "ManagedCertificate", "CustomerCertificate". - :type secret_type: str or ~azure.mgmt.cdn.models.ValidateSecretType + :ivar secret_type: Required. The secret type. Possible values include: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :vartype secret_type: str or ~azure.mgmt.cdn.models.SecretType + :ivar secret_source: Required. Resource reference to the Azure Key Vault secret. Expected to be + in format of + /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + :vartype secret_source: ~azure.mgmt.cdn.models.ResourceReference + :ivar secret_version: Secret version, if customer is using a specific version. + :vartype secret_version: str """ _validation = { - 'secret_source': {'required': True}, 'secret_type': {'required': True}, + 'secret_source': {'required': True}, } _attribute_map = { - 'secret_source': {'key': 'secretSource', 'type': 'ResourceReference'}, 'secret_type': {'key': 'secretType', 'type': 'str'}, + 'secret_source': {'key': 'secretSource', 'type': 'ResourceReference'}, + 'secret_version': {'key': 'secretVersion', 'type': 'str'}, } def __init__( self, *, + secret_type: Union[str, "SecretType"], secret_source: "ResourceReference", - secret_type: Union[str, "ValidateSecretType"], + secret_version: Optional[str] = None, **kwargs ): + """ + :keyword secret_type: Required. The secret type. Possible values include: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :paramtype secret_type: str or ~azure.mgmt.cdn.models.SecretType + :keyword secret_source: Required. Resource reference to the Azure Key Vault secret. Expected to + be in format of + /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + :paramtype secret_source: ~azure.mgmt.cdn.models.ResourceReference + :keyword secret_version: Secret version, if customer is using a specific version. + :paramtype secret_version: str + """ super(ValidateSecretInput, self).__init__(**kwargs) - self.secret_source = secret_source self.secret_type = secret_type + self.secret_source = secret_source + self.secret_version = secret_version class ValidateSecretOutput(msrest.serialization.Model): """Output of the validated secret. - :param status: The validation status. Possible values include: "Valid", "Invalid", + :ivar status: The validation status. Possible values include: "Valid", "Invalid", "AccessDenied", "CertificateExpired". - :type status: str or ~azure.mgmt.cdn.models.Status - :param message: Detailed error message. - :type message: str + :vartype status: str or ~azure.mgmt.cdn.models.Status + :ivar message: Detailed error message. + :vartype message: str """ _attribute_map = { @@ -9247,6 +13160,13 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword status: The validation status. Possible values include: "Valid", "Invalid", + "AccessDenied", "CertificateExpired". + :paramtype status: str or ~azure.mgmt.cdn.models.Status + :keyword message: Detailed error message. + :paramtype message: str + """ super(ValidateSecretOutput, self).__init__(**kwargs) self.status = status self.message = message @@ -9273,6 +13193,8 @@ def __init__( self, **kwargs ): + """ + """ super(ValidationToken, self).__init__(**kwargs) self.token = None @@ -9280,14 +13202,14 @@ def __init__( class WafMetricsResponse(msrest.serialization.Model): """Waf Metrics Response. - :param date_time_begin: - :type date_time_begin: ~datetime.datetime - :param date_time_end: - :type date_time_end: ~datetime.datetime - :param granularity: Possible values include: "PT5M", "PT1H", "P1D". - :type granularity: str or ~azure.mgmt.cdn.models.WafMetricsResponseGranularity - :param series: - :type series: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesItem] + :ivar date_time_begin: + :vartype date_time_begin: ~datetime.datetime + :ivar date_time_end: + :vartype date_time_end: ~datetime.datetime + :ivar granularity: Possible values include: "PT5M", "PT1H", "P1D". + :vartype granularity: str or ~azure.mgmt.cdn.models.WafMetricsResponseGranularity + :ivar series: + :vartype series: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesItem] """ _attribute_map = { @@ -9306,6 +13228,16 @@ def __init__( series: Optional[List["WafMetricsResponseSeriesItem"]] = None, **kwargs ): + """ + :keyword date_time_begin: + :paramtype date_time_begin: ~datetime.datetime + :keyword date_time_end: + :paramtype date_time_end: ~datetime.datetime + :keyword granularity: Possible values include: "PT5M", "PT1H", "P1D". + :paramtype granularity: str or ~azure.mgmt.cdn.models.WafMetricsResponseGranularity + :keyword series: + :paramtype series: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesItem] + """ super(WafMetricsResponse, self).__init__(**kwargs) self.date_time_begin = date_time_begin self.date_time_end = date_time_end @@ -9316,23 +13248,18 @@ def __init__( class WafMetricsResponseSeriesItem(msrest.serialization.Model): """WafMetricsResponseSeriesItem. - Variables are only populated by the server, and will be ignored when sending a request. - - :param metric: - :type metric: str - :ivar unit: Default value: "count". + :ivar metric: + :vartype metric: str + :ivar unit: The only acceptable values to pass in are None and "count". The default value is + None. :vartype unit: str - :param groups: - :type groups: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesPropertiesItemsItem] - :param data: - :type data: + :ivar groups: + :vartype groups: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesPropertiesItemsItem] + :ivar data: + :vartype data: list[~azure.mgmt.cdn.models.Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems] """ - _validation = { - 'unit': {'constant': True}, - } - _attribute_map = { 'metric': {'key': 'metric', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, @@ -9340,18 +13267,30 @@ class WafMetricsResponseSeriesItem(msrest.serialization.Model): 'data': {'key': 'data', 'type': '[Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems]'}, } - unit = "count" - def __init__( self, *, metric: Optional[str] = None, + unit: Optional[str] = None, groups: Optional[List["WafMetricsResponseSeriesPropertiesItemsItem"]] = None, data: Optional[List["Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems"]] = None, **kwargs ): + """ + :keyword metric: + :paramtype metric: str + :keyword unit: The only acceptable values to pass in are None and "count". The default value + is None. + :paramtype unit: str + :keyword groups: + :paramtype groups: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesPropertiesItemsItem] + :keyword data: + :paramtype data: + list[~azure.mgmt.cdn.models.Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems] + """ super(WafMetricsResponseSeriesItem, self).__init__(**kwargs) self.metric = metric + self.unit = unit self.groups = groups self.data = data @@ -9359,10 +13298,10 @@ def __init__( class WafMetricsResponseSeriesPropertiesItemsItem(msrest.serialization.Model): """WafMetricsResponseSeriesPropertiesItemsItem. - :param name: - :type name: str - :param value: - :type value: str + :ivar name: + :vartype name: str + :ivar value: + :vartype value: str """ _attribute_map = { @@ -9377,6 +13316,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword value: + :paramtype value: str + """ super(WafMetricsResponseSeriesPropertiesItemsItem, self).__init__(**kwargs) self.name = name self.value = value @@ -9385,14 +13330,14 @@ def __init__( class WafRankingsResponse(msrest.serialization.Model): """Waf Rankings Response. - :param date_time_begin: - :type date_time_begin: ~datetime.datetime - :param date_time_end: - :type date_time_end: ~datetime.datetime - :param groups: - :type groups: list[str] - :param data: - :type data: list[~azure.mgmt.cdn.models.WafRankingsResponseDataItem] + :ivar date_time_begin: + :vartype date_time_begin: ~datetime.datetime + :ivar date_time_end: + :vartype date_time_end: ~datetime.datetime + :ivar groups: + :vartype groups: list[str] + :ivar data: + :vartype data: list[~azure.mgmt.cdn.models.WafRankingsResponseDataItem] """ _attribute_map = { @@ -9411,6 +13356,16 @@ def __init__( data: Optional[List["WafRankingsResponseDataItem"]] = None, **kwargs ): + """ + :keyword date_time_begin: + :paramtype date_time_begin: ~datetime.datetime + :keyword date_time_end: + :paramtype date_time_end: ~datetime.datetime + :keyword groups: + :paramtype groups: list[str] + :keyword data: + :paramtype data: list[~azure.mgmt.cdn.models.WafRankingsResponseDataItem] + """ super(WafRankingsResponse, self).__init__(**kwargs) self.date_time_begin = date_time_begin self.date_time_end = date_time_end @@ -9421,10 +13376,10 @@ def __init__( class WafRankingsResponseDataItem(msrest.serialization.Model): """WafRankingsResponseDataItem. - :param group_values: - :type group_values: list[str] - :param metrics: - :type metrics: + :ivar group_values: + :vartype group_values: list[str] + :ivar metrics: + :vartype metrics: list[~azure.mgmt.cdn.models.ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems] """ @@ -9440,6 +13395,13 @@ def __init__( metrics: Optional[List["ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems"]] = None, **kwargs ): + """ + :keyword group_values: + :paramtype group_values: list[str] + :keyword metrics: + :paramtype metrics: + list[~azure.mgmt.cdn.models.ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems] + """ super(WafRankingsResponseDataItem, self).__init__(**kwargs) self.group_values = group_values self.metrics = metrics diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/__init__.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/__init__.py index 17011eacfb60..02659c9dab5c 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/__init__.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/__init__.py @@ -6,15 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._profiles_operations import ProfilesOperations -from ._endpoints_operations import EndpointsOperations -from ._origins_operations import OriginsOperations -from ._origin_groups_operations import OriginGroupsOperations -from ._custom_domains_operations import CustomDomainsOperations from ._cdn_management_client_operations import CdnManagementClientOperationsMixin -from ._resource_usage_operations import ResourceUsageOperations -from ._operations import Operations -from ._edge_nodes_operations import EdgeNodesOperations from ._afd_profiles_operations import AFDProfilesOperations from ._afd_custom_domains_operations import AFDCustomDomainsOperations from ._afd_endpoints_operations import AFDEndpointsOperations @@ -27,19 +19,19 @@ from ._secrets_operations import SecretsOperations from ._validate_operations import ValidateOperations from ._log_analytics_operations import LogAnalyticsOperations +from ._profiles_operations import ProfilesOperations +from ._endpoints_operations import EndpointsOperations +from ._origins_operations import OriginsOperations +from ._origin_groups_operations import OriginGroupsOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._resource_usage_operations import ResourceUsageOperations +from ._operations import Operations +from ._edge_nodes_operations import EdgeNodesOperations from ._policies_operations import PoliciesOperations from ._managed_rule_sets_operations import ManagedRuleSetsOperations __all__ = [ - 'ProfilesOperations', - 'EndpointsOperations', - 'OriginsOperations', - 'OriginGroupsOperations', - 'CustomDomainsOperations', 'CdnManagementClientOperationsMixin', - 'ResourceUsageOperations', - 'Operations', - 'EdgeNodesOperations', 'AFDProfilesOperations', 'AFDCustomDomainsOperations', 'AFDEndpointsOperations', @@ -52,6 +44,14 @@ 'SecretsOperations', 'ValidateOperations', 'LogAnalyticsOperations', + 'ProfilesOperations', + 'EndpointsOperations', + 'OriginsOperations', + 'OriginGroupsOperations', + 'CustomDomainsOperations', + 'ResourceUsageOperations', + 'Operations', + 'EdgeNodesOperations', 'PoliciesOperations', 'ManagedRuleSetsOperations', ] diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_custom_domains_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_custom_domains_operations.py index 795d446aa117..1c964bc0e7ec 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_custom_domains_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_custom_domains_operations.py @@ -5,25 +5,266 @@ # 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( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "customDomainName": _SERIALIZER.url("custom_domain_name", custom_domain_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + custom_domain_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "customDomainName": _SERIALIZER.url("custom_domain_name", custom_domain_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + profile_name: str, + custom_domain_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "customDomainName": _SERIALIZER.url("custom_domain_name", custom_domain_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "customDomainName": _SERIALIZER.url("custom_domain_name", custom_domain_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_validation_token_request_initial( + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "customDomainName": _SERIALIZER.url("custom_domain_name", custom_domain_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AFDCustomDomainsOperations(object): """AFDCustomDomainsOperations operations. @@ -47,18 +288,19 @@ 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.AFDDomainListResult"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.AFDDomainListResult"]: """Lists existing AzureFrontDoor domains. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + or CDN profile which is unique within the resource group. :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 AFDDomainListResult or the result of cls(response) @@ -70,36 +312,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('AFDDomainListResult', pipeline_response) + deserialized = self._deserialize("AFDDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,31 +351,33 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/customDomains'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - custom_domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDDomain" + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + **kwargs: Any + ) -> "_models.AFDDomain": """Gets an existing AzureFrontDoor domain with the specified domain name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. :type custom_domain_name: str @@ -150,34 +391,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + custom_domain_name=custom_domain_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AFDDomain', pipeline_response) @@ -186,56 +417,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - custom_domain_name, # type: str - custom_domain, # type: "_models.AFDDomain" - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDDomain" + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain: "_models.AFDDomain", + **kwargs: Any + ) -> "_models.AFDDomain": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomain"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(custom_domain, 'AFDDomain') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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_domain, 'AFDDomain') - 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.AfdErrorResponse, 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('AFDDomain', pipeline_response) @@ -250,22 +471,25 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - custom_domain_name, # type: str - custom_domain, # type: "_models.AFDDomain" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AFDDomain"] + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain: "_models.AFDDomain", + **kwargs: Any + ) -> LROPoller["_models.AFDDomain"]: """Creates a new domain within the specified profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. :type custom_domain_name: str @@ -273,15 +497,18 @@ def begin_create( :type custom_domain: ~azure.mgmt.cdn.models.AFDDomain :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 AFDDomain or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDDomain] - :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.AFDDomain"] lro_delay = kwargs.pop( 'polling_interval', @@ -294,28 +521,21 @@ def begin_create( profile_name=profile_name, custom_domain_name=custom_domain_name, custom_domain=custom_domain, + 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('AFDDomain', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -327,56 +547,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - custom_domain_name, # type: str - custom_domain_update_properties, # type: "_models.AFDDomainUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDDomain" + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain_update_properties: "_models.AFDDomainUpdateParameters", + **kwargs: Any + ) -> "_models.AFDDomain": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomain"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(custom_domain_update_properties, 'AFDDomainUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + 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(custom_domain_update_properties, 'AFDDomainUpdateParameters') - 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.AfdErrorResponse, 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('AFDDomain', pipeline_response) @@ -388,22 +597,25 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - custom_domain_name, # type: str - custom_domain_update_properties, # type: "_models.AFDDomainUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AFDDomain"] + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain_update_properties: "_models.AFDDomainUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.AFDDomain"]: """Updates an existing domain within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. :type custom_domain_name: str @@ -411,15 +623,18 @@ def begin_update( :type custom_domain_update_properties: ~azure.mgmt.cdn.models.AFDDomainUpdateParameters :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 AFDDomain or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDDomain] - :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.AFDDomain"] lro_delay = kwargs.pop( 'polling_interval', @@ -432,28 +647,21 @@ def begin_update( profile_name=profile_name, custom_domain_name=custom_domain_name, custom_domain_update_properties=custom_domain_update_properties, + 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('AFDDomain', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -465,84 +673,77 @@ 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.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - custom_domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + custom_domain_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + custom_domain_name=custom_domain_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - custom_domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing AzureFrontDoor domain with the specified domain name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. :type custom_domain_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', @@ -557,22 +758,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -584,87 +777,77 @@ 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.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore def _refresh_validation_token_initial( self, - resource_group_name, # type: str - profile_name, # type: str - custom_domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ValidationToken" - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidationToken"] + resource_group_name: str, + profile_name: str, + custom_domain_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-09-01" - accept = "application/json" - - # Construct URL - url = self._refresh_validation_token_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_validation_token_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + template_url=self._refresh_validation_token_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]: + 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.AfdErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ValidationToken', pipeline_response) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized _refresh_validation_token_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken'} # type: ignore + + @distributed_trace def begin_refresh_validation_token( self, - resource_group_name, # type: str - profile_name, # type: str - custom_domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ValidationToken"] + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Updates the domain validation token. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. :type custom_domain_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. - :return: An instance of LROPoller that returns either ValidationToken or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.ValidationToken] - :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidationToken"] + 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', self._config.polling_interval @@ -678,25 +861,14 @@ def begin_refresh_validation_token( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ValidationToken', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -708,4 +880,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh_validation_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_endpoints_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_endpoints_operations.py index 97b649eafa9a..ff7325bb3711 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_endpoints_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_endpoints_operations.py @@ -5,25 +5,358 @@ # 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( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_content_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_resource_usage_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/usages') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_custom_domain_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/validateCustomDomain') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class AFDEndpointsOperations(object): """AFDEndpointsOperations operations. @@ -47,21 +380,23 @@ 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.AFDEndpointListResult"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.AFDEndpointListResult"]: """Lists existing AzureFrontDoor endpoints. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :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 AFDEndpointListResult or the result of cls(response) + :return: An iterator like instance of either AFDEndpointListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.AFDEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +405,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('AFDEndpointListResult', pipeline_response) + deserialized = self._deserialize("AFDEndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,31 +444,33 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/afdEndpoints'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDEndpoint" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> "_models.AFDEndpoint": """Gets an existing AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -150,34 +484,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = 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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AFDEndpoint', pipeline_response) @@ -186,56 +510,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - endpoint, # type: "_models.AFDEndpoint" - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDEndpoint" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: "_models.AFDEndpoint", + **kwargs: Any + ) -> "_models.AFDEndpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(endpoint, 'AFDEndpoint') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(endpoint, 'AFDEndpoint') - 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.AfdErrorResponse, 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('AFDEndpoint', pipeline_response) @@ -250,23 +564,26 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - endpoint, # type: "_models.AFDEndpoint" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AFDEndpoint"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: "_models.AFDEndpoint", + **kwargs: Any + ) -> LROPoller["_models.AFDEndpoint"]: """Creates a new AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -274,15 +591,19 @@ def begin_create( :type endpoint: ~azure.mgmt.cdn.models.AFDEndpoint :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 AFDEndpoint 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 AFDEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDEndpoint] - :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.AFDEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,28 +616,21 @@ def begin_create( profile_name=profile_name, endpoint_name=endpoint_name, endpoint=endpoint, + 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('AFDEndpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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,56 +642,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - endpoint_update_properties, # type: "_models.AFDEndpointUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDEndpoint" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: "_models.AFDEndpointUpdateParameters", + **kwargs: Any + ) -> "_models.AFDEndpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(endpoint_update_properties, 'AFDEndpointUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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(endpoint_update_properties, 'AFDEndpointUpdateParameters') - 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.AfdErrorResponse, 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('AFDEndpoint', pipeline_response) @@ -389,17 +692,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - endpoint_update_properties, # type: "_models.AFDEndpointUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AFDEndpoint"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: "_models.AFDEndpointUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.AFDEndpoint"]: """Updates an existing AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, resource group and profile. Only tags can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update origin groups, use the @@ -407,7 +712,8 @@ def begin_update( :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -415,15 +721,19 @@ def begin_update( :type endpoint_update_properties: ~azure.mgmt.cdn.models.AFDEndpointUpdateParameters :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 AFDEndpoint 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 AFDEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDEndpoint] - :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.AFDEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -436,28 +746,21 @@ def begin_update( profile_name=profile_name, endpoint_name=endpoint_name, endpoint_update_properties=endpoint_update_properties, + 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('AFDEndpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -469,84 +772,77 @@ 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + 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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type 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', @@ -561,22 +857,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -588,76 +876,67 @@ 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore def _purge_content_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - contents, # type: "_models.AfdPurgeParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + endpoint_name: str, + contents: "_models.AfdPurgeParameters", + **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-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(contents, 'AfdPurgeParameters') + + request = build_purge_content_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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(contents, 'AfdPurgeParameters') - 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge'} # type: ignore + + @distributed_trace def begin_purge_content( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - contents, # type: "_models.AfdPurgeParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + contents: "_models.AfdPurgeParameters", + **kwargs: Any + ) -> LROPoller[None]: """Removes a content from AzureFrontDoor. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -667,15 +946,18 @@ def begin_purge_content( :type contents: ~azure.mgmt.cdn.models.AfdPurgeParameters :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', @@ -688,25 +970,18 @@ def begin_purge_content( profile_name=profile_name, endpoint_name=endpoint_name, contents=contents, + 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -718,21 +993,23 @@ 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge'} # type: ignore + @distributed_trace def list_resource_usage( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsagesListResult"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> Iterable["_models.UsagesListResult"]: """Checks the quota and actual usage of endpoints under the given CDN profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -746,37 +1023,35 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('UsagesListResult', pipeline_response) + deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -789,31 +1064,33 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/usages'} # type: ignore + @distributed_trace def validate_custom_domain( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - custom_domain_properties, # type: "_models.ValidateCustomDomainInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.ValidateCustomDomainOutput" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_properties: "_models.ValidateCustomDomainInput", + **kwargs: Any + ) -> "_models.ValidateCustomDomainOutput": """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -829,39 +1106,29 @@ def validate_custom_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') + + request = build_validate_custom_domain_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ValidateCustomDomainOutput', pipeline_response) @@ -870,4 +1137,6 @@ def validate_custom_domain( return cls(pipeline_response, deserialized, {}) return deserialized + validate_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/validateCustomDomain'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_origin_groups_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_origin_groups_operations.py index 25f1140808b9..2858d62d4ed3 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_origin_groups_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_origin_groups_operations.py @@ -5,25 +5,266 @@ # 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( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + origin_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + origin_group_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + 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( + resource_group_name: str, + profile_name: str, + origin_group_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + 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( + resource_group_name: str, + profile_name: str, + origin_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_resource_usage_request( + resource_group_name: str, + profile_name: str, + origin_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/usages') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AFDOriginGroupsOperations(object): """AFDOriginGroupsOperations operations. @@ -47,21 +288,23 @@ 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.AFDOriginGroupListResult"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.AFDOriginGroupListResult"]: """Lists all of the existing origin groups within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :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 AFDOriginGroupListResult or the result of cls(response) + :return: An iterator like instance of either AFDOriginGroupListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.AFDOriginGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +313,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('AFDOriginGroupListResult', pipeline_response) + deserialized = self._deserialize("AFDOriginGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,30 +352,32 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/originGroups'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDOriginGroup" + resource_group_name: str, + profile_name: str, + origin_group_name: str, + **kwargs: Any + ) -> "_models.AFDOriginGroup": """Gets an existing origin group within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. :type origin_group_name: str @@ -149,34 +391,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AFDOriginGroup', pipeline_response) @@ -185,56 +417,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_group, # type: "_models.AFDOriginGroup" - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDOriginGroup" + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group: "_models.AFDOriginGroup", + **kwargs: Any + ) -> "_models.AFDOriginGroup": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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(origin_group, 'AFDOriginGroup') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(origin_group, 'AFDOriginGroup') - 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.AfdErrorResponse, 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('AFDOriginGroup', pipeline_response) @@ -249,22 +471,25 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_group, # type: "_models.AFDOriginGroup" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AFDOriginGroup"] + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group: "_models.AFDOriginGroup", + **kwargs: Any + ) -> LROPoller["_models.AFDOriginGroup"]: """Creates a new origin group within the specified profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. :type origin_group_name: str @@ -272,15 +497,19 @@ def begin_create( :type origin_group: ~azure.mgmt.cdn.models.AFDOriginGroup :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 AFDOriginGroup 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 AFDOriginGroup or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] - :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.AFDOriginGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +522,21 @@ def begin_create( profile_name=profile_name, origin_group_name=origin_group_name, origin_group=origin_group, + 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('AFDOriginGroup', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -326,56 +548,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_group_update_properties, # type: "_models.AFDOriginGroupUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDOriginGroup" + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group_update_properties: "_models.AFDOriginGroupUpdateParameters", + **kwargs: Any + ) -> "_models.AFDOriginGroup": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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(origin_group_update_properties, 'AFDOriginGroupUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + 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(origin_group_update_properties, 'AFDOriginGroupUpdateParameters') - 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.AfdErrorResponse, 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('AFDOriginGroup', pipeline_response) @@ -387,22 +598,25 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_group_update_properties, # type: "_models.AFDOriginGroupUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AFDOriginGroup"] + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group_update_properties: "_models.AFDOriginGroupUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.AFDOriginGroup"]: """Updates an existing origin group within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -410,15 +624,19 @@ def begin_update( :type origin_group_update_properties: ~azure.mgmt.cdn.models.AFDOriginGroupUpdateParameters :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 AFDOriginGroup 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 AFDOriginGroup or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] - :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.AFDOriginGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,28 +649,21 @@ def begin_update( profile_name=profile_name, origin_group_name=origin_group_name, origin_group_update_properties=origin_group_update_properties, + 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('AFDOriginGroup', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -464,83 +675,76 @@ 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.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + origin_group_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + origin_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing origin group within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_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', @@ -555,22 +759,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -582,21 +778,23 @@ 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.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + @distributed_trace def list_resource_usage( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsagesListResult"] + resource_group_name: str, + profile_name: str, + origin_group_name: str, + **kwargs: Any + ) -> Iterable["_models.UsagesListResult"]: """Checks the quota and actual usage of endpoints under the given CDN profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. :type origin_group_name: str @@ -610,37 +808,35 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_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('UsagesListResult', pipeline_response) + deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -653,12 +849,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_origins_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_origins_operations.py index 98adad806df8..d3c579d3fccf 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_origins_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_origins_operations.py @@ -5,25 +5,239 @@ # 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_origin_group_request( + resource_group_name: str, + profile_name: str, + origin_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "originName": _SERIALIZER.url("origin_name", origin_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "originName": _SERIALIZER.url("origin_name", origin_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "originName": _SERIALIZER.url("origin_name", origin_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "originName": _SERIALIZER.url("origin_name", origin_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AFDOriginsOperations(object): """AFDOriginsOperations operations. @@ -47,19 +261,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_origin_group( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AFDOriginListResult"] + resource_group_name: str, + profile_name: str, + origin_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AFDOriginListResult"]: """Lists all of the existing origins within an origin group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -73,37 +288,35 @@ def list_by_origin_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_origin_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_origin_group_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_origin_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_origin_group_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_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('AFDOriginListResult', pipeline_response) + deserialized = self._deserialize("AFDOriginListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,31 +329,33 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_origin_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDOrigin" + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + **kwargs: Any + ) -> "_models.AFDOrigin": """Gets an existing origin within an origin group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -156,35 +371,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + origin_name=origin_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AFDOrigin', pipeline_response) @@ -193,58 +398,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_name, # type: str - origin, # type: "_models.AFDOrigin" - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDOrigin" + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin: "_models.AFDOrigin", + **kwargs: Any + ) -> "_models.AFDOrigin": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOrigin"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(origin, 'AFDOrigin') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + origin_name=origin_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(origin, 'AFDOrigin') - 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.AfdErrorResponse, 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('AFDOrigin', pipeline_response) @@ -259,23 +454,26 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_name, # type: str - origin, # type: "_models.AFDOrigin" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AFDOrigin"] + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin: "_models.AFDOrigin", + **kwargs: Any + ) -> LROPoller["_models.AFDOrigin"]: """Creates a new origin within the specified origin group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -285,15 +483,18 @@ def begin_create( :type origin: ~azure.mgmt.cdn.models.AFDOrigin :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 AFDOrigin or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOrigin] - :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.AFDOrigin"] lro_delay = kwargs.pop( 'polling_interval', @@ -307,29 +508,21 @@ def begin_create( origin_group_name=origin_group_name, origin_name=origin_name, origin=origin, + 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('AFDOrigin', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -341,58 +534,47 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_name, # type: str - origin_update_properties, # type: "_models.AFDOriginUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.AFDOrigin" + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin_update_properties: "_models.AFDOriginUpdateParameters", + **kwargs: Any + ) -> "_models.AFDOrigin": cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOrigin"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(origin_update_properties, 'AFDOriginUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + origin_name=origin_name, + subscription_id=self._config.subscription_id, + 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(origin_update_properties, 'AFDOriginUpdateParameters') - 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.AfdErrorResponse, 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('AFDOrigin', pipeline_response) @@ -404,23 +586,26 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_name, # type: str - origin_update_properties, # type: "_models.AFDOriginUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AFDOrigin"] + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin_update_properties: "_models.AFDOriginUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.AFDOrigin"]: """Updates an existing origin within an origin group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -430,15 +615,18 @@ def begin_update( :type origin_update_properties: ~azure.mgmt.cdn.models.AFDOriginUpdateParameters :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 AFDOrigin or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOrigin] - :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.AFDOrigin"] lro_delay = kwargs.pop( 'polling_interval', @@ -452,29 +640,21 @@ def begin_update( origin_group_name=origin_group_name, origin_name=origin_name, origin_update_properties=origin_update_properties, + 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('AFDOrigin', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -486,72 +666,63 @@ 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.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + origin_group_name=origin_group_name, + origin_name=origin_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - origin_group_name, # type: str - origin_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing origin within an origin group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. :type origin_group_name: str @@ -559,15 +730,17 @@ def begin_delete( :type origin_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', @@ -583,23 +756,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -611,4 +775,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.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_profiles_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_profiles_operations.py index d2ede9d3baaa..30db4130f59b 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_profiles_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_afd_profiles_operations.py @@ -5,23 +5,105 @@ # 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 +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +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, Iterable, Optional, TypeVar +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_resource_usage_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_host_name_availability_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkHostNameAvailability') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class AFDProfilesOperations(object): """AFDProfilesOperations operations. @@ -45,18 +127,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_resource_usage( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsagesListResult"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.UsagesListResult"]: """Checks the quota and actual usage of endpoints under the given CDN profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :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 UsagesListResult or the result of cls(response) @@ -68,36 +151,33 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_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('UsagesListResult', pipeline_response) + deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,81 +190,75 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages'} # type: ignore + @distributed_trace def check_host_name_availability( self, - resource_group_name, # type: str - profile_name, # type: str - check_host_name_availability_input, # type: "_models.ValidateCustomDomainInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.ValidateCustomDomainOutput" + resource_group_name: str, + profile_name: str, + check_host_name_availability_input: "_models.CheckHostNameAvailabilityInput", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityOutput": """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :type profile_name: str :param check_host_name_availability_input: Custom domain to be validated. - :type check_host_name_availability_input: ~azure.mgmt.cdn.models.ValidateCustomDomainInput + :type check_host_name_availability_input: ~azure.mgmt.cdn.models.CheckHostNameAvailabilityInput :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateCustomDomainOutput, or the result of cls(response) - :rtype: ~azure.mgmt.cdn.models.ValidateCustomDomainOutput + :return: CheckNameAvailabilityOutput, or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateCustomDomainOutput"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityOutput"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_host_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_host_name_availability_input, 'CheckHostNameAvailabilityInput') - # 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_host_name_availability_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_host_name_availability.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_host_name_availability_input, '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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ValidateCustomDomainOutput', pipeline_response) + deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized + check_host_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkHostNameAvailability'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_cdn_management_client_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_cdn_management_client_operations.py index 8627d6a89fd2..f15357a8c218 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_cdn_management_client_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_cdn_management_client_operations.py @@ -5,31 +5,248 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, 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 +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_endpoint_name_availability_request( + 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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + 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_check_name_availability_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Cdn/checkNameAvailability') + + # 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_check_name_availability_with_subscription_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability') + 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 + ) + + +def build_validate_probe_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe') + 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 + ) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar +class CdnManagementClientOperationsMixin(object): - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + @distributed_trace + def check_endpoint_name_availability( + self, + resource_group_name: str, + check_endpoint_name_availability_input: "_models.CheckEndpointNameAvailabilityInput", + **kwargs: Any + ) -> "_models.CheckEndpointNameAvailabilityOutput": + """Check the availability of a resource name. This is needed for resources where name is globally + unique, such as a afdx endpoint. -class CdnManagementClientOperationsMixin(object): + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param check_endpoint_name_availability_input: Input to check. + :type check_endpoint_name_availability_input: + ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckEndpointNameAvailabilityOutput, or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityOutput + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckEndpointNameAvailabilityOutput"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_endpoint_name_availability_input, 'CheckEndpointNameAvailabilityInput') + + request = build_check_endpoint_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.check_endpoint_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckEndpointNameAvailabilityOutput', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_endpoint_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability'} # type: ignore + + + @distributed_trace def check_name_availability( self, - check_name_availability_input, # type: "_models.CheckNameAvailabilityInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityOutput" + check_name_availability_input: "_models.CheckNameAvailabilityInput", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityOutput": """Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. @@ -45,32 +262,25 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(check_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_name_availability_input, 'CheckNameAvailabilityInput') + + request = build_check_name_availability_request( + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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) @@ -79,14 +289,16 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/providers/Microsoft.Cdn/checkNameAvailability'} # type: ignore + + @distributed_trace def check_name_availability_with_subscription( self, - check_name_availability_input, # type: "_models.CheckNameAvailabilityInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityOutput" + check_name_availability_input: "_models.CheckNameAvailabilityInput", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityOutput": """Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. @@ -102,36 +314,26 @@ def check_name_availability_with_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability_with_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_name_availability_input, 'CheckNameAvailabilityInput') + + request = build_check_name_availability_with_subscription_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability_with_subscription.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_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) @@ -140,14 +342,16 @@ def check_name_availability_with_subscription( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability_with_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability'} # type: ignore + + @distributed_trace def validate_probe( self, - validate_probe_input, # type: "_models.ValidateProbeInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.ValidateProbeOutput" + validate_probe_input: "_models.ValidateProbeInput", + **kwargs: Any + ) -> "_models.ValidateProbeOutput": """Check if the probe path is a valid path and the file can be accessed. Probe path is the path to a file hosted on the origin server to help accelerate the delivery of dynamic content via the CDN endpoint. This path is relative to the origin path specified in the endpoint configuration. @@ -164,36 +368,26 @@ def validate_probe( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_probe.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(validate_probe_input, 'ValidateProbeInput') - # 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_probe_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.validate_probe.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(validate_probe_input, 'ValidateProbeInput') - 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('ValidateProbeOutput', pipeline_response) @@ -202,4 +396,6 @@ def validate_probe( return cls(pipeline_response, deserialized, {}) return deserialized + validate_probe.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_custom_domains_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_custom_domains_operations.py index 7f902cb800f1..f64b2588afb5 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_custom_domains_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_custom_domains_operations.py @@ -5,25 +5,278 @@ # 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_endpoint_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "customDomainName": _SERIALIZER.url("custom_domain_name", custom_domain_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "customDomainName": _SERIALIZER.url("custom_domain_name", custom_domain_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "customDomainName": _SERIALIZER.url("custom_domain_name", custom_domain_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_disable_custom_https_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "customDomainName": _SERIALIZER.url("custom_domain_name", custom_domain_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_enable_custom_https_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "customDomainName": _SERIALIZER.url("custom_domain_name", custom_domain_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,14 +300,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_endpoint( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomDomainListResult"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> Iterable["_models.CustomDomainListResult"]: """Lists all of the existing custom domains within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -64,7 +317,8 @@ def list_by_endpoint( :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainListResult or the result of cls(response) + :return: An iterator like instance of either CustomDomainListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.CustomDomainListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -73,37 +327,35 @@ def list_by_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_endpoint.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_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('CustomDomainListResult', pipeline_response) + deserialized = self._deserialize("CustomDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,26 +368,27 @@ 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_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - custom_domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomain" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomain": """Gets an existing custom domain within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -156,35 +409,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_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('CustomDomain', pipeline_response) @@ -193,58 +436,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - custom_domain_name, # type: str - custom_domain_properties, # type: "_models.CustomDomainParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomain" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_properties: "_models.CustomDomainParameters", + **kwargs: Any + ) -> "_models.CustomDomain": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomain"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(custom_domain_properties, 'CustomDomainParameters') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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_domain_properties, 'CustomDomainParameters') - 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('CustomDomain', pipeline_response) @@ -259,18 +492,20 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - custom_domain_name, # type: str - custom_domain_properties, # type: "_models.CustomDomainParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomain"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_properties: "_models.CustomDomainParameters", + **kwargs: Any + ) -> LROPoller["_models.CustomDomain"]: """Creates a new custom domain within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -285,15 +520,19 @@ def begin_create( :type custom_domain_properties: ~azure.mgmt.cdn.models.CustomDomainParameters :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 CustomDomain 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 CustomDomain or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CustomDomain] - :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.CustomDomain"] lro_delay = kwargs.pop( 'polling_interval', @@ -307,29 +546,21 @@ def begin_create( endpoint_name=endpoint_name, custom_domain_name=custom_domain_name, custom_domain_properties=custom_domain_properties, + 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('CustomDomain', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - '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: @@ -341,52 +572,41 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - custom_domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.CustomDomain"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + **kwargs: Any + ) -> Optional["_models.CustomDomain"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CustomDomain"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_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 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) deserialized = None if response.status_code == 202: @@ -396,17 +616,19 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - custom_domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomain"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + **kwargs: Any + ) -> LROPoller["_models.CustomDomain"]: """Deletes an existing custom domain within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -419,15 +641,18 @@ def begin_delete( :type custom_domain_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. - :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: + :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 CustomDomain or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CustomDomain] + :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["_models.CustomDomain"] lro_delay = kwargs.pop( 'polling_interval', @@ -443,26 +668,17 @@ 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): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomain', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - '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: @@ -474,17 +690,18 @@ 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'} # type: ignore + @distributed_trace def disable_custom_https( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - custom_domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.CustomDomain"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + **kwargs: Any + ) -> Optional["_models.CustomDomain"]: """Disable https delivery of the custom domain. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -505,35 +722,25 @@ def disable_custom_https( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.disable_custom_https.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_custom_https_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + template_url=self.disable_custom_https.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -544,18 +751,20 @@ def disable_custom_https( return cls(pipeline_response, deserialized, {}) return deserialized + disable_custom_https.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps'} # type: ignore + + @distributed_trace def enable_custom_https( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - custom_domain_name, # type: str - custom_domain_https_parameters=None, # type: Optional["_models.CustomDomainHttpsParameters"] - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.CustomDomain"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_https_parameters: Optional["_models.CustomDomainHttpsParameters"] = None, + **kwargs: Any + ) -> Optional["_models.CustomDomain"]: """Enable https delivery of the custom domain. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -580,43 +789,33 @@ def enable_custom_https( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.enable_custom_https.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'customDomainName': self._serialize.url("custom_domain_name", custom_domain_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if custom_domain_https_parameters is not None: - body_content = self._serialize.body(custom_domain_https_parameters, 'CustomDomainHttpsParameters') + _json = self._serialize.body(custom_domain_https_parameters, 'CustomDomainHttpsParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_enable_custom_https_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.enable_custom_https.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, 202]: 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 = None @@ -627,4 +826,6 @@ def enable_custom_https( return cls(pipeline_response, deserialized, {}) return deserialized + enable_custom_https.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_edge_nodes_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_edge_nodes_operations.py index 9409298acb27..37b8049cba12 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_edge_nodes_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_edge_nodes_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Cdn/edgenodes') + + # 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 EdgeNodesOperations(object): """EdgeNodesOperations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EdgenodeResult"] + **kwargs: Any + ) -> Iterable["_models.EdgenodeResult"]: """Edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. @@ -63,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EdgenodeResult', pipeline_response) + deserialized = self._deserialize("EdgenodeResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,12 +123,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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_endpoints_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_endpoints_operations.py index 756eb364cea5..e79b66eb215a 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_endpoints_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_endpoints_operations.py @@ -5,25 +5,478 @@ # 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( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_content_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_load_content_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_custom_domain_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_resource_usage_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class EndpointsOperations(object): """EndpointsOperations operations. @@ -47,13 +500,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.EndpointListResult"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.EndpointListResult"]: """Lists existing CDN endpoints. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -70,36 +523,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('EndpointListResult', pipeline_response) + deserialized = self._deserialize("EndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +562,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.Cdn/profiles/{profileName}/endpoints'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Endpoint" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> "_models.Endpoint": """Gets an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. @@ -150,34 +601,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = 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('Endpoint', pipeline_response) @@ -186,56 +627,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - endpoint, # type: "_models.Endpoint" - **kwargs # type: Any - ): - # type: (...) -> "_models.Endpoint" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: "_models.Endpoint", + **kwargs: Any + ) -> "_models.Endpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(endpoint, 'Endpoint') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(endpoint, 'Endpoint') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 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('Endpoint', pipeline_response) @@ -250,17 +681,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - endpoint, # type: "_models.Endpoint" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Endpoint"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: "_models.Endpoint", + **kwargs: Any + ) -> LROPoller["_models.Endpoint"]: """Creates a new CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. @@ -274,15 +707,18 @@ def begin_create( :type endpoint: ~azure.mgmt.cdn.models.Endpoint :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 Endpoint or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Endpoint] - :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.Endpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,28 +731,21 @@ def begin_create( profile_name=profile_name, endpoint_name=endpoint_name, endpoint=endpoint, + 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('Endpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -328,56 +757,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - endpoint_update_properties, # type: "_models.EndpointUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Endpoint" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: "_models.EndpointUpdateParameters", + **kwargs: Any + ) -> "_models.Endpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(endpoint_update_properties, 'EndpointUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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(endpoint_update_properties, 'EndpointUpdateParameters') - 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('Endpoint', pipeline_response) @@ -389,17 +807,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - endpoint_update_properties, # type: "_models.EndpointUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Endpoint"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: "_models.EndpointUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Endpoint"]: """Updates an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. Only tags can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update origin groups, use the Update @@ -415,15 +835,18 @@ def begin_update( :type endpoint_update_properties: ~azure.mgmt.cdn.models.EndpointUpdateParameters :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 Endpoint or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Endpoint] - :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.Endpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -436,28 +859,21 @@ def begin_update( profile_name=profile_name, endpoint_name=endpoint_name, endpoint_update_properties=endpoint_update_properties, + 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('Endpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -469,64 +885,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.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + 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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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 - if response.status_code not in [202, 204]: + 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.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. @@ -538,15 +944,17 @@ def begin_delete( :type 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', @@ -561,22 +969,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -588,50 +988,39 @@ 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.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore def _start_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Endpoint" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> "_models.Endpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self._start_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 response.status_code == 200: deserialized = self._deserialize('Endpoint', pipeline_response) @@ -643,16 +1032,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Endpoint"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> LROPoller["_models.Endpoint"]: """Starts an existing CDN endpoint that is on a stopped state. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -663,15 +1054,17 @@ def begin_start( :type 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 Endpoint or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Endpoint] - :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["_models.Endpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -686,25 +1079,17 @@ def begin_start( 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('Endpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -716,50 +1101,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start'} # type: ignore def _stop_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Endpoint" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> "_models.Endpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self._stop_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 response.status_code == 200: deserialized = self._deserialize('Endpoint', pipeline_response) @@ -771,16 +1145,18 @@ def _stop_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Endpoint"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> LROPoller["_models.Endpoint"]: """Stops an existing running CDN endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -791,15 +1167,17 @@ def begin_stop( :type 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 Endpoint or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Endpoint] - :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["_models.Endpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -814,25 +1192,17 @@ def begin_stop( 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('Endpoint', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -844,71 +1214,61 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop'} # type: ignore def _purge_content_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - content_file_paths, # type: "_models.PurgeParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + endpoint_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-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(content_file_paths, 'PurgeParameters') + + request = build_purge_content_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'} # type: ignore + + @distributed_trace def begin_purge_content( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - content_file_paths, # type: "_models.PurgeParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: "_models.PurgeParameters", + **kwargs: Any + ) -> LROPoller[None]: """Removes a content from CDN. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -923,15 +1283,18 @@ def begin_purge_content( :type content_file_paths: ~azure.mgmt.cdn.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', @@ -944,25 +1307,18 @@ def begin_purge_content( profile_name=profile_name, endpoint_name=endpoint_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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -974,71 +1330,61 @@ 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'} # type: ignore def _load_content_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - content_file_paths, # type: "_models.LoadParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: "_models.LoadParameters", + **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-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._load_content_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(content_file_paths, 'LoadParameters') + + request = build_load_content_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._load_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, 'LoadParameters') - 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, {}) _load_content_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load'} # type: ignore + + @distributed_trace def begin_load_content( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - content_file_paths, # type: "_models.LoadParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: "_models.LoadParameters", + **kwargs: Any + ) -> LROPoller[None]: """Pre-loads a content to CDN. Available for Verizon Profiles. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -1052,15 +1398,18 @@ def begin_load_content( :type content_file_paths: ~azure.mgmt.cdn.models.LoadParameters :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', @@ -1073,25 +1422,18 @@ def begin_load_content( profile_name=profile_name, endpoint_name=endpoint_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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - '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: @@ -1103,17 +1445,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_load_content.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load'} # type: ignore + @distributed_trace def validate_custom_domain( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - custom_domain_properties, # type: "_models.ValidateCustomDomainInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.ValidateCustomDomainOutput" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_properties: "_models.ValidateCustomDomainInput", + **kwargs: Any + ) -> "_models.ValidateCustomDomainOutput": """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -1134,39 +1477,29 @@ def validate_custom_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') + + request = build_validate_custom_domain_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + 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) @@ -1175,16 +1508,18 @@ def validate_custom_domain( return cls(pipeline_response, deserialized, {}) return deserialized + validate_custom_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain'} # type: ignore + + @distributed_trace def list_resource_usage( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceUsageListResult"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> Iterable["_models.ResourceUsageListResult"]: """Checks the quota and usage of geo filters and custom domains under the given endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -1194,7 +1529,8 @@ def list_resource_usage( :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceUsageListResult or the result of cls(response) + :return: An iterator like instance of either ResourceUsageListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1203,37 +1539,35 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('ResourceUsageListResult', pipeline_response) + deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1246,12 +1580,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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_log_analytics_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_log_analytics_operations.py index 08d4eb3921b1..f4f992245272 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_log_analytics_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_log_analytics_operations.py @@ -6,22 +6,305 @@ # 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, List, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_log_analytics_metrics_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + *, + metrics: List[Union[str, "_models.LogMetric"]], + date_time_begin: datetime.datetime, + date_time_end: datetime.datetime, + granularity: Union[str, "_models.LogMetricsGranularity"], + custom_domains: List[str], + protocols: List[str], + group_by: Optional[List[Union[str, "_models.LogMetricsGroupBy"]]] = None, + continents: Optional[List[str]] = None, + country_or_regions: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsMetrics') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['metrics'] = [_SERIALIZER.query("metrics", q, 'str') if q is not None else '' for q in metrics] + query_parameters['dateTimeBegin'] = _SERIALIZER.query("date_time_begin", date_time_begin, 'iso-8601') + query_parameters['dateTimeEnd'] = _SERIALIZER.query("date_time_end", date_time_end, 'iso-8601') + query_parameters['granularity'] = _SERIALIZER.query("granularity", granularity, 'str') + if group_by is not None: + query_parameters['groupBy'] = [_SERIALIZER.query("group_by", q, 'str') if q is not None else '' for q in group_by] + if continents is not None: + query_parameters['continents'] = [_SERIALIZER.query("continents", q, 'str') if q is not None else '' for q in continents] + if country_or_regions is not None: + query_parameters['countryOrRegions'] = [_SERIALIZER.query("country_or_regions", q, 'str') if q is not None else '' for q in country_or_regions] + query_parameters['customDomains'] = [_SERIALIZER.query("custom_domains", q, 'str') if q is not None else '' for q in custom_domains] + query_parameters['protocols'] = [_SERIALIZER.query("protocols", q, 'str') if q is not None else '' for q in protocols] + + # 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_log_analytics_rankings_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + *, + rankings: List[Union[str, "_models.LogRanking"]], + metrics: List[Union[str, "_models.LogRankingMetric"]], + max_ranking: int, + date_time_begin: datetime.datetime, + date_time_end: datetime.datetime, + custom_domains: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsRankings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['rankings'] = [_SERIALIZER.query("rankings", q, 'str') if q is not None else '' for q in rankings] + query_parameters['metrics'] = [_SERIALIZER.query("metrics", q, 'str') if q is not None else '' for q in metrics] + query_parameters['maxRanking'] = _SERIALIZER.query("max_ranking", max_ranking, 'int') + query_parameters['dateTimeBegin'] = _SERIALIZER.query("date_time_begin", date_time_begin, 'iso-8601') + query_parameters['dateTimeEnd'] = _SERIALIZER.query("date_time_end", date_time_end, 'iso-8601') + if custom_domains is not None: + query_parameters['customDomains'] = [_SERIALIZER.query("custom_domains", q, 'str') if q is not None else '' for q in custom_domains] + + # 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_log_analytics_locations_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsLocations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_log_analytics_resources_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_waf_log_analytics_metrics_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + *, + metrics: List[Union[str, "_models.WafMetric"]], + date_time_begin: datetime.datetime, + date_time_end: datetime.datetime, + granularity: Union[str, "_models.WafGranularity"], + actions: Optional[List[Union[str, "_models.WafAction"]]] = None, + group_by: Optional[List[Union[str, "_models.WafRankingGroupBy"]]] = None, + rule_types: Optional[List[Union[str, "_models.WafRuleType"]]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsMetrics') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['metrics'] = [_SERIALIZER.query("metrics", q, 'str') if q is not None else '' for q in metrics] + query_parameters['dateTimeBegin'] = _SERIALIZER.query("date_time_begin", date_time_begin, 'iso-8601') + query_parameters['dateTimeEnd'] = _SERIALIZER.query("date_time_end", date_time_end, 'iso-8601') + query_parameters['granularity'] = _SERIALIZER.query("granularity", granularity, 'str') + if actions is not None: + query_parameters['actions'] = [_SERIALIZER.query("actions", q, 'str') if q is not None else '' for q in actions] + if group_by is not None: + query_parameters['groupBy'] = [_SERIALIZER.query("group_by", q, 'str') if q is not None else '' for q in group_by] + if rule_types is not None: + query_parameters['ruleTypes'] = [_SERIALIZER.query("rule_types", q, 'str') if q is not None else '' for q in rule_types] + + # 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_waf_log_analytics_rankings_request( + subscription_id: str, + resource_group_name: str, + profile_name: str, + *, + metrics: List[Union[str, "_models.WafMetric"]], + date_time_begin: datetime.datetime, + date_time_end: datetime.datetime, + max_ranking: int, + rankings: List[Union[str, "_models.WafRankingType"]], + actions: Optional[List[Union[str, "_models.WafAction"]]] = None, + rule_types: Optional[List[Union[str, "_models.WafRuleType"]]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsRankings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['metrics'] = [_SERIALIZER.query("metrics", q, 'str') if q is not None else '' for q in metrics] + query_parameters['dateTimeBegin'] = _SERIALIZER.query("date_time_begin", date_time_begin, 'iso-8601') + query_parameters['dateTimeEnd'] = _SERIALIZER.query("date_time_end", date_time_end, 'iso-8601') + query_parameters['maxRanking'] = _SERIALIZER.query("max_ranking", max_ranking, 'int') + query_parameters['rankings'] = [_SERIALIZER.query("rankings", q, 'str') if q is not None else '' for q in rankings] + if actions is not None: + query_parameters['actions'] = [_SERIALIZER.query("actions", q, 'str') if q is not None else '' for q in actions] + if rule_types is not None: + query_parameters['ruleTypes'] = [_SERIALIZER.query("rule_types", q, 'str') if q is not None else '' for q in rule_types] + + # 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 LogAnalyticsOperations(object): """LogAnalyticsOperations operations. @@ -45,27 +328,28 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_log_analytics_metrics( self, - resource_group_name, # type: str - profile_name, # type: str - metrics, # type: List[Union[str, "_models.LogMetric"]] - date_time_begin, # type: datetime.datetime - date_time_end, # type: datetime.datetime - granularity, # type: Union[str, "_models.LogMetricsGranularity"] - custom_domains, # type: List[str] - protocols, # type: List[str] - group_by=None, # type: Optional[List[Union[str, "_models.LogMetricsGroupBy"]]] - continents=None, # type: Optional[List[str]] - country_or_regions=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> "_models.MetricsResponse" + resource_group_name: str, + profile_name: str, + metrics: List[Union[str, "_models.LogMetric"]], + date_time_begin: datetime.datetime, + date_time_end: datetime.datetime, + granularity: Union[str, "_models.LogMetricsGranularity"], + custom_domains: List[str], + protocols: List[str], + group_by: Optional[List[Union[str, "_models.LogMetricsGroupBy"]]] = None, + continents: Optional[List[str]] = None, + country_or_regions: Optional[List[str]] = None, + **kwargs: Any + ) -> "_models.MetricsResponse": """Get log report for AFD profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :param metrics: :type metrics: list[str or ~azure.mgmt.cdn.models.LogMetric] @@ -95,45 +379,32 @@ def get_log_analytics_metrics( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_log_analytics_metrics.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['metrics'] = [self._serialize.query("metrics", q, 'str') if q is not None else '' for q in metrics] - query_parameters['dateTimeBegin'] = self._serialize.query("date_time_begin", date_time_begin, 'iso-8601') - query_parameters['dateTimeEnd'] = self._serialize.query("date_time_end", date_time_end, 'iso-8601') - query_parameters['granularity'] = self._serialize.query("granularity", granularity, 'str') - if group_by is not None: - query_parameters['groupBy'] = [self._serialize.query("group_by", q, 'str') if q is not None else '' for q in group_by] - if continents is not None: - query_parameters['continents'] = [self._serialize.query("continents", q, 'str') if q is not None else '' for q in continents] - if country_or_regions is not None: - query_parameters['countryOrRegions'] = [self._serialize.query("country_or_regions", q, 'str') if q is not None else '' for q in country_or_regions] - query_parameters['customDomains'] = [self._serialize.query("custom_domains", q, 'str') if q is not None else '' for q in custom_domains] - query_parameters['protocols'] = [self._serialize.query("protocols", q, 'str') if q is not None else '' for q in protocols] - - # 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_log_analytics_metrics_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + metrics=metrics, + date_time_begin=date_time_begin, + date_time_end=date_time_end, + granularity=granularity, + custom_domains=custom_domains, + protocols=protocols, + group_by=group_by, + continents=continents, + country_or_regions=country_or_regions, + template_url=self.get_log_analytics_metrics.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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MetricsResponse', pipeline_response) @@ -142,26 +413,29 @@ def get_log_analytics_metrics( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_analytics_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsMetrics'} # type: ignore + + @distributed_trace def get_log_analytics_rankings( self, - resource_group_name, # type: str - profile_name, # type: str - rankings, # type: List[Union[str, "_models.LogRanking"]] - metrics, # type: List[Union[str, "_models.LogRankingMetric"]] - max_ranking, # type: int - date_time_begin, # type: datetime.datetime - date_time_end, # type: datetime.datetime - custom_domains=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> "_models.RankingsResponse" + resource_group_name: str, + profile_name: str, + rankings: List[Union[str, "_models.LogRanking"]], + metrics: List[Union[str, "_models.LogRankingMetric"]], + max_ranking: int, + date_time_begin: datetime.datetime, + date_time_end: datetime.datetime, + custom_domains: Optional[List[str]] = None, + **kwargs: Any + ) -> "_models.RankingsResponse": """Get log analytics ranking report for AFD profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :param rankings: :type rankings: list[str or ~azure.mgmt.cdn.models.LogRanking] @@ -185,40 +459,29 @@ def get_log_analytics_rankings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_log_analytics_rankings.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['rankings'] = [self._serialize.query("rankings", q, 'str') if q is not None else '' for q in rankings] - query_parameters['metrics'] = [self._serialize.query("metrics", q, 'str') if q is not None else '' for q in metrics] - query_parameters['maxRanking'] = self._serialize.query("max_ranking", max_ranking, 'int') - query_parameters['dateTimeBegin'] = self._serialize.query("date_time_begin", date_time_begin, 'iso-8601') - query_parameters['dateTimeEnd'] = self._serialize.query("date_time_end", date_time_end, 'iso-8601') - if custom_domains is not None: - query_parameters['customDomains'] = [self._serialize.query("custom_domains", q, 'str') if q is not None else '' for q in custom_domains] - - # 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_log_analytics_rankings_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + rankings=rankings, + metrics=metrics, + max_ranking=max_ranking, + date_time_begin=date_time_begin, + date_time_end=date_time_end, + custom_domains=custom_domains, + template_url=self.get_log_analytics_rankings.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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RankingsResponse', pipeline_response) @@ -227,20 +490,23 @@ def get_log_analytics_rankings( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_analytics_rankings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsRankings'} # type: ignore + + @distributed_trace def get_log_analytics_locations( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ContinentsResponse" + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> "_models.ContinentsResponse": """Get all available location names for AFD log analytics report. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ContinentsResponse, or the result of cls(response) @@ -252,33 +518,23 @@ def get_log_analytics_locations( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_log_analytics_locations.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_log_analytics_locations_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self.get_log_analytics_locations.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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ContinentsResponse', pipeline_response) @@ -287,20 +543,23 @@ def get_log_analytics_locations( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_analytics_locations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsLocations'} # type: ignore + + @distributed_trace def get_log_analytics_resources( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourcesResponse" + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> "_models.ResourcesResponse": """Get all endpoints and custom domains available for AFD log report. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ResourcesResponse, or the result of cls(response) @@ -312,33 +571,23 @@ def get_log_analytics_resources( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_log_analytics_resources.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_log_analytics_resources_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + template_url=self.get_log_analytics_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ResourcesResponse', pipeline_response) @@ -347,27 +596,30 @@ def get_log_analytics_resources( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_analytics_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsResources'} # type: ignore + + @distributed_trace def get_waf_log_analytics_metrics( self, - resource_group_name, # type: str - profile_name, # type: str - metrics, # type: List[Union[str, "_models.WafMetric"]] - date_time_begin, # type: datetime.datetime - date_time_end, # type: datetime.datetime - granularity, # type: Union[str, "_models.WafGranularity"] - actions=None, # type: Optional[List[Union[str, "_models.WafAction"]]] - group_by=None, # type: Optional[List[Union[str, "_models.WafRankingGroupBy"]]] - rule_types=None, # type: Optional[List[Union[str, "_models.WafRuleType"]]] - **kwargs # type: Any - ): - # type: (...) -> "_models.WafMetricsResponse" + resource_group_name: str, + profile_name: str, + metrics: List[Union[str, "_models.WafMetric"]], + date_time_begin: datetime.datetime, + date_time_end: datetime.datetime, + granularity: Union[str, "_models.WafGranularity"], + actions: Optional[List[Union[str, "_models.WafAction"]]] = None, + group_by: Optional[List[Union[str, "_models.WafRankingGroupBy"]]] = None, + rule_types: Optional[List[Union[str, "_models.WafRuleType"]]] = None, + **kwargs: Any + ) -> "_models.WafMetricsResponse": """Get Waf related log analytics report for AFD profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :param metrics: :type metrics: list[str or ~azure.mgmt.cdn.models.WafMetric] @@ -393,43 +645,30 @@ def get_waf_log_analytics_metrics( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_waf_log_analytics_metrics.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['metrics'] = [self._serialize.query("metrics", q, 'str') if q is not None else '' for q in metrics] - query_parameters['dateTimeBegin'] = self._serialize.query("date_time_begin", date_time_begin, 'iso-8601') - query_parameters['dateTimeEnd'] = self._serialize.query("date_time_end", date_time_end, 'iso-8601') - query_parameters['granularity'] = self._serialize.query("granularity", granularity, 'str') - if actions is not None: - query_parameters['actions'] = [self._serialize.query("actions", q, 'str') if q is not None else '' for q in actions] - if group_by is not None: - query_parameters['groupBy'] = [self._serialize.query("group_by", q, 'str') if q is not None else '' for q in group_by] - if rule_types is not None: - query_parameters['ruleTypes'] = [self._serialize.query("rule_types", q, 'str') if q is not None else '' for q in rule_types] - - # 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_waf_log_analytics_metrics_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + metrics=metrics, + date_time_begin=date_time_begin, + date_time_end=date_time_end, + granularity=granularity, + actions=actions, + group_by=group_by, + rule_types=rule_types, + template_url=self.get_waf_log_analytics_metrics.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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WafMetricsResponse', pipeline_response) @@ -438,27 +677,30 @@ def get_waf_log_analytics_metrics( return cls(pipeline_response, deserialized, {}) return deserialized + get_waf_log_analytics_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsMetrics'} # type: ignore + + @distributed_trace def get_waf_log_analytics_rankings( self, - resource_group_name, # type: str - profile_name, # type: str - metrics, # type: List[Union[str, "_models.WafMetric"]] - date_time_begin, # type: datetime.datetime - date_time_end, # type: datetime.datetime - max_ranking, # type: int - rankings, # type: List[Union[str, "_models.WafRankingType"]] - actions=None, # type: Optional[List[Union[str, "_models.WafAction"]]] - rule_types=None, # type: Optional[List[Union[str, "_models.WafRuleType"]]] - **kwargs # type: Any - ): - # type: (...) -> "_models.WafRankingsResponse" + resource_group_name: str, + profile_name: str, + metrics: List[Union[str, "_models.WafMetric"]], + date_time_begin: datetime.datetime, + date_time_end: datetime.datetime, + max_ranking: int, + rankings: List[Union[str, "_models.WafRankingType"]], + actions: Optional[List[Union[str, "_models.WafAction"]]] = None, + rule_types: Optional[List[Union[str, "_models.WafRuleType"]]] = None, + **kwargs: Any + ) -> "_models.WafRankingsResponse": """Get WAF log analytics charts for AFD profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. which is unique within the resource group. :type profile_name: str :param metrics: :type metrics: list[str or ~azure.mgmt.cdn.models.WafMetric] @@ -484,42 +726,30 @@ def get_waf_log_analytics_rankings( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.get_waf_log_analytics_rankings.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['metrics'] = [self._serialize.query("metrics", q, 'str') if q is not None else '' for q in metrics] - query_parameters['dateTimeBegin'] = self._serialize.query("date_time_begin", date_time_begin, 'iso-8601') - query_parameters['dateTimeEnd'] = self._serialize.query("date_time_end", date_time_end, 'iso-8601') - query_parameters['maxRanking'] = self._serialize.query("max_ranking", max_ranking, 'int') - query_parameters['rankings'] = [self._serialize.query("rankings", q, 'str') if q is not None else '' for q in rankings] - if actions is not None: - query_parameters['actions'] = [self._serialize.query("actions", q, 'str') if q is not None else '' for q in actions] - if rule_types is not None: - query_parameters['ruleTypes'] = [self._serialize.query("rule_types", q, 'str') if q is not None else '' for q in rule_types] - - # 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_waf_log_analytics_rankings_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + profile_name=profile_name, + metrics=metrics, + date_time_begin=date_time_begin, + date_time_end=date_time_end, + max_ranking=max_ranking, + rankings=rankings, + actions=actions, + rule_types=rule_types, + template_url=self.get_waf_log_analytics_rankings.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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WafRankingsResponse', pipeline_response) @@ -528,4 +758,6 @@ def get_waf_log_analytics_rankings( return cls(pipeline_response, deserialized, {}) return deserialized + get_waf_log_analytics_rankings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsRankings'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_managed_rule_sets_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_managed_rule_sets_operations.py index 00552854ac51..1a96daead9b4 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_managed_rule_sets_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets') + 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.cdn.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-09-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,13 +131,14 @@ 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.Cdn/CdnWebApplicationFirewallManagedRuleSets'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_operations.py index dbf8578c17d5..da808a7a8533 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Cdn/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,15 +72,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.OperationsListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationsListResult"]: """Lists all of the available CDN REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationsListResult or the result of cls(response) + :return: An iterator like instance of either OperationsListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.OperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsListResult', pipeline_response) + deserialized = self._deserialize("OperationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +123,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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_origin_groups_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_origin_groups_operations.py index 517f3130ce49..a9be8268caa5 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_origin_groups_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_origin_groups_operations.py @@ -5,25 +5,239 @@ # 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_endpoint_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + 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( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + 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( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "originGroupName": _SERIALIZER.url("origin_group_name", origin_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OriginGroupsOperations(object): """OriginGroupsOperations operations. @@ -47,14 +261,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_endpoint( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OriginGroupListResult"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> Iterable["_models.OriginGroupListResult"]: """Lists all of the existing origin groups within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -64,7 +278,8 @@ def list_by_endpoint( :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OriginGroupListResult or the result of cls(response) + :return: An iterator like instance of either OriginGroupListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.OriginGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -73,37 +288,35 @@ def list_by_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_endpoint.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_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('OriginGroupListResult', pipeline_response) + deserialized = self._deserialize("OriginGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,26 +329,27 @@ 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_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OriginGroup" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + **kwargs: Any + ) -> "_models.OriginGroup": """Gets an existing origin group within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -156,35 +370,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_group_name=origin_group_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('OriginGroup', pipeline_response) @@ -193,58 +397,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_group_name, # type: str - origin_group, # type: "_models.OriginGroup" - **kwargs # type: Any - ): - # type: (...) -> "_models.OriginGroup" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group: "_models.OriginGroup", + **kwargs: Any + ) -> "_models.OriginGroup": cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(origin_group, 'OriginGroup') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(origin_group, 'OriginGroup') - 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('OriginGroup', pipeline_response) @@ -259,18 +453,20 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_group_name, # type: str - origin_group, # type: "_models.OriginGroup" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OriginGroup"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group: "_models.OriginGroup", + **kwargs: Any + ) -> LROPoller["_models.OriginGroup"]: """Creates a new origin group within the specified endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -285,15 +481,19 @@ def begin_create( :type origin_group: ~azure.mgmt.cdn.models.OriginGroup :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 OriginGroup 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 OriginGroup or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.OriginGroup] - :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.OriginGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -307,29 +507,21 @@ def begin_create( endpoint_name=endpoint_name, origin_group_name=origin_group_name, origin_group=origin_group, + 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('OriginGroup', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - '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: @@ -341,58 +533,47 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_group_name, # type: str - origin_group_update_properties, # type: "_models.OriginGroupUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.OriginGroup" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group_update_properties: "_models.OriginGroupUpdateParameters", + **kwargs: Any + ) -> "_models.OriginGroup": cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(origin_group_update_properties, 'OriginGroupUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_group_name=origin_group_name, + subscription_id=self._config.subscription_id, + 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(origin_group_update_properties, 'OriginGroupUpdateParameters') - 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('OriginGroup', pipeline_response) @@ -404,18 +585,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_group_name, # type: str - origin_group_update_properties, # type: "_models.OriginGroupUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OriginGroup"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group_update_properties: "_models.OriginGroupUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.OriginGroup"]: """Updates an existing origin group within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -430,15 +613,19 @@ def begin_update( :type origin_group_update_properties: ~azure.mgmt.cdn.models.OriginGroupUpdateParameters :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 OriginGroup 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 OriginGroup or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.OriginGroup] - :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.OriginGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -452,29 +639,21 @@ def begin_update( endpoint_name=endpoint_name, origin_group_name=origin_group_name, origin_group_update_properties=origin_group_update_properties, + 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('OriginGroup', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - '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: @@ -486,67 +665,57 @@ 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_group_name=origin_group_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 - if response.status_code not in [202, 204]: + 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing origin group within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -559,15 +728,17 @@ def begin_delete( :type origin_group_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', @@ -583,23 +754,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originGroupName': self._serialize.url("origin_group_name", origin_group_name, 'str'), - '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: @@ -611,4 +773,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.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_origins_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_origins_operations.py index f08639a66920..b7456e5edd38 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_origins_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_origins_operations.py @@ -5,25 +5,239 @@ # 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_endpoint_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "originName": _SERIALIZER.url("origin_name", origin_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "originName": _SERIALIZER.url("origin_name", origin_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "originName": _SERIALIZER.url("origin_name", origin_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "originName": _SERIALIZER.url("origin_name", origin_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OriginsOperations(object): """OriginsOperations operations. @@ -47,14 +261,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_endpoint( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OriginListResult"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> Iterable["_models.OriginListResult"]: """Lists all of the existing origins within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -73,37 +287,35 @@ def list_by_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_endpoint.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_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('OriginListResult', pipeline_response) + deserialized = self._deserialize("OriginListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,26 +328,27 @@ 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_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Origin" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + **kwargs: Any + ) -> "_models.Origin": """Gets an existing origin within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -156,35 +369,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_name=origin_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('Origin', pipeline_response) @@ -193,58 +396,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_name, # type: str - origin, # type: "_models.Origin" - **kwargs # type: Any - ): - # type: (...) -> "_models.Origin" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin: "_models.Origin", + **kwargs: Any + ) -> "_models.Origin": cls = kwargs.pop('cls', None) # type: ClsType["_models.Origin"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(origin, 'Origin') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_name=origin_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(origin, 'Origin') - 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('Origin', pipeline_response) @@ -259,18 +452,20 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_name, # type: str - origin, # type: "_models.Origin" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Origin"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin: "_models.Origin", + **kwargs: Any + ) -> LROPoller["_models.Origin"]: """Creates a new origin within the specified endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -285,15 +480,18 @@ def begin_create( :type origin: ~azure.mgmt.cdn.models.Origin :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 Origin or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Origin] - :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.Origin"] lro_delay = kwargs.pop( 'polling_interval', @@ -307,29 +505,21 @@ def begin_create( endpoint_name=endpoint_name, origin_name=origin_name, origin=origin, + 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('Origin', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - '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: @@ -341,58 +531,47 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_name, # type: str - origin_update_properties, # type: "_models.OriginUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Origin" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin_update_properties: "_models.OriginUpdateParameters", + **kwargs: Any + ) -> "_models.Origin": cls = kwargs.pop('cls', None) # type: ClsType["_models.Origin"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(origin_update_properties, 'OriginUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_name=origin_name, + subscription_id=self._config.subscription_id, + 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(origin_update_properties, 'OriginUpdateParameters') - 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('Origin', pipeline_response) @@ -404,18 +583,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_name, # type: str - origin_update_properties, # type: "_models.OriginUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Origin"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin_update_properties: "_models.OriginUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Origin"]: """Updates an existing origin within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -430,15 +611,18 @@ def begin_update( :type origin_update_properties: ~azure.mgmt.cdn.models.OriginUpdateParameters :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 Origin or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Origin] - :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.Origin"] lro_delay = kwargs.pop( 'polling_interval', @@ -452,29 +636,21 @@ def begin_update( endpoint_name=endpoint_name, origin_name=origin_name, origin_update_properties=origin_update_properties, + 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('Origin', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - '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: @@ -486,67 +662,57 @@ 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + origin_name=origin_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 - if response.status_code not in [202, 204]: + 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - origin_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing origin within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -559,15 +725,17 @@ def begin_delete( :type origin_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', @@ -583,23 +751,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'originName': self._serialize.url("origin_name", origin_name, 'str'), - '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: @@ -611,4 +770,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.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_policies_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_policies_operations.py index 8d588616174f..455394382442 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_policies_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_policies_operations.py @@ -5,25 +5,219 @@ # 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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies') + 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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{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_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + policy_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{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="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PoliciesOperations(object): """PoliciesOperations operations. @@ -47,19 +241,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.CdnWebApplicationFirewallPolicyList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.CdnWebApplicationFirewallPolicyList"]: """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 CdnWebApplicationFirewallPolicyList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyList] + :return: An iterator like instance of either CdnWebApplicationFirewallPolicyList or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicyList"] @@ -67,35 +263,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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('CdnWebApplicationFirewallPolicyList', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicyList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,24 +300,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.Cdn/CdnWebApplicationFirewallPolicies'} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CdnWebApplicationFirewallPolicy" + resource_group_name: str, + policy_name: str, + **kwargs: Any + ) -> "_models.CdnWebApplicationFirewallPolicy": """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 +335,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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('CdnWebApplicationFirewallPolicy', pipeline_response) @@ -177,54 +360,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - policy_name, # type: str - cdn_web_application_firewall_policy, # type: "_models.CdnWebApplicationFirewallPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.CdnWebApplicationFirewallPolicy" + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy: "_models.CdnWebApplicationFirewallPolicy", + **kwargs: Any + ) -> "_models.CdnWebApplicationFirewallPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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(cdn_web_application_firewall_policy, 'CdnWebApplicationFirewallPolicy') - # 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(cdn_web_application_firewall_policy, 'CdnWebApplicationFirewallPolicy') - 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('CdnWebApplicationFirewallPolicy', pipeline_response) @@ -239,16 +412,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.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - policy_name, # type: str - cdn_web_application_firewall_policy, # type: "_models.CdnWebApplicationFirewallPolicy" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CdnWebApplicationFirewallPolicy"] + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy: "_models.CdnWebApplicationFirewallPolicy", + **kwargs: Any + ) -> LROPoller["_models.CdnWebApplicationFirewallPolicy"]: """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. @@ -256,18 +431,23 @@ def begin_create_or_update( :param policy_name: The name of the CdnWebApplicationFirewallPolicy. :type policy_name: str :param cdn_web_application_firewall_policy: Policy to be created. - :type cdn_web_application_firewall_policy: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy + :type cdn_web_application_firewall_policy: + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy :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 CdnWebApplicationFirewallPolicy 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 CdnWebApplicationFirewallPolicy or the + result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] - :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.CdnWebApplicationFirewallPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,27 +459,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy=cdn_web_application_firewall_policy, + 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('CdnWebApplicationFirewallPolicy', 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,54 +485,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.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - policy_name, # type: str - cdn_web_application_firewall_policy_patch_parameters, # type: "_models.CdnWebApplicationFirewallPolicyPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CdnWebApplicationFirewallPolicy" + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy_patch_parameters: "_models.CdnWebApplicationFirewallPolicyPatchParameters", + **kwargs: Any + ) -> "_models.CdnWebApplicationFirewallPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - '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(cdn_web_application_firewall_policy_patch_parameters, 'CdnWebApplicationFirewallPolicyPatchParameters') + + request = build_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._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(cdn_web_application_firewall_policy_patch_parameters, 'CdnWebApplicationFirewallPolicyPatchParameters') - 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('CdnWebApplicationFirewallPolicy', pipeline_response) @@ -370,16 +533,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - policy_name, # type: str - cdn_web_application_firewall_policy_patch_parameters, # type: "_models.CdnWebApplicationFirewallPolicyPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CdnWebApplicationFirewallPolicy"] + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy_patch_parameters: "_models.CdnWebApplicationFirewallPolicyPatchParameters", + **kwargs: Any + ) -> LROPoller["_models.CdnWebApplicationFirewallPolicy"]: """Update an existing CdnWebApplicationFirewallPolicy with the specified policy name under the specified subscription and resource group. @@ -389,18 +554,23 @@ def begin_update( :type policy_name: str :param cdn_web_application_firewall_policy_patch_parameters: CdnWebApplicationFirewallPolicy parameters to be patched. - :type cdn_web_application_firewall_policy_patch_parameters: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters + :type cdn_web_application_firewall_policy_patch_parameters: + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters :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 CdnWebApplicationFirewallPolicy 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 CdnWebApplicationFirewallPolicy or the + result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] - :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.CdnWebApplicationFirewallPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -412,27 +582,21 @@ def begin_update( resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy_patch_parameters=cdn_web_application_firewall_policy_patch_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('CdnWebApplicationFirewallPolicy', 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: @@ -444,15 +608,16 @@ 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.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + + @distributed_trace def delete( 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: """Deletes Policy. :param resource_group_name: Name of the Resource group within the Azure subscription. @@ -469,33 +634,27 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - - # Construct URL - url = self.delete.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( + resource_group_name=resource_group_name, + policy_name=policy_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}'} # type: ignore + diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_profiles_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_profiles_operations.py index f8786089ce84..eec9c81f9c34 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_profiles_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_profiles_operations.py @@ -5,25 +5,355 @@ # 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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles') + 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( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + profile_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_sso_uri_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_supported_optimization_types_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getSupportedOptimizationTypes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_resource_usage_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ProfilesOperations(object): """ProfilesOperations operations. @@ -47,12 +377,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProfileListResult"] - """Lists all of the CDN profiles within an Azure subscription. + **kwargs: Any + ) -> Iterable["_models.ProfileListResult"]: + """Lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles 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 ProfileListResult or the result of cls(response) @@ -64,34 +395,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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('ProfileListResult', pipeline_response) + deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,24 +430,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.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ProfileListResult"] - """Lists all of the CDN profiles within a resource group. + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ProfileListResult"]: + """Lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles within a + resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str @@ -135,35 +463,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProfileListResult', pipeline_response) + deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -176,30 +500,32 @@ 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.Cdn/profiles'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Profile" - """Gets a CDN profile with the specified profile name under the specified subscription and - resource group. + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> "_models.Profile": + """Gets an Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified + profile name under the specified subscription and resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Profile, or the result of cls(response) @@ -211,33 +537,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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) @@ -246,54 +562,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - profile, # type: "_models.Profile" - **kwargs # type: Any - ): - # type: (...) -> "_models.Profile" + resource_group_name: str, + profile_name: str, + profile: "_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 = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(profile, '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_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(profile, '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) @@ -308,36 +614,42 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - profile, # type: "_models.Profile" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Profile"] - """Creates a new CDN profile with a profile name under the specified subscription and resource - group. + resource_group_name: str, + profile_name: str, + profile: "_models.Profile", + **kwargs: Any + ) -> LROPoller["_models.Profile"]: + """Creates a new Azure Front Door Standard or Azure Front Door Premium or CDN profile with a + profile name under the specified subscription and resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :type profile_name: str :param profile: Profile properties needed to create a new profile. :type profile: ~azure.mgmt.cdn.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.cdn.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', @@ -349,27 +661,21 @@ def begin_create( resource_group_name=resource_group_name, profile_name=profile_name, profile=profile, + 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - '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: @@ -381,54 +687,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - profile_update_parameters, # type: "_models.ProfileUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Profile" + resource_group_name: str, + profile_name: str, + profile_update_parameters: "_models.ProfileUpdateParameters", + **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 = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(profile_update_parameters, 'ProfileUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_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(profile_update_parameters, 'ProfileUpdateParameters') - 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) @@ -440,36 +735,42 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - profile_update_parameters, # type: "_models.ProfileUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Profile"] - """Updates an existing CDN profile with the specified profile name under the specified - subscription and resource group. + resource_group_name: str, + profile_name: str, + profile_update_parameters: "_models.ProfileUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Profile"]: + """Updates an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with + the specified profile name under the specified subscription and resource group. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :type profile_name: str :param profile_update_parameters: Profile properties needed to update an existing profile. :type profile_update_parameters: ~azure.mgmt.cdn.models.ProfileUpdateParameters :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.cdn.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', @@ -481,27 +782,21 @@ def begin_update( resource_group_name=resource_group_name, profile_name=profile_name, profile_update_parameters=profile_update_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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - '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: @@ -513,79 +808,73 @@ 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.Cdn/profiles/{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 = "2020-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_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 - if response.status_code not in [202, 204]: + 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.Cdn/profiles/{profileName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Deletes an existing CDN profile with the specified parameters. Deleting a profile will result - in the deletion of all of the sub-resources including endpoints, origins and custom domains. + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Front Door Standard or Azure Front Door Premium or CDN profile with + the specified parameters. Deleting a profile will result in the deletion of all of the + sub-resources including endpoints, origins and custom domains. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :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', @@ -599,21 +888,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - '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: @@ -625,15 +907,16 @@ 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.Cdn/profiles/{profileName}'} # type: ignore + @distributed_trace def generate_sso_uri( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SsoUri" + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> "_models.SsoUri": """Generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemental portal is used to configure advanced feature capabilities that are not yet available in the Azure portal, such as core reports in a standard profile; rules engine, advanced HTTP reports, and @@ -654,33 +937,23 @@ def generate_sso_uri( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.generate_sso_uri.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_sso_uri_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + template_url=self.generate_sso_uri.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SsoUri', pipeline_response) @@ -689,21 +962,24 @@ def generate_sso_uri( return cls(pipeline_response, deserialized, {}) return deserialized + generate_sso_uri.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri'} # type: ignore + + @distributed_trace def list_supported_optimization_types( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SupportedOptimizationTypesListResult" + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> "_models.SupportedOptimizationTypesListResult": """Gets the supported optimization types for the current profile. A user can create an endpoint with an optimization type from the listed values. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportedOptimizationTypesListResult, or the result of cls(response) @@ -715,33 +991,23 @@ def list_supported_optimization_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self.list_supported_optimization_types.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_supported_optimization_types_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + template_url=self.list_supported_optimization_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SupportedOptimizationTypesListResult', pipeline_response) @@ -750,23 +1016,28 @@ def list_supported_optimization_types( return cls(pipeline_response, deserialized, {}) return deserialized + list_supported_optimization_types.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getSupportedOptimizationTypes'} # type: ignore + + @distributed_trace def list_resource_usage( self, - resource_group_name, # type: str - profile_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceUsageListResult"] - """Checks the quota and actual usage of endpoints under the given CDN profile. + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.ResourceUsageListResult"]: + """Checks the quota and actual usage of endpoints under the given Azure Front Door Standard or + Azure Front Door Premium or CDN profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium or CDN + profile which is unique within the resource group. :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 ResourceUsageListResult or the result of cls(response) + :return: An iterator like instance of either ResourceUsageListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -775,36 +1046,33 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_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('ResourceUsageListResult', pipeline_response) + deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -817,12 +1085,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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_resource_usage_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_resource_usage_operations.py index 3d3efd59e59d..85dacfa4007c 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_resource_usage_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_resource_usage_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage') + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ResourceUsageOperations(object): """ResourceUsageOperations 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.ResourceUsageListResult"] + **kwargs: Any + ) -> Iterable["_models.ResourceUsageListResult"]: """Check the quota and actual usage of the CDN profiles under the given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceUsageListResult or the result of cls(response) + :return: An iterator like instance of either ResourceUsageListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] :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-09-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.post(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('ResourceUsageListResult', pipeline_response) + deserialized = self._deserialize("ResourceUsageListResult", 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/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_routes_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_routes_operations.py index f06d3cf5f460..cd7701c0ead6 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_routes_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_routes_operations.py @@ -5,25 +5,239 @@ # 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_endpoint_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "routeName": _SERIALIZER.url("route_name", route_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "routeName": _SERIALIZER.url("route_name", route_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "routeName": _SERIALIZER.url("route_name", route_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str'), + "routeName": _SERIALIZER.url("route_name", route_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RoutesOperations(object): """RoutesOperations operations. @@ -47,19 +261,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_endpoint( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RouteListResult"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + **kwargs: Any + ) -> Iterable["_models.RouteListResult"]: """Lists all of the existing origins within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -73,37 +288,35 @@ def list_by_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_endpoint.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_endpoint_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_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('RouteListResult', pipeline_response) + deserialized = self._deserialize("RouteListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,32 +329,34 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - route_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Route" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + **kwargs: Any + ) -> "_models.Route": """Gets an existing route with the specified route name under the specified subscription, resource group, profile, and AzureFrontDoor endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -157,35 +372,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + route_name=route_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Route', pipeline_response) @@ -194,58 +399,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - route_name, # type: str - route, # type: "_models.Route" - **kwargs # type: Any - ): - # type: (...) -> "_models.Route" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route: "_models.Route", + **kwargs: Any + ) -> "_models.Route": cls = kwargs.pop('cls', None) # type: ClsType["_models.Route"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(route, 'Route') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + route_name=route_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(route, 'Route') - 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.AfdErrorResponse, 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('Route', pipeline_response) @@ -260,24 +455,27 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - route_name, # type: str - route, # type: "_models.Route" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Route"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route: "_models.Route", + **kwargs: Any + ) -> LROPoller["_models.Route"]: """Creates a new route with the specified route name under the specified subscription, resource group, profile, and AzureFrontDoor endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -287,15 +485,18 @@ def begin_create( :type route: ~azure.mgmt.cdn.models.Route :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 Route or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Route] - :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.Route"] lro_delay = kwargs.pop( 'polling_interval', @@ -309,29 +510,21 @@ def begin_create( endpoint_name=endpoint_name, route_name=route_name, route=route, + 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('Route', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -343,58 +536,47 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - route_name, # type: str - route_update_properties, # type: "_models.RouteUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Route" + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route_update_properties: "_models.RouteUpdateParameters", + **kwargs: Any + ) -> "_models.Route": cls = kwargs.pop('cls', None) # type: ClsType["_models.Route"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(route_update_properties, 'RouteUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + route_name=route_name, + subscription_id=self._config.subscription_id, + 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(route_update_properties, 'RouteUpdateParameters') - 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.AfdErrorResponse, 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('Route', pipeline_response) @@ -406,24 +588,27 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - route_name, # type: str - route_update_properties, # type: "_models.RouteUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Route"] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route_update_properties: "_models.RouteUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Route"]: """Updates an existing route with the specified route name under the specified subscription, resource group, profile, and AzureFrontDoor endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -433,15 +618,18 @@ def begin_update( :type route_update_properties: ~azure.mgmt.cdn.models.RouteUpdateParameters :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 Route or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Route] - :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.Route"] lro_delay = kwargs.pop( 'polling_interval', @@ -455,29 +643,21 @@ def begin_update( endpoint_name=endpoint_name, route_name=route_name, route_update_properties=route_update_properties, + 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('Route', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -489,73 +669,64 @@ 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - route_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + route_name=route_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - endpoint_name, # type: str - route_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing route with the specified route name under the specified subscription, resource group, profile, and AzureFrontDoor endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. :type endpoint_name: str @@ -563,15 +734,17 @@ def begin_delete( :type route_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', @@ -587,23 +760,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'endpointName': self._serialize.url("endpoint_name", endpoint_name, 'str'), - 'routeName': self._serialize.url("route_name", route_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -615,4 +779,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.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_rule_sets_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_rule_sets_operations.py index f21499f59e1c..dbba2ace4a1f 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_rule_sets_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_rule_sets_operations.py @@ -5,25 +5,210 @@ # 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_profile_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + rule_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + profile_name: str, + rule_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + rule_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_resource_usage_request( + resource_group_name: str, + profile_name: str, + rule_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/usages') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RuleSetsOperations(object): """RuleSetsOperations operations. @@ -47,18 +232,19 @@ 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.RuleSetListResult"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.RuleSetListResult"]: """Lists existing AzureFrontDoor rule sets within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :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 RuleSetListResult or the result of cls(response) @@ -70,36 +256,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('RuleSetListResult', pipeline_response) + deserialized = self._deserialize("RuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,31 +295,33 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/ruleSets'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RuleSet" + resource_group_name: str, + profile_name: str, + rule_set_name: str, + **kwargs: Any + ) -> "_models.RuleSet": """Gets an existing AzureFrontDoor rule set with the specified rule set name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. :type rule_set_name: str @@ -150,34 +335,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RuleSet', pipeline_response) @@ -186,49 +361,55 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore - def _create_initial( + + @distributed_trace + def create( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RuleSet" + resource_group_name: str, + profile_name: str, + rule_set_name: str, + **kwargs: Any + ) -> "_models.RuleSet": + """Creates a new rule set within the specified profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. + :type profile_name: str + :param rule_set_name: Name of the rule set under the profile which is unique globally. + :type rule_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.RuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleSet"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + subscription_id=self._config.subscription_id, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -237,164 +418,82 @@ def _create_initial( if response.status_code == 201: deserialized = self._deserialize('RuleSet', pipeline_response) - if response.status_code == 202: - deserialized = self._deserialize('RuleSet', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore - def begin_create( - self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RuleSet"] - """Creates a new rule set within the specified profile. + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore - :param resource_group_name: Name of the Resource group within the Azure subscription. - :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. - :type profile_name: str - :param rule_set_name: Name of the rule set under the profile which is unique globally. - :type rule_set_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 - :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 RuleSet or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.RuleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleSet"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - profile_name=profile_name, - rule_set_name=rule_set_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('RuleSet', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + rule_set_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_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 - if response.status_code not in [200, 204]: + 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + rule_set_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing AzureFrontDoor rule set with the specified rule set name under the specified subscription, resource group and profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. :type rule_set_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', @@ -409,22 +508,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -436,21 +527,23 @@ 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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore + @distributed_trace def list_resource_usage( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UsagesListResult"] + resource_group_name: str, + profile_name: str, + rule_set_name: str, + **kwargs: Any + ) -> Iterable["_models.UsagesListResult"]: """Checks the quota and actual usage of endpoints under the given CDN profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. :type rule_set_name: str @@ -464,37 +557,35 @@ def list_resource_usage( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_resource_usage.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_resource_usage.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_resource_usage_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_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('UsagesListResult', pipeline_response) + deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -507,12 +598,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_rules_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_rules_operations.py index 3f91bf505a2d..26bc9c7d4739 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_rules_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_rules_operations.py @@ -5,25 +5,239 @@ # 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_rule_set_request( + resource_group_name: str, + profile_name: str, + rule_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "ruleSetName": _SERIALIZER.url("rule_set_name", rule_set_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RulesOperations(object): """RulesOperations operations. @@ -47,19 +261,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_rule_set( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RuleListResult"] + resource_group_name: str, + profile_name: str, + rule_set_name: str, + **kwargs: Any + ) -> Iterable["_models.RuleListResult"]: """Lists all of the existing delivery rules within a rule set. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile. :type rule_set_name: str @@ -73,37 +288,35 @@ def list_by_rule_set( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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_rule_set.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_rule_set_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_rule_set.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_rule_set_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_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('RuleListResult', pipeline_response) + deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,31 +329,33 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Rule" + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.Rule": """Gets an existing delivery rule within a rule set. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile. :type rule_set_name: str @@ -156,35 +371,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + rule_name=rule_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Rule', pipeline_response) @@ -193,58 +398,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - rule_name, # type: str - rule, # type: "_models.Rule" - **kwargs # type: Any - ): - # type: (...) -> "_models.Rule" + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule: "_models.Rule", + **kwargs: Any + ) -> "_models.Rule": cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(rule, 'Rule') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(rule, 'Rule') - 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.AfdErrorResponse, 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('Rule', pipeline_response) @@ -259,23 +454,26 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - rule_name, # type: str - rule, # type: "_models.Rule" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Rule"] + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule: "_models.Rule", + **kwargs: Any + ) -> LROPoller["_models.Rule"]: """Creates a new delivery rule within the specified rule set. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile. :type rule_set_name: str @@ -285,15 +483,18 @@ def begin_create( :type rule: ~azure.mgmt.cdn.models.Rule :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 Rule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Rule] - :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.Rule"] lro_delay = kwargs.pop( 'polling_interval', @@ -307,29 +508,21 @@ def begin_create( rule_set_name=rule_set_name, rule_name=rule_name, rule=rule, + 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('Rule', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -341,58 +534,47 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - rule_name, # type: str - rule_update_properties, # type: "_models.RuleUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Rule" + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule_update_properties: "_models.RuleUpdateParameters", + **kwargs: Any + ) -> "_models.Rule": cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(rule_update_properties, 'RuleUpdateParameters') - # 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( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + 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(rule_update_properties, 'RuleUpdateParameters') - 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.AfdErrorResponse, 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('Rule', pipeline_response) @@ -404,23 +586,26 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - rule_name, # type: str - rule_update_properties, # type: "_models.RuleUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Rule"] + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule_update_properties: "_models.RuleUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Rule"]: """Updates an existing delivery rule within a rule set. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile. :type rule_set_name: str @@ -430,15 +615,18 @@ def begin_update( :type rule_update_properties: ~azure.mgmt.cdn.models.RuleUpdateParameters :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 Rule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Rule] - :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.Rule"] lro_delay = kwargs.pop( 'polling_interval', @@ -452,29 +640,21 @@ def begin_update( rule_set_name=rule_set_name, rule_name=rule_name, rule_update_properties=rule_update_properties, + 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('Rule', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -486,72 +666,63 @@ 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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + rule_set_name=rule_set_name, + rule_name=rule_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - rule_set_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing delivery rule within a rule set. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param rule_set_name: Name of the rule set under the profile. :type rule_set_name: str @@ -559,15 +730,17 @@ def begin_delete( :type rule_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', @@ -583,23 +756,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'ruleSetName': self._serialize.url("rule_set_name", rule_set_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -611,4 +775,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.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_secrets_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_secrets_operations.py index f3a52b4ee1cd..5fd499861184 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_secrets_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_secrets_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_profile_request( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + secret_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + secret_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + secret_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SecretsOperations(object): """SecretsOperations operations. @@ -47,18 +205,19 @@ 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.SecretListResult"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.SecretListResult"]: """Lists existing AzureFrontDoor secrets. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :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 SecretListResult or the result of cls(response) @@ -70,36 +229,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('SecretListResult', pipeline_response) + deserialized = self._deserialize("SecretListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,30 +268,32 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/secrets'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Secret" + resource_group_name: str, + profile_name: str, + secret_name: str, + **kwargs: Any + ) -> "_models.Secret": """Gets an existing Secret within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param secret_name: Name of the Secret under the profile. :type secret_name: str @@ -149,34 +307,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + secret_name=secret_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Secret', pipeline_response) @@ -185,56 +333,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - secret_name, # type: str - secret, # type: "_models.Secret" - **kwargs # type: Any - ): - # type: (...) -> "_models.Secret" + resource_group_name: str, + profile_name: str, + secret_name: str, + secret: "_models.Secret", + **kwargs: Any + ) -> "_models.Secret": cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(secret, 'Secret') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(secret, 'Secret') - 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.AfdErrorResponse, 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('Secret', pipeline_response) @@ -249,22 +387,25 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - secret_name, # type: str - secret, # type: "_models.Secret" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Secret"] + resource_group_name: str, + profile_name: str, + secret_name: str, + secret: "_models.Secret", + **kwargs: Any + ) -> LROPoller["_models.Secret"]: """Creates a new Secret within the specified profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param secret_name: Name of the Secret under the profile. :type secret_name: str @@ -272,15 +413,18 @@ def begin_create( :type secret: ~azure.mgmt.cdn.models.Secret :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 Secret or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Secret] - :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.Secret"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +437,21 @@ def begin_create( profile_name=profile_name, secret_name=secret_name, secret=secret, + 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('Secret', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -326,221 +463,76 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore - def _update_initial( - self, - resource_group_name, # type: str - profile_name, # type: str - secret_name, # type: str - secret_properties, # type: "_models.SecretProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.Secret" - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(secret_properties, 'SecretProperties') - 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.AfdErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Secret', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('Secret', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore - - def begin_update( - self, - resource_group_name, # type: str - profile_name, # type: str - secret_name, # type: str - secret_properties, # type: "_models.SecretProperties" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Secret"] - """Updates an existing Secret within a profile. - - :param resource_group_name: Name of the Resource group within the Azure subscription. - :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. - :type profile_name: str - :param secret_name: Name of the Secret under the profile. - :type secret_name: str - :param secret_properties: Secret properties. - :type secret_properties: ~azure.mgmt.cdn.models.SecretProperties - :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 - :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 Secret or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Secret] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - profile_name=profile_name, - secret_name=secret_name, - secret_properties=secret_properties, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Secret', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + secret_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + secret_name=secret_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + secret_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing Secret within profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param secret_name: Name of the Secret under the profile. :type secret_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', @@ -555,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -582,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.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_security_policies_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_security_policies_operations.py index 8e3b4d27bca1..88d7b6716d5e 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_security_policies_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_security_policies_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( + resource_group_name: str, + profile_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + profile_name: str, + security_policy_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "securityPolicyName": _SERIALIZER.url("security_policy_name", security_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name: str, + profile_name: str, + security_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "securityPolicyName": _SERIALIZER.url("security_policy_name", security_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch_request_initial( + resource_group_name: str, + profile_name: str, + security_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "securityPolicyName": _SERIALIZER.url("security_policy_name", security_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + profile_name: str, + security_policy_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "profileName": _SERIALIZER.url("profile_name", profile_name, 'str'), + "securityPolicyName": _SERIALIZER.url("security_policy_name", security_policy_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SecurityPoliciesOperations(object): """SecurityPoliciesOperations operations. @@ -47,21 +251,23 @@ 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.SecurityPolicyListResult"] + resource_group_name: str, + profile_name: str, + **kwargs: Any + ) -> Iterable["_models.SecurityPolicyListResult"]: """Lists security policies associated with the profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :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 SecurityPolicyListResult or the result of cls(response) + :return: An iterator like instance of either SecurityPolicyListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.SecurityPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +276,33 @@ def list_by_profile( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_profile_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + profile_name=profile_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('SecurityPolicyListResult', pipeline_response) + deserialized = self._deserialize("SecurityPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,30 +315,32 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.AfdErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, 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.Cdn/profiles/{profileName}/securityPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - profile_name, # type: str - security_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SecurityPolicy" + resource_group_name: str, + profile_name: str, + security_policy_name: str, + **kwargs: Any + ) -> "_models.SecurityPolicy": """Gets an existing security policy within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param security_policy_name: Name of the security policy under the profile. :type security_policy_name: str @@ -149,34 +354,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + security_policy_name=security_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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SecurityPolicy', pipeline_response) @@ -185,56 +380,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - profile_name, # type: str - security_policy_name, # type: str - security_policy, # type: "_models.SecurityPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecurityPolicy" + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy: "_models.SecurityPolicy", + **kwargs: Any + ) -> "_models.SecurityPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(security_policy, 'SecurityPolicy') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + security_policy_name=security_policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_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(security_policy, 'SecurityPolicy') - 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.AfdErrorResponse, 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('SecurityPolicy', pipeline_response) @@ -249,22 +434,25 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - profile_name, # type: str - security_policy_name, # type: str - security_policy, # type: "_models.SecurityPolicy" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SecurityPolicy"] + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy: "_models.SecurityPolicy", + **kwargs: Any + ) -> LROPoller["_models.SecurityPolicy"]: """Creates a new security policy within the specified profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param security_policy_name: Name of the security policy under the profile. :type security_policy_name: str @@ -272,15 +460,19 @@ def begin_create( :type security_policy: ~azure.mgmt.cdn.models.SecurityPolicy :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 SecurityPolicy 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 SecurityPolicy or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.SecurityPolicy] - :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.SecurityPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +485,21 @@ def begin_create( profile_name=profile_name, security_policy_name=security_policy_name, security_policy=security_policy, + 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('SecurityPolicy', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -326,56 +511,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore def _patch_initial( self, - resource_group_name, # type: str - profile_name, # type: str - security_policy_name, # type: str - security_policy_properties, # type: "_models.SecurityPolicyProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.SecurityPolicy" + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy_update_properties: "_models.SecurityPolicyUpdateParameters", + **kwargs: Any + ) -> "_models.SecurityPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(security_policy_update_properties, 'SecurityPolicyUpdateParameters') - # 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_patch_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + security_policy_name=security_policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._patch_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(security_policy_properties, 'SecurityPolicyProperties') - 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.AfdErrorResponse, 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('SecurityPolicy', pipeline_response) @@ -387,38 +561,45 @@ def _patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + + @distributed_trace def begin_patch( self, - resource_group_name, # type: str - profile_name, # type: str - security_policy_name, # type: str - security_policy_properties, # type: "_models.SecurityPolicyProperties" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SecurityPolicy"] - """Updates an existing Secret within a profile. + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy_update_properties: "_models.SecurityPolicyUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.SecurityPolicy"]: + """Updates an existing security policy within a profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str :param security_policy_name: Name of the security policy under the profile. :type security_policy_name: str - :param security_policy_properties: Security policy update properties. - :type security_policy_properties: ~azure.mgmt.cdn.models.SecurityPolicyProperties + :param security_policy_update_properties: Security policy update properties. + :type security_policy_update_properties: ~azure.mgmt.cdn.models.SecurityPolicyUpdateParameters :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 SecurityPolicy 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 SecurityPolicy or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.SecurityPolicy] - :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.SecurityPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -430,29 +611,22 @@ def begin_patch( resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, - security_policy_properties=security_policy_properties, + security_policy_update_properties=security_policy_update_properties, + 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('SecurityPolicy', 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -464,83 +638,76 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - profile_name, # type: str - security_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + profile_name: str, + security_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-09-01" - accept = "application/json" - - # 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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + security_policy_name=security_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 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.AfdErrorResponse, 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.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - profile_name, # type: str - security_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + profile_name: str, + security_policy_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing security policy within profile. :param resource_group_name: Name of the Resource group within the Azure subscription. :type resource_group_name: str - :param profile_name: Name of the CDN profile which is unique within the resource group. + :param profile_name: Name of the Azure Front Door Standard or Azure Front Door Premium profile + which is unique within the resource group. :type profile_name: str - :param security_policy_name: Name of the Secret under the profile. + :param security_policy_name: Name of the security policy under the profile. :type security_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', @@ -555,22 +722,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=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'profileName': self._serialize.url("profile_name", profile_name, 'str'), - 'securityPolicyName': self._serialize.url("security_policy_name", security_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - 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: @@ -582,4 +741,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.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_validate_operations.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_validate_operations.py index b3545e35607f..085a97de37cd 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_validate_operations.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_validate_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_secret_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 = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret') + 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 ValidateOperations(object): """ValidateOperations operations. @@ -44,12 +87,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def secret( self, - validate_secret_input, # type: "_models.ValidateSecretInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.ValidateSecretOutput" + validate_secret_input: "_models.ValidateSecretInput", + **kwargs: Any + ) -> "_models.ValidateSecretOutput": """Validate a Secret in the profile. :param validate_secret_input: The Secret source. @@ -64,36 +107,26 @@ def secret( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.secret.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(validate_secret_input, 'ValidateSecretInput') + + request = build_secret_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.secret.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(validate_secret_input, 'ValidateSecretInput') - 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.AfdErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ValidateSecretOutput', pipeline_response) @@ -102,4 +135,6 @@ def secret( return cls(pipeline_response, deserialized, {}) return deserialized + secret.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret'} # type: ignore +