diff --git a/sdk/cdn/azure-mgmt-cdn/CHANGELOG.md b/sdk/cdn/azure-mgmt-cdn/CHANGELOG.md index fb58dea2bdd7..a9e7905625c5 100644 --- a/sdk/cdn/azure-mgmt-cdn/CHANGELOG.md +++ b/sdk/cdn/azure-mgmt-cdn/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 12.1.0b1 (2022-10-21) + +### Breaking Changes + + - Renamed operation CustomDomainsOperations.disable_custom_https to CustomDomainsOperations.begin_disable_custom_https + - Renamed operation CustomDomainsOperations.enable_custom_https to CustomDomainsOperations.begin_enable_custom_https + ## 12.0.0 (2022-03-22) **Features** diff --git a/sdk/cdn/azure-mgmt-cdn/MANIFEST.in b/sdk/cdn/azure-mgmt-cdn/MANIFEST.in index 3ba4e86443b6..83cdb3bd0252 100644 --- a/sdk/cdn/azure-mgmt-cdn/MANIFEST.in +++ b/sdk/cdn/azure-mgmt-cdn/MANIFEST.in @@ -1,5 +1,6 @@ include _meta.json recursive-include tests *.py *.json +recursive-include samples *.py *.md include *.md include azure/__init__.py include azure/mgmt/__init__.py diff --git a/sdk/cdn/azure-mgmt-cdn/_meta.json b/sdk/cdn/azure-mgmt-cdn/_meta.json index f2096f5c31ca..6cf331662253 100644 --- a/sdk/cdn/azure-mgmt-cdn/_meta.json +++ b/sdk/cdn/azure-mgmt-cdn/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.7.2", + "commit": "e1da7cbab8d4f554484dedb676ba7bdbdf6cdf78", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.2", "use": [ - "@autorest/python@5.12.0", - "@autorest/modelerfour@4.19.3" + "@autorest/python@6.1.11", + "@autorest/modelerfour@4.24.3" ], - "commit": "f635d0ffb31308098993e02cc1ab1a83db6bb585", - "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/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/cdn/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2021-06 --use=@autorest/python@6.1.11 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "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 841aa3a2f926..f2465edeea38 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/__init__.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/__init__.py @@ -10,9 +10,15 @@ from ._version import VERSION __version__ = VERSION -__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() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["CdnManagementClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_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 edc0139f5e71..32f76bd38fbe 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 @@ -7,21 +7,48 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, 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 +from ._serialization import Deserializer, Serializer +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 import TokenCredential -class CdnManagementClient(CdnManagementClientOperationsMixin): + +class CdnManagementClient( + CdnManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Cdn Management Client. :ivar afd_profiles: AFDProfilesOperations operations @@ -68,12 +95,15 @@ class CdnManagementClient(CdnManagementClientOperationsMixin): :vartype policies: azure.mgmt.cdn.operations.PoliciesOperations :ivar managed_rule_sets: ManagedRuleSetsOperations operations :vartype managed_rule_sets: azure.mgmt.cdn.operations.ManagedRuleSetsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure Subscription ID. + :param subscription_id: Azure Subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -85,7 +115,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = CdnManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + 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)} @@ -93,14 +125,20 @@ def __init__( 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_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_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.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) @@ -113,14 +151,11 @@ def __init__( 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) - + self.managed_rule_sets = ManagedRuleSetsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request( - self, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -129,7 +164,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest 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 b4fbf8293010..5dd76fe5a2a8 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_configuration.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_configuration.py @@ -19,25 +19,25 @@ from azure.core.credentials import TokenCredential -class CdnManagementClientConfiguration(Configuration): +class CdnManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for CdnManagementClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure Subscription ID. + :param subscription_id: Azure Subscription ID. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(CdnManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop("api_version", "2021-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,24 +45,25 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - 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.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-cdn/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(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 deleted file mode 100644 index 495c497787ea..000000000000 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_metadata.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "chosen_version": "2021-06-01", - "total_api_version_list": ["2021-06-01"], - "client": { - "name": "CdnManagementClient", - "filename": "_cdn_management_client", - "description": "Cdn Management Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"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": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Azure Subscription ID.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Azure Subscription ID.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"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_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": { - "afd_profiles": "AFDProfilesOperations", - "afd_custom_domains": "AFDCustomDomainsOperations", - "afd_endpoints": "AFDEndpointsOperations", - "afd_origin_groups": "AFDOriginGroupsOperations", - "afd_origins": "AFDOriginsOperations", - "routes": "RoutesOperations", - "rule_sets": "RuleSetsOperations", - "rules": "RulesOperations", - "security_policies": "SecurityPoliciesOperations", - "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": { - "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" - }, - "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" - }, - "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" - }, - "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" - } - } - } -} \ 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 index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_patch.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_patch.py @@ -28,4 +28,4 @@ # 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 + pass diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_serialization.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_serialization.py new file mode 100644 index 000000000000..7c1dedb5133d --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_serialization.py @@ -0,0 +1,1970 @@ +# -------------------------------------------------------------------------- +# +# 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. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote # type: ignore +import xml.etree.ElementTree as ET + +import isodate + +from typing import Dict, Any, cast, TYPE_CHECKING + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +if TYPE_CHECKING: + from typing import Optional, Union, AnyStr, IO, Mapping + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data, content_type=None): + # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes, headers): + # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str # type: ignore + unicode_str = str # type: ignore + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc # type: ignore +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes=None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) + continue + if xml_desc.get("text", False): + serialized.text = new_attr + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) + else: # JSON + for k in reversed(keys): + unflattened = {k: new_attr} + new_attr = unflattened + + _new_attr = new_attr + _serialized = serialized + for k in keys: + if k not in _serialized: + _serialized.update(_new_attr) + _new_attr = _new_attr[k] + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback(SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) + return result + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes=None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) + attr = attr + padding + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_vendor.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_vendor.py index 138f663c53a4..4fbf5f4fe227 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_vendor.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import CdnManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from ._serialization import Deserializer, Serializer + + 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) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): 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 - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: CdnManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" 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 c047f879b92f..f831c169578e 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 = "12.0.0" +VERSION = "12.1.0b1" 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 682168cbad37..e4b3bc8a4346 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 @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- 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() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["CdnManagementClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_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 91402cea5f4c..fce6771322b7 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 @@ -7,21 +7,48 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models +from .._serialization import Deserializer, Serializer 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 +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 -class CdnManagementClient(CdnManagementClientOperationsMixin): + +class CdnManagementClient( + CdnManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Cdn Management Client. :ivar afd_profiles: AFDProfilesOperations operations @@ -68,12 +95,15 @@ class CdnManagementClient(CdnManagementClientOperationsMixin): :vartype policies: azure.mgmt.cdn.aio.operations.PoliciesOperations :ivar managed_rule_sets: ManagedRuleSetsOperations operations :vartype managed_rule_sets: azure.mgmt.cdn.aio.operations.ManagedRuleSetsOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure Subscription ID. + :param subscription_id: Azure Subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -85,7 +115,9 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = CdnManagementClientConfiguration(credential=credential, subscription_id=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)} @@ -93,14 +125,20 @@ def __init__( 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_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_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.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) @@ -113,14 +151,11 @@ def __init__( 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) - + self.managed_rule_sets = ManagedRuleSetsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + 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 @@ -129,7 +164,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest 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 b06ebb45dcfd..67537ccaa97f 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 @@ -19,25 +19,25 @@ from azure.core.credentials_async import AsyncTokenCredential -class CdnManagementClientConfiguration(Configuration): +class CdnManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for CdnManagementClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure Subscription ID. + :param subscription_id: Azure Subscription ID. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(CdnManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop("api_version", "2021-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,23 +45,22 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - 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.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-cdn/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(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 index 74e48ecd07cf..f99e77fef986 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_patch.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_patch.py @@ -28,4 +28,4 @@ # 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 + pass diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_vendor.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_vendor.py new file mode 100644 index 000000000000..e558875d96f7 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import CdnManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from .._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: CdnManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" 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 02659c9dab5c..558a501919e2 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 @@ -30,28 +30,34 @@ from ._policies_operations import PoliciesOperations from ._managed_rule_sets_operations import ManagedRuleSetsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'CdnManagementClientOperationsMixin', - 'AFDProfilesOperations', - 'AFDCustomDomainsOperations', - 'AFDEndpointsOperations', - 'AFDOriginGroupsOperations', - 'AFDOriginsOperations', - 'RoutesOperations', - 'RuleSetsOperations', - 'RulesOperations', - 'SecurityPoliciesOperations', - 'SecretsOperations', - 'ValidateOperations', - 'LogAnalyticsOperations', - 'ProfilesOperations', - 'EndpointsOperations', - 'OriginsOperations', - 'OriginGroupsOperations', - 'CustomDomainsOperations', - 'ResourceUsageOperations', - 'Operations', - 'EdgeNodesOperations', - 'PoliciesOperations', - 'ManagedRuleSetsOperations', + "CdnManagementClientOperationsMixin", + "AFDProfilesOperations", + "AFDCustomDomainsOperations", + "AFDEndpointsOperations", + "AFDOriginGroupsOperations", + "AFDOriginsOperations", + "RoutesOperations", + "RuleSetsOperations", + "RulesOperations", + "SecurityPoliciesOperations", + "SecretsOperations", + "ValidateOperations", + "LogAnalyticsOperations", + "ProfilesOperations", + "EndpointsOperations", + "OriginsOperations", + "OriginGroupsOperations", + "CustomDomainsOperations", + "ResourceUsageOperations", + "Operations", + "EdgeNodesOperations", + "PoliciesOperations", + "ManagedRuleSetsOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() 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 2ea47d0bcba8..935dd86559c8 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,95 +6,123 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._afd_custom_domains_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_profile_request, + build_refresh_validation_token_request, + build_update_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class AFDCustomDomainsOperations: - """AFDCustomDomainsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AFDCustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`afd_custom_domains` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.AFDDomainListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AFDDomain"]: """Lists existing AzureFrontDoor domains. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + or CDN profile which is unique within the resource group. Required. :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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.AFDDomainListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AFDDomain or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.AFDDomain] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomainListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomainListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -107,7 +136,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,53 +148,61 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains'} # type: ignore + 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: Any - ) -> "_models.AFDDomain": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. :type custom_domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AFDDomain, or the result of cls(response) + :return: AFDDomain or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.AFDDomain - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomain"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomain] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -171,69 +210,168 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore - + 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", + custom_domain: Union[_models.AFDDomain, IO], **kwargs: Any - ) -> "_models.AFDDomain": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomain"] + ) -> _models.AFDDomain: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(custom_domain, 'AFDDomain') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomain] - request = build_create_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain, (IO, bytes)): + _content = custom_domain + else: + _json = self._serialize.body(custom_domain, "AFDDomain") + + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"} # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain: _models.AFDDomain, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. + :type custom_domain_name: str + :param custom_domain: Domain properties. Required. + :type custom_domain: ~azure.mgmt.cdn.models.AFDDomain + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. + :type custom_domain_name: str + :param custom_domain: Domain properties. Required. + :type custom_domain: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -241,20 +379,24 @@ async def begin_create( resource_group_name: str, profile_name: str, custom_domain_name: str, - custom_domain: "_models.AFDDomain", + custom_domain: Union[_models.AFDDomain, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.AFDDomain"]: + ) -> AsyncLROPoller[_models.AFDDomain]: """Creates a new domain within the specified profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. :type custom_domain_name: str - :param custom_domain: Domain properties. - :type custom_domain: ~azure.mgmt.cdn.models.AFDDomain + :param custom_domain: Domain properties. Is either a model type or a IO type. Required. + :type custom_domain: ~azure.mgmt.cdn.models.AFDDomain or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -266,101 +408,208 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomain] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, custom_domain=custom_domain, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"} # type: ignore async def _update_initial( self, resource_group_name: str, profile_name: str, custom_domain_name: str, - custom_domain_update_properties: "_models.AFDDomainUpdateParameters", + custom_domain_update_properties: Union[_models.AFDDomainUpdateParameters, IO], **kwargs: Any - ) -> "_models.AFDDomain": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomain"] + ) -> _models.AFDDomain: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomain] - _json = self._serialize.body(custom_domain_update_properties, 'AFDDomainUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain_update_properties, (IO, bytes)): + _content = custom_domain_update_properties + else: + _json = self._serialize.body(custom_domain_update_properties, "AFDDomainUpdateParameters") - request = build_update_request_initial( + request = build_update_request( resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"} # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain_update_properties: _models.AFDDomainUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. + :type custom_domain_name: str + :param custom_domain_update_properties: Domain properties. Required. + :type custom_domain_update_properties: ~azure.mgmt.cdn.models.AFDDomainUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. + :type custom_domain_name: str + :param custom_domain_update_properties: Domain properties. Required. + :type custom_domain_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_update( @@ -368,20 +617,25 @@ async def begin_update( resource_group_name: str, profile_name: str, custom_domain_name: str, - custom_domain_update_properties: "_models.AFDDomainUpdateParameters", + custom_domain_update_properties: Union[_models.AFDDomainUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.AFDDomain"]: + ) -> AsyncLROPoller[_models.AFDDomain]: """Updates an existing domain within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. :type custom_domain_name: str - :param custom_domain_update_properties: Domain properties. - :type custom_domain_update_properties: ~azure.mgmt.cdn.models.AFDDomainUpdateParameters + :param custom_domain_update_properties: Domain properties. Is either a model type or a IO type. + Required. + :type custom_domain_update_properties: ~azure.mgmt.cdn.models.AFDDomainUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -393,105 +647,118 @@ async def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomain] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, custom_domain_update_properties=custom_domain_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"} # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - custom_domain_name: str, - **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: Any + self, resource_group_name: str, profile_name: str, custom_domain_name: str, **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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. :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. @@ -503,98 +770,112 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"} # type: ignore - async def _refresh_validation_token_initial( - self, - resource_group_name: str, - profile_name: str, - custom_domain_name: str, - **kwargs: Any + async def _refresh_validation_token_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_refresh_validation_token_request_initial( + request = build_refresh_validation_token_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._refresh_validation_token_initial.metadata['url'], + api_version=api_version, + template_url=self._refresh_validation_token_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _refresh_validation_token_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken'} # type: ignore - + _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: Any + self, resource_group_name: str, profile_name: str, custom_domain_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the domain validation token. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. :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. @@ -606,41 +887,49 @@ async def begin_refresh_validation_token( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._refresh_validation_token_initial( + raw_result = await self._refresh_validation_token_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 43f7e6c59532..7cd89bd04b61 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,96 +6,125 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._afd_endpoints_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_profile_request, + build_list_resource_usage_request, + build_purge_content_request, + build_update_request, + build_validate_custom_domain_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class AFDEndpointsOperations: - """AFDEndpointsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AFDEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`afd_endpoints` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.AFDEndpointListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AFDEndpoint"]: """Lists existing AzureFrontDoor endpoints. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.AFDEndpointListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AFDEndpoint or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.AFDEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpointListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpointListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -108,7 +138,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,53 +150,61 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints'} # type: ignore + 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: Any - ) -> "_models.AFDEndpoint": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AFDEndpoint, or the result of cls(response) + :return: AFDEndpoint or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.AFDEndpoint - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpoint"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpoint] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,69 +212,170 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore - + 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", + endpoint: Union[_models.AFDEndpoint, IO], **kwargs: Any - ) -> "_models.AFDEndpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpoint"] + ) -> _models.AFDEndpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpoint] - _json = self._serialize.body(endpoint, 'AFDEndpoint') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(endpoint, (IO, bytes)): + _content = endpoint + else: + _json = self._serialize.body(endpoint, "AFDEndpoint") - request = build_create_request_initial( + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: _models.AFDEndpoint, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint: Endpoint properties. Required. + :type endpoint: ~azure.mgmt.cdn.models.AFDEndpoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint: Endpoint properties. Required. + :type endpoint: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -242,21 +383,25 @@ async def begin_create( resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint: "_models.AFDEndpoint", + endpoint: Union[_models.AFDEndpoint, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.AFDEndpoint"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param endpoint: Endpoint properties. - :type endpoint: ~azure.mgmt.cdn.models.AFDEndpoint + :param endpoint: Endpoint properties. Is either a model type or a IO type. Required. + :type endpoint: ~azure.mgmt.cdn.models.AFDEndpoint or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -268,101 +413,214 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, endpoint=endpoint, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore async def _update_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint_update_properties: "_models.AFDEndpointUpdateParameters", + endpoint_update_properties: Union[_models.AFDEndpointUpdateParameters, IO], **kwargs: Any - ) -> "_models.AFDEndpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpoint"] + ) -> _models.AFDEndpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpoint] - _json = self._serialize.body(endpoint_update_properties, 'AFDEndpointUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(endpoint_update_properties, (IO, bytes)): + _content = endpoint_update_properties + else: + _json = self._serialize.body(endpoint_update_properties, "AFDEndpointUpdateParameters") - request = build_update_request_initial( + request = build_update_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: _models.AFDEndpointUpdateParameters, + *, + content_type: str = "application/json", + **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 + endpoint. To update origins, use the Update Origin operation. To update origin groups, use the + Update Origin group operation. To update domains, use the Update Custom Domain operation. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint_update_properties: Endpoint update properties. Required. + :type endpoint_update_properties: ~azure.mgmt.cdn.models.AFDEndpointUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: IO, + *, + content_type: str = "application/json", + **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 + endpoint. To update origins, use the Update Origin operation. To update origin groups, use the + Update Origin group operation. To update domains, use the Update Custom Domain operation. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint_update_properties: Endpoint update properties. Required. + :type endpoint_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_update( @@ -370,23 +628,28 @@ async def begin_update( resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint_update_properties: "_models.AFDEndpointUpdateParameters", + endpoint_update_properties: Union[_models.AFDEndpointUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.AFDEndpoint"]: + ) -> 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 endpoint. To update origins, use the Update Origin operation. To update origin groups, use the Update Origin group operation. To update domains, use the Update Custom Domain operation. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param endpoint_update_properties: Endpoint update properties. - :type endpoint_update_properties: ~azure.mgmt.cdn.models.AFDEndpointUpdateParameters + :param endpoint_update_properties: Endpoint update properties. Is either a model type or a IO + type. Required. + :type endpoint_update_properties: ~azure.mgmt.cdn.models.AFDEndpointUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -398,105 +661,118 @@ async def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, endpoint_update_properties=endpoint_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_request( 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'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: Any + self, resource_group_name: str, profile_name: str, endpoint_name: str, **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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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. @@ -508,110 +784,145 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore - async def _purge_content_initial( + async def _purge_content_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, - contents: "_models.AfdPurgeParameters", + contents: Union[_models.AfdPurgeParameters, IO], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(contents, 'AfdPurgeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_content_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contents, (IO, bytes)): + _content = contents + else: + _json = self._serialize.body(contents, "AfdPurgeParameters") + + request = build_purge_content_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._purge_content_initial.metadata['url'], + content=_content, + template_url=self._purge_content_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _purge_content_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge"} # type: ignore - @distributed_trace_async + @overload async def begin_purge_content( self, resource_group_name: str, profile_name: str, endpoint_name: str, - contents: "_models.AfdPurgeParameters", + contents: _models.AfdPurgeParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Removes a content from AzureFrontDoor. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param contents: The list of paths to the content and the list of linked domains to be purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. '/pictures/*' which removes all folders and files in the directory. + Required. :type contents: ~azure.mgmt.cdn.models.AfdPurgeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -622,99 +933,203 @@ async def begin_purge_content( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_purge_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + contents: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Removes a content from AzureFrontDoor. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param contents: The list of paths to the content and the list of linked domains to be purged. + Path can be a full URL, e.g. '/pictures/city.png' which removes a single file, or a directory + with a wildcard, e.g. '/pictures/*' which removes all folders and files in the directory. + Required. + :type contents: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ + + @distributed_trace_async + async def begin_purge_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + contents: Union[_models.AfdPurgeParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Removes a content from AzureFrontDoor. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param contents: The list of paths to the content and the list of linked domains to be purged. + Path can be a full URL, e.g. '/pictures/city.png' which removes a single file, or a directory + with a wildcard, e.g. '/pictures/*' which removes all folders and files in the directory. Is + either a model type or a IO type. Required. + :type contents: ~azure.mgmt.cdn.models.AfdPurgeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: 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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._purge_content_initial( + raw_result = await self._purge_content_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, contents=contents, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: Any - ) -> AsyncIterable["_models.UsagesListResult"]: - """Checks the quota and actual usage of endpoints under the given CDN profile. + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Usage"]: + """Checks the quota and actual usage of the given AzureFrontDoor endpoint under the given CDN + profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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 UsagesListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.UsagesListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -728,7 +1143,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -738,60 +1155,150 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - 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 + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/usages"} # type: ignore - @distributed_trace_async + @overload async def validate_custom_domain( self, resource_group_name: str, profile_name: str, endpoint_name: str, - custom_domain_properties: "_models.ValidateCustomDomainInput", + custom_domain_properties: _models.ValidateCustomDomainInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.ValidateCustomDomainOutput": - """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. + ) -> _models.ValidateCustomDomainOutput: + """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.This + api isn't work for apex domain. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_properties: Custom domain to be validated. + :param custom_domain_properties: Custom domain to be validated. Required. :type custom_domain_properties: ~azure.mgmt.cdn.models.ValidateCustomDomainInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_custom_domain( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidateCustomDomainOutput: + """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.This + api isn't work for apex domain. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_properties: Custom domain to be validated. Required. + :type custom_domain_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateCustomDomainOutput, or the result of cls(response) + :return: ValidateCustomDomainOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ValidateCustomDomainOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_custom_domain( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_properties: Union[_models.ValidateCustomDomainInput, IO], + **kwargs: Any + ) -> _models.ValidateCustomDomainOutput: + """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.This + api isn't work for apex domain. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_properties: Custom domain to be validated. Is either a model type or a IO + type. Required. + :type custom_domain_properties: ~azure.mgmt.cdn.models.ValidateCustomDomainInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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 + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateCustomDomainOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateCustomDomainOutput] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain_properties, (IO, bytes)): + _content = custom_domain_properties + else: + _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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate_custom_domain.metadata['url'], + content=_content, + template_url=self.validate_custom_domain.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -799,12 +1306,11 @@ async def validate_custom_domain( 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("ValidateCustomDomainOutput", pipeline_response) if cls: 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 - + 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 e0d3b01bd317..115348f8bd17 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,97 +6,123 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._afd_origin_groups_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_profile_request, + build_list_resource_usage_request, + build_update_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class AFDOriginGroupsOperations: - """AFDOriginGroupsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AFDOriginGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`afd_origin_groups` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.AFDOriginGroupListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AFDOriginGroup"]: """Lists all of the existing origin groups within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :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] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AFDOriginGroup or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.AFDOriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroupListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroupListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -109,7 +136,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -119,52 +148,60 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups'} # type: ignore + 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: Any - ) -> "_models.AFDOriginGroup": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AFDOriginGroup, or the result of cls(response) + :return: AFDOriginGroup or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.AFDOriginGroup - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroup"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroup] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,69 +209,168 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore - + 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", + origin_group: Union[_models.AFDOriginGroup, IO], **kwargs: Any - ) -> "_models.AFDOriginGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroup"] + ) -> _models.AFDOriginGroup: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroup] - _json = self._serialize.body(origin_group, 'AFDOriginGroup') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_group, (IO, bytes)): + _content = origin_group + else: + _json = self._serialize.body(origin_group, "AFDOriginGroup") - request = build_create_request_initial( + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}"} # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group: _models.AFDOriginGroup, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group: Origin group properties. Required. + :type origin_group: ~azure.mgmt.cdn.models.AFDOriginGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group: Origin group properties. Required. + :type origin_group: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -242,20 +378,24 @@ async def begin_create( resource_group_name: str, profile_name: str, origin_group_name: str, - origin_group: "_models.AFDOriginGroup", + origin_group: Union[_models.AFDOriginGroup, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.AFDOriginGroup"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_group_name: str - :param origin_group: Origin group properties. - :type origin_group: ~azure.mgmt.cdn.models.AFDOriginGroup + :param origin_group: Origin group properties. Is either a model type or a IO type. Required. + :type origin_group: ~azure.mgmt.cdn.models.AFDOriginGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -267,101 +407,208 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroup] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, origin_group=origin_group, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}"} # type: ignore async def _update_initial( self, resource_group_name: str, profile_name: str, origin_group_name: str, - origin_group_update_properties: "_models.AFDOriginGroupUpdateParameters", + origin_group_update_properties: Union[_models.AFDOriginGroupUpdateParameters, IO], **kwargs: Any - ) -> "_models.AFDOriginGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroup"] + ) -> _models.AFDOriginGroup: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroup] - _json = self._serialize.body(origin_group_update_properties, 'AFDOriginGroupUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_group_update_properties, (IO, bytes)): + _content = origin_group_update_properties + else: + _json = self._serialize.body(origin_group_update_properties, "AFDOriginGroupUpdateParameters") - request = build_update_request_initial( + request = build_update_request( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}"} # type: ignore + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group_update_properties: _models.AFDOriginGroupUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_group_update_properties: Origin group properties. Required. + :type origin_group_update_properties: ~azure.mgmt.cdn.models.AFDOriginGroupUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_group_update_properties: Origin group properties. Required. + :type origin_group_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_update( @@ -369,20 +616,26 @@ async def begin_update( resource_group_name: str, profile_name: str, origin_group_name: str, - origin_group_update_properties: "_models.AFDOriginGroupUpdateParameters", + origin_group_update_properties: Union[_models.AFDOriginGroupUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.AFDOriginGroup"]: + ) -> AsyncLROPoller[_models.AFDOriginGroup]: """Updates an existing origin group within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_group_name: str - :param origin_group_update_properties: Origin group properties. - :type origin_group_update_properties: ~azure.mgmt.cdn.models.AFDOriginGroupUpdateParameters + :param origin_group_update_properties: Origin group properties. Is either a model type or a IO + type. Required. + :type origin_group_update_properties: ~azure.mgmt.cdn.models.AFDOriginGroupUpdateParameters or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -394,104 +647,117 @@ async def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroup] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, origin_group_update_properties=origin_group_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}"} # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - origin_group_name: str, - **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: Any + self, resource_group_name: str, profile_name: str, origin_group_name: str, **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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :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. @@ -503,96 +769,118 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: Any - ) -> AsyncIterable["_models.UsagesListResult"]: - """Checks the quota and actual usage of endpoints under the given CDN profile. + self, resource_group_name: str, profile_name: str, origin_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Usage"]: + """Checks the quota and actual usage of the given AzureFrontDoor origin group under the given CDN + profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_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 UsagesListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.UsagesListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -606,7 +894,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -616,8 +906,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/usages'} # type: ignore + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/usages"} # type: ignore 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 13a605a92939..12df229dcfb5 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,126 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._afd_origins_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_origin_group_request, + build_update_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class AFDOriginsOperations: - """AFDOriginsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AFDOriginsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`afd_origins` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_origin_group( - self, - resource_group_name: str, - profile_name: str, - origin_group_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.AFDOriginListResult"]: + self, resource_group_name: str, profile_name: str, origin_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AFDOrigin"]: """Lists all of the existing origins within an origin group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_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 AFDOriginListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.AFDOriginListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AFDOrigin or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.AFDOrigin] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_origin_group.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -112,7 +139,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,56 +151,63 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - 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 + 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: Any - ) -> "_models.AFDOrigin": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_group_name: str - :param origin_name: Name of the origin which is unique within the profile. + :param origin_name: Name of the origin which is unique within the profile. Required. :type origin_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AFDOrigin, or the result of cls(response) + :return: AFDOrigin or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.AFDOrigin - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOrigin"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOrigin] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -179,15 +215,14 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}"} # type: ignore async def _create_initial( self, @@ -195,55 +230,161 @@ async def _create_initial( profile_name: str, origin_group_name: str, origin_name: str, - origin: "_models.AFDOrigin", + origin: Union[_models.AFDOrigin, IO], **kwargs: Any - ) -> "_models.AFDOrigin": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOrigin"] + ) -> _models.AFDOrigin: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOrigin] - _json = self._serialize.body(origin, 'AFDOrigin') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin, (IO, bytes)): + _content = origin + else: + _json = self._serialize.body(origin, "AFDOrigin") - request = build_create_request_initial( + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: 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 + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}"} # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin: _models.AFDOrigin, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_name: Name of the origin that is unique within the profile. Required. + :type origin_name: str + :param origin: Origin properties. Required. + :type origin: ~azure.mgmt.cdn.models.AFDOrigin + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOrigin] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_name: Name of the origin that is unique within the profile. Required. + :type origin_name: str + :param origin: Origin properties. Required. + :type origin: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOrigin] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -252,22 +393,26 @@ async def begin_create( profile_name: str, origin_group_name: str, origin_name: str, - origin: "_models.AFDOrigin", + origin: Union[_models.AFDOrigin, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.AFDOrigin"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_group_name: str - :param origin_name: Name of the origin that is unique within the profile. + :param origin_name: Name of the origin that is unique within the profile. Required. :type origin_name: str - :param origin: Origin properties. - :type origin: ~azure.mgmt.cdn.models.AFDOrigin + :param origin: Origin properties. Is either a model type or a IO type. Required. + :type origin: ~azure.mgmt.cdn.models.AFDOrigin or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -279,51 +424,58 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOrigin] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, origin_name=origin_name, origin=origin, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}"} # type: ignore async def _update_initial( self, @@ -331,52 +483,158 @@ async def _update_initial( profile_name: str, origin_group_name: str, origin_name: str, - origin_update_properties: "_models.AFDOriginUpdateParameters", + origin_update_properties: Union[_models.AFDOriginUpdateParameters, IO], **kwargs: Any - ) -> "_models.AFDOrigin": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOrigin"] + ) -> _models.AFDOrigin: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(origin_update_properties, 'AFDOriginUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOrigin] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_update_properties, (IO, bytes)): + _content = origin_update_properties + else: + _json = self._serialize.body(origin_update_properties, "AFDOriginUpdateParameters") + + request = build_update_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: 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 + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}"} # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin_update_properties: _models.AFDOriginUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_name: Name of the origin which is unique within the profile. Required. + :type origin_name: str + :param origin_update_properties: Origin properties. Required. + :type origin_update_properties: ~azure.mgmt.cdn.models.AFDOriginUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOrigin] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_name: Name of the origin which is unique within the profile. Required. + :type origin_name: str + :param origin_update_properties: Origin properties. Required. + :type origin_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.AFDOrigin] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_update( @@ -385,22 +643,27 @@ async def begin_update( profile_name: str, origin_group_name: str, origin_name: str, - origin_update_properties: "_models.AFDOriginUpdateParameters", + origin_update_properties: Union[_models.AFDOriginUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.AFDOrigin"]: + ) -> AsyncLROPoller[_models.AFDOrigin]: """Updates an existing origin within an origin group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_group_name: str - :param origin_name: Name of the origin which is unique within the profile. + :param origin_name: Name of the origin which is unique within the profile. Required. :type origin_name: str - :param origin_update_properties: Origin properties. - :type origin_update_properties: ~azure.mgmt.cdn.models.AFDOriginUpdateParameters + :param origin_update_properties: Origin properties. Is either a model type or a IO type. + Required. + :type origin_update_properties: ~azure.mgmt.cdn.models.AFDOriginUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -412,110 +675,121 @@ async def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOrigin] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, origin_name=origin_name, origin_update_properties=origin_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}"} # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - origin_group_name: str, - origin_name: str, - **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: Any + self, resource_group_name: str, profile_name: str, origin_group_name: str, origin_name: str, **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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_group_name: str - :param origin_name: Name of the origin which is unique within the profile. + :param origin_name: Name of the origin which is unique within the profile. Required. :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. @@ -527,42 +801,50 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, origin_name=origin_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 e347634a1873..57dd12941025 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,93 +6,117 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._afd_profiles_operations import ( + build_check_host_name_availability_request, + build_list_resource_usage_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class AFDProfilesOperations: - """AFDProfilesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AFDProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`afd_profiles` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_resource_usage( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.UsagesListResult"]: - """Checks the quota and actual usage of endpoints under the given CDN profile. + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Usage"]: + """Checks the quota and actual usage of AzureFrontDoor endpoints under the given CDN profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.UsagesListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -105,7 +130,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,56 +142,135 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages'} # type: ignore + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages"} # type: ignore + + @overload + async def check_host_name_availability( + self, + resource_group_name: str, + profile_name: str, + check_host_name_availability_input: _models.CheckHostNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Check the name availability of a host name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param check_host_name_availability_input: Custom domain to be validated. Required. + :type check_host_name_availability_input: ~azure.mgmt.cdn.models.CheckHostNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_host_name_availability( + self, + resource_group_name: str, + profile_name: str, + check_host_name_availability_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Check the name availability of a host name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param check_host_name_availability_input: Custom domain to be validated. Required. + :type check_host_name_availability_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def check_host_name_availability( self, resource_group_name: str, profile_name: str, - check_host_name_availability_input: "_models.CheckHostNameAvailabilityInput", + check_host_name_availability_input: Union[_models.CheckHostNameAvailabilityInput, IO], **kwargs: Any - ) -> "_models.CheckNameAvailabilityOutput": - """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. + ) -> _models.CheckNameAvailabilityOutput: + """Check the name availability of a host name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :type profile_name: str - :param check_host_name_availability_input: Custom domain to be validated. + :param check_host_name_availability_input: Custom domain to be validated. Is either a model + type or a IO type. Required. :type check_host_name_availability_input: ~azure.mgmt.cdn.models.CheckHostNameAvailabilityInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityOutput, or the result of cls(response) + :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityOutput] - _json = self._serialize.body(check_host_name_availability_input, 'CheckHostNameAvailabilityInput') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_host_name_availability_input, (IO, bytes)): + _content = check_host_name_availability_input + else: + _json = self._serialize.body(check_host_name_availability_input, "CheckHostNameAvailabilityInput") request = build_check_host_name_availability_request( resource_group_name=resource_group_name, profile_name=profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_host_name_availability.metadata['url'], + content=_content, + template_url=self.check_host_name_availability.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,12 +278,11 @@ async def check_host_name_availability( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityOutput', 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 - + 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 135698d3838f..3b668761818d 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,66 +6,154 @@ # 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 typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +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, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CdnManagementClientOperationsMixin: - @distributed_trace_async +class CdnManagementClientOperationsMixin(MixinABC): + @overload async def check_endpoint_name_availability( self, resource_group_name: str, - check_endpoint_name_availability_input: "_models.CheckEndpointNameAvailabilityInput", + check_endpoint_name_availability_input: _models.CheckEndpointNameAvailabilityInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CheckEndpointNameAvailabilityOutput": + ) -> _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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param check_endpoint_name_availability_input: Input to check. + :param check_endpoint_name_availability_input: Input to check. Required. :type check_endpoint_name_availability_input: ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def check_endpoint_name_availability( + self, + resource_group_name: str, + check_endpoint_name_availability_input: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param check_endpoint_name_availability_input: Input to check. Required. + :type check_endpoint_name_availability_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckEndpointNameAvailabilityOutput, or the result of cls(response) + :return: CheckEndpointNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_endpoint_name_availability( + self, + resource_group_name: str, + check_endpoint_name_availability_input: Union[_models.CheckEndpointNameAvailabilityInput, IO], + **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. Required. + :type resource_group_name: str + :param check_endpoint_name_availability_input: Input to check. Is either a model type or a IO + type. Required. + :type check_endpoint_name_availability_input: + ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(check_endpoint_name_availability_input, 'CheckEndpointNameAvailabilityInput') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckEndpointNameAvailabilityOutput] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_endpoint_name_availability_input, (IO, bytes)): + _content = check_endpoint_name_availability_input + else: + _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, + subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_endpoint_name_availability.metadata['url'], + content=_content, + template_url=self.check_endpoint_name_availability.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -72,51 +161,112 @@ async def check_endpoint_name_availability( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckEndpointNameAvailabilityOutput', pipeline_response) + 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 + check_endpoint_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability"} # type: ignore - - @distributed_trace_async + @overload async def check_name_availability( self, - check_name_availability_input: "_models.CheckNameAvailabilityInput", + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CheckNameAvailabilityOutput": + ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. - :param check_name_availability_input: Input to check. + :param check_name_availability_input: Input to check. Required. :type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, check_name_availability_input: IO, *, content_type: str = "application/json", **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. + + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], **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. + + :param check_name_availability_input: Input to check. Is either a model type or a IO type. + Required. + :type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityOutput, or the result of cls(response) + :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityOutput] - _json = self._serialize.body(check_name_availability_input, 'CheckNameAvailabilityInput') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_input, (IO, bytes)): + _content = check_name_availability_input + else: + _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") request = build_check_name_availability_request( + api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -124,52 +274,113 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/providers/Microsoft.Cdn/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {"url": "/providers/Microsoft.Cdn/checkNameAvailability"} # type: ignore - - @distributed_trace_async + @overload async def check_name_availability_with_subscription( self, - check_name_availability_input: "_models.CheckNameAvailabilityInput", + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CheckNameAvailabilityOutput": + ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. - :param check_name_availability_input: Input to check. + :param check_name_availability_input: Input to check. Required. :type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability_with_subscription( + self, check_name_availability_input: IO, *, content_type: str = "application/json", **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. + + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityOutput, or the result of cls(response) + :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability_with_subscription( + self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], **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. + + :param check_name_availability_input: Input to check. Is either a model type or a IO type. + Required. + :type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(check_name_availability_input, 'CheckNameAvailabilityInput') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityOutput] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_input, (IO, bytes)): + _content = check_name_availability_input + else: + _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") request = build_check_name_availability_with_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability_with_subscription.metadata['url'], + content=_content, + template_url=self.check_name_availability_with_subscription.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,53 +388,111 @@ async def check_name_availability_with_subscription( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability_with_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability'} # type: ignore + check_name_availability_with_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability"} # type: ignore + @overload + async def validate_probe( + self, validate_probe_input: _models.ValidateProbeInput, *, content_type: str = "application/json", **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. + + :param validate_probe_input: Input to check. Required. + :type validate_probe_input: ~azure.mgmt.cdn.models.ValidateProbeInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateProbeOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.ValidateProbeOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_probe( + self, validate_probe_input: IO, *, content_type: str = "application/json", **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. + + :param validate_probe_input: Input to check. Required. + :type validate_probe_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateProbeOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.ValidateProbeOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def validate_probe( - self, - validate_probe_input: "_models.ValidateProbeInput", - **kwargs: Any - ) -> "_models.ValidateProbeOutput": + self, validate_probe_input: Union[_models.ValidateProbeInput, IO], **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. - :param validate_probe_input: Input to check. - :type validate_probe_input: ~azure.mgmt.cdn.models.ValidateProbeInput + :param validate_probe_input: Input to check. Is either a model type or a IO type. Required. + :type validate_probe_input: ~azure.mgmt.cdn.models.ValidateProbeInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateProbeOutput, or the result of cls(response) + :return: ValidateProbeOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ValidateProbeOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateProbeOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateProbeOutput] - _json = self._serialize.body(validate_probe_input, 'ValidateProbeInput') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_probe_input, (IO, bytes)): + _content = validate_probe_input + else: + _json = self._serialize.body(validate_probe_input, "ValidateProbeInput") request = build_validate_probe_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate_probe.metadata['url'], + content=_content, + template_url=self.validate_probe.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -231,12 +500,11 @@ async def validate_probe( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ValidateProbeOutput', pipeline_response) + deserialized = self._deserialize("ValidateProbeOutput", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validate_probe.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe'} # type: ignore - + 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 111c3ffb8a46..37f32c5e91c1 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,127 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._custom_domains_operations import ( + build_create_request, + build_delete_request, + build_disable_custom_https_request, + build_enable_custom_https_request, + build_get_request, + build_list_by_endpoint_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CustomDomainsOperations: - """CustomDomainsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class CustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`custom_domains` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_endpoint( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainListResult"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CustomDomain"]: """Lists all of the existing custom domains within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.CustomDomainListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CustomDomain or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomainListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_endpoint.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -112,7 +140,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,55 +152,63 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - 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 + 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: Any - ) -> "_models.CustomDomain": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_name: Name of the custom domain within an endpoint. + :param custom_domain_name: Name of the custom domain within an endpoint. Required. :type custom_domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomain, or the result of cls(response) + :return: CustomDomain or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CustomDomain - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomain"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -178,15 +216,14 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}"} # type: ignore async def _create_initial( self, @@ -194,55 +231,161 @@ async def _create_initial( profile_name: str, endpoint_name: str, custom_domain_name: str, - custom_domain_properties: "_models.CustomDomainParameters", + custom_domain_properties: Union[_models.CustomDomainParameters, IO], **kwargs: Any - ) -> "_models.CustomDomain": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomain"] + ) -> _models.CustomDomain: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(custom_domain_properties, 'CustomDomainParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] - request = build_create_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain_properties, (IO, bytes)): + _content = custom_domain_properties + else: + _json = self._serialize.body(custom_domain_properties, "CustomDomainParameters") + + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: 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 + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}"} # type: ignore + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_properties: _models.CustomDomainParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomain]: + """Creates a new custom domain within an endpoint. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_name: Name of the custom domain within an endpoint. Required. + :type custom_domain_name: str + :param custom_domain_properties: Properties required to create a new custom domain. Required. + :type custom_domain_properties: ~azure.mgmt.cdn.models.CustomDomainParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomain]: + """Creates a new custom domain within an endpoint. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_name: Name of the custom domain within an endpoint. Required. + :type custom_domain_name: str + :param custom_domain_properties: Properties required to create a new custom domain. Required. + :type custom_domain_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -251,21 +394,27 @@ async def begin_create( profile_name: str, endpoint_name: str, custom_domain_name: str, - custom_domain_properties: "_models.CustomDomainParameters", + custom_domain_properties: Union[_models.CustomDomainParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.CustomDomain"]: + ) -> AsyncLROPoller[_models.CustomDomain]: """Creates a new custom domain within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_name: Name of the custom domain within an endpoint. + :param custom_domain_name: Name of the custom domain within an endpoint. Required. :type custom_domain_name: str - :param custom_domain_properties: Properties required to create a new custom domain. - :type custom_domain_properties: ~azure.mgmt.cdn.models.CustomDomainParameters + :param custom_domain_properties: Properties required to create a new custom domain. Is either a + model type or a IO type. Required. + :type custom_domain_properties: ~azure.mgmt.cdn.models.CustomDomainParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -277,115 +426,124 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, custom_domain_name=custom_domain_name, custom_domain_properties=custom_domain_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}"} # type: ignore async def _delete_initial( - self, - 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"]] + self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any + ) -> Optional[_models.CustomDomain]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CustomDomain]] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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) deserialized = None if response.status_code == 202: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: 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 - + _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: Any - ) -> AsyncLROPoller["_models.CustomDomain"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: """Deletes an existing custom domain within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_name: Name of the custom domain within an endpoint. + :param custom_domain_name: Name of the custom domain within an endpoint. Required. :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. @@ -398,92 +556,88 @@ async def begin_delete( :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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomain"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, custom_domain_name=custom_domain_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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: Any - ) -> Optional["_models.CustomDomain"]: - """Disable https delivery of the custom domain. + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}"} # 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 endpoint_name: Name of the endpoint under the profile which is unique globally. - :type endpoint_name: str - :param custom_domain_name: Name of the custom domain within an endpoint. - :type custom_domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomain, or the result of cls(response) - :rtype: ~azure.mgmt.cdn.models.CustomDomain or None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CustomDomain"]] + async def _disable_custom_https_initial( + self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any + ) -> _models.CustomDomain: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] - 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'], + api_version=api_version, + template_url=self._disable_custom_https_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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]: @@ -491,59 +645,127 @@ async def disable_custom_https( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("CustomDomain", pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: 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 - + _disable_custom_https_initial.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, - 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. + async def begin_disable_custom_https( + self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomain]: + """Disable https delivery of the custom domain. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_name: Name of the custom domain within an endpoint. + :param custom_domain_name: Name of the custom domain within an endpoint. Required. :type custom_domain_name: str - :param custom_domain_https_parameters: The configuration specifying how to enable HTTPS for the - custom domain - using CDN managed certificate or user's own certificate. If not specified, - enabling ssl uses CDN managed certificate by default. - :type custom_domain_https_parameters: ~azure.mgmt.cdn.models.CustomDomainHttpsParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomain, or the result of cls(response) - :rtype: ~azure.mgmt.cdn.models.CustomDomain or None - :raises: ~azure.core.exceptions.HttpResponseError + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CustomDomain"]] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._disable_custom_https_initial( # type: ignore + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_disable_custom_https.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps"} # type: ignore + + async def _enable_custom_https_initial( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_https_parameters: Optional[Union[_models.CustomDomainHttpsParameters, IO]] = None, + **kwargs: Any + ) -> _models.CustomDomain: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if custom_domain_https_parameters is not None: - _json = self._serialize.body(custom_domain_https_parameters, 'CustomDomainHttpsParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain_https_parameters, (IO, bytes)): + _content = custom_domain_https_parameters else: - _json = None + if custom_domain_https_parameters is not None: + _json = self._serialize.body(custom_domain_https_parameters, "CustomDomainHttpsParameters") + else: + _json = None request = build_enable_custom_https_request( resource_group_name=resource_group_name, @@ -551,14 +773,21 @@ async def enable_custom_https( endpoint_name=endpoint_name, custom_domain_name=custom_domain_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.enable_custom_https.metadata['url'], + content=_content, + template_url=self._enable_custom_https_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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]: @@ -566,14 +795,196 @@ async def enable_custom_https( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("CustomDomain", pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: 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 + _enable_custom_https_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps"} # type: ignore + + @overload + async def begin_enable_custom_https( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_https_parameters: Optional[_models.CustomDomainHttpsParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomain]: + """Enable https delivery of the custom domain. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_name: Name of the custom domain within an endpoint. Required. + :type custom_domain_name: str + :param custom_domain_https_parameters: The configuration specifying how to enable HTTPS for the + custom domain - using CDN managed certificate or user's own certificate. If not specified, + enabling ssl uses CDN managed certificate by default. Default value is None. + :type custom_domain_https_parameters: ~azure.mgmt.cdn.models.CustomDomainHttpsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_enable_custom_https( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_https_parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomain]: + """Enable https delivery of the custom domain. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_name: Name of the custom domain within an endpoint. Required. + :type custom_domain_name: str + :param custom_domain_https_parameters: The configuration specifying how to enable HTTPS for the + custom domain - using CDN managed certificate or user's own certificate. If not specified, + enabling ssl uses CDN managed certificate by default. Default value is None. + :type custom_domain_https_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_enable_custom_https( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_https_parameters: Optional[Union[_models.CustomDomainHttpsParameters, IO]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomDomain]: + """Enable https delivery of the custom domain. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_name: Name of the custom domain within an endpoint. Required. + :type custom_domain_name: str + :param custom_domain_https_parameters: The configuration specifying how to enable HTTPS for the + custom domain - using CDN managed certificate or user's own certificate. If not specified, + enabling ssl uses CDN managed certificate by default. Is either a model type or a IO type. + Default value is None. + :type custom_domain_https_parameters: ~azure.mgmt.cdn.models.CustomDomainHttpsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._enable_custom_https_initial( # type: ignore + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_name, + custom_domain_https_parameters=custom_domain_https_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 56ff242e7dd0..ff2db51262e4 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,81 +6,104 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class EdgeNodesOperations: - """EdgeNodesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class EdgeNodesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`edge_nodes` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.EdgenodeResult"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.EdgeNode"]: """Edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EdgenodeResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.EdgenodeResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either EdgeNode or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.EdgeNode] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgenodeResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.EdgenodeResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -93,7 +117,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,8 +129,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.Cdn/edgenodes'} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Cdn/edgenodes"} # type: ignore 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 ffc196bfb080..4202966861b1 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,94 +6,128 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._endpoints_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_profile_request, + build_list_resource_usage_request, + build_load_content_request, + build_purge_content_request, + build_start_request, + build_stop_request, + build_update_request, + build_validate_custom_domain_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class EndpointsOperations: - """EndpointsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class EndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`endpoints` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.EndpointListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Endpoint"]: """Lists existing CDN endpoints. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :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 EndpointListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.EndpointListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Endpoint or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Endpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -106,7 +141,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -116,52 +153,61 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints'} # type: ignore + 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: Any - ) -> "_models.Endpoint": + self, 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. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Endpoint, or the result of cls(response) + :return: Endpoint or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Endpoint - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -169,69 +215,170 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore - + 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", + endpoint: Union[_models.Endpoint, IO], **kwargs: Any - ) -> "_models.Endpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + ) -> _models.Endpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] - _json = self._serialize.body(endpoint, 'Endpoint') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(endpoint, (IO, bytes)): + _content = endpoint + else: + _json = self._serialize.body(endpoint, "Endpoint") - request = build_create_request_initial( + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: _models.Endpoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Endpoint]: + """Creates a new CDN 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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint: Endpoint properties. Required. + :type endpoint: ~azure.mgmt.cdn.models.Endpoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Endpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Endpoint]: + """Creates a new CDN 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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint: Endpoint properties. Required. + :type endpoint: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Endpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -239,20 +386,25 @@ async def begin_create( resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint: "_models.Endpoint", + endpoint: Union[_models.Endpoint, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.Endpoint"]: + ) -> AsyncLROPoller[_models.Endpoint]: """Creates a new CDN 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param endpoint: Endpoint properties. - :type endpoint: ~azure.mgmt.cdn.models.Endpoint + :param endpoint: Endpoint properties. Is either a model type or a IO type. Required. + :type endpoint: ~azure.mgmt.cdn.models.Endpoint or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -264,101 +416,211 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, endpoint=endpoint, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore async def _update_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint_update_properties: "_models.EndpointUpdateParameters", + endpoint_update_properties: Union[_models.EndpointUpdateParameters, IO], **kwargs: Any - ) -> "_models.Endpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + ) -> _models.Endpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] - _json = self._serialize.body(endpoint_update_properties, 'EndpointUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(endpoint_update_properties, (IO, bytes)): + _content = endpoint_update_properties + else: + _json = self._serialize.body(endpoint_update_properties, "EndpointUpdateParameters") - request = build_update_request_initial( + request = build_update_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: _models.EndpointUpdateParameters, + *, + content_type: str = "application/json", + **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. + To update origins, use the Update Origin operation. To update origin groups, use the Update + Origin group operation. To update custom domains, use the Update Custom Domain operation. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint_update_properties: Endpoint update properties. Required. + :type endpoint_update_properties: ~azure.mgmt.cdn.models.EndpointUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Endpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: IO, + *, + content_type: str = "application/json", + **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. + To update origins, use the Update Origin operation. To update origin groups, use the Update + Origin group operation. To update custom domains, use the Update Custom Domain operation. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint_update_properties: Endpoint update properties. Required. + :type endpoint_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Endpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_update( @@ -366,22 +628,28 @@ async def begin_update( resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint_update_properties: "_models.EndpointUpdateParameters", + endpoint_update_properties: Union[_models.EndpointUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.Endpoint"]: + ) -> 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. To update origins, use the Update Origin operation. To update origin groups, use the Update Origin group operation. To update custom domains, use the Update Custom Domain operation. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param endpoint_update_properties: Endpoint update properties. - :type endpoint_update_properties: ~azure.mgmt.cdn.models.EndpointUpdateParameters + :param endpoint_update_properties: Endpoint update properties. Is either a model type or a IO + type. Required. + :type endpoint_update_properties: ~azure.mgmt.cdn.models.EndpointUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -393,104 +661,115 @@ async def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, endpoint_update_properties=endpoint_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( 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'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore - + _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: Any + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing CDN 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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. @@ -502,105 +781,117 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore async def _start_initial( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> "_models.Endpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> _models.Endpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] - - request = build_start_request_initial( + request = build_start_request( 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'], + api_version=api_version, + template_url=self._start_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: 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 - + _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: Any - ) -> AsyncLROPoller["_models.Endpoint"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncLROPoller[_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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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. @@ -613,108 +904,119 @@ async def begin_start( :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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._start_initial( + raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start"} # type: ignore async def _stop_initial( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> "_models.Endpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> _models.Endpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_stop_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + + request = build_stop_request( 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'], + api_version=api_version, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: 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 - + _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: Any - ) -> AsyncLROPoller["_models.Endpoint"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.Endpoint]: """Stops an existing running CDN endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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. @@ -727,90 +1029,196 @@ async def begin_stop( :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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._stop_initial( + raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop"} # type: ignore - async def _purge_content_initial( + async def _purge_content_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, - content_file_paths: "_models.PurgeParameters", + content_file_paths: Union[_models.PurgeParameters, IO], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(content_file_paths, 'PurgeParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_purge_content_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(content_file_paths, (IO, bytes)): + _content = content_file_paths + else: + _json = self._serialize.body(content_file_paths, "PurgeParameters") + + request = build_purge_content_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._purge_content_initial.metadata['url'], + content=_content, + template_url=self._purge_content_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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, {}) - _purge_content_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'} # type: ignore + _purge_content_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge"} # type: ignore + + @overload + async def begin_purge_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: _models.PurgeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Removes a content from CDN. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param content_file_paths: The path to the content to be purged. Path can be a full URL, e.g. + '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. + '/pictures/*' which removes all folders and files in the directory. Required. + :type content_file_paths: ~azure.mgmt.cdn.models.PurgeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ + + @overload + async def begin_purge_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Removes a content from CDN. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param content_file_paths: The path to the content to be purged. Path can be a full URL, e.g. + '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. + '/pictures/*' which removes all folders and files in the directory. Required. + :type content_file_paths: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ @distributed_trace_async async def begin_purge_content( @@ -818,21 +1226,27 @@ async def begin_purge_content( resource_group_name: str, profile_name: str, endpoint_name: str, - content_file_paths: "_models.PurgeParameters", + content_file_paths: Union[_models.PurgeParameters, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Removes a content from CDN. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param content_file_paths: The path to the content to be purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. - '/pictures/*' which removes all folders and files in the directory. - :type content_file_paths: ~azure.mgmt.cdn.models.PurgeParameters + '/pictures/*' which removes all folders and files in the directory. Is either a model type or a + IO type. Required. + :type content_file_paths: ~azure.mgmt.cdn.models.PurgeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -843,90 +1257,195 @@ async def begin_purge_content( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._purge_content_initial( + raw_result = await self._purge_content_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, content_file_paths=content_file_paths, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_purge_content.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge"} # type: ignore - async def _load_content_initial( + async def _load_content_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, - content_file_paths: "_models.LoadParameters", + content_file_paths: Union[_models.LoadParameters, IO], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(content_file_paths, 'LoadParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_load_content_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(content_file_paths, (IO, bytes)): + _content = content_file_paths + else: + _json = self._serialize.body(content_file_paths, "LoadParameters") + + request = build_load_content_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._load_content_initial.metadata['url'], + content=_content, + template_url=self._load_content_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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, {}) - _load_content_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load'} # type: ignore + _load_content_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load"} # type: ignore + @overload + async def begin_load_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: _models.LoadParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Pre-loads a content to CDN. Available for Verizon Profiles. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param content_file_paths: The path to the content to be loaded. Path should be a full URL, + e.g. ‘/pictures/city.png' which loads a single file. Required. + :type content_file_paths: ~azure.mgmt.cdn.models.LoadParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ + + @overload + async def begin_load_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Pre-loads a content to CDN. Available for Verizon Profiles. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param content_file_paths: The path to the content to be loaded. Path should be a full URL, + e.g. ‘/pictures/city.png' which loads a single file. Required. + :type content_file_paths: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ @distributed_trace_async async def begin_load_content( @@ -934,20 +1453,26 @@ async def begin_load_content( resource_group_name: str, profile_name: str, endpoint_name: str, - content_file_paths: "_models.LoadParameters", + content_file_paths: Union[_models.LoadParameters, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Pre-loads a content to CDN. Available for Verizon Profiles. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param content_file_paths: The path to the content to be loaded. Path should be a full URL, - e.g. ‘/pictures/city.png' which loads a single file. - :type content_file_paths: ~azure.mgmt.cdn.models.LoadParameters + e.g. ‘/pictures/city.png' which loads a single file. Is either a model type or a IO type. + Required. + :type content_file_paths: ~azure.mgmt.cdn.models.LoadParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -958,95 +1483,190 @@ async def begin_load_content( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._load_content_initial( + raw_result = await self._load_content_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, content_file_paths=content_file_paths, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_load_content.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load"} # type: ignore - @distributed_trace_async + @overload async def validate_custom_domain( self, resource_group_name: str, profile_name: str, endpoint_name: str, - custom_domain_properties: "_models.ValidateCustomDomainInput", + custom_domain_properties: _models.ValidateCustomDomainInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.ValidateCustomDomainOutput": + ) -> _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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_properties: Custom domain to be validated. + :param custom_domain_properties: Custom domain to be validated. Required. :type custom_domain_properties: ~azure.mgmt.cdn.models.ValidateCustomDomainInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateCustomDomainOutput, or the result of cls(response) + :return: ValidateCustomDomainOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ValidateCustomDomainOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def validate_custom_domain( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_properties: Custom domain to be validated. Required. + :type custom_domain_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_custom_domain( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_properties: Union[_models.ValidateCustomDomainInput, IO], + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_properties: Custom domain to be validated. Is either a model type or a IO + type. Required. + :type custom_domain_properties: ~azure.mgmt.cdn.models.ValidateCustomDomainInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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 + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateCustomDomainOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateCustomDomainOutput] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain_properties, (IO, bytes)): + _content = custom_domain_properties + else: + _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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate_custom_domain.metadata['url'], + content=_content, + template_url=self.validate_custom_domain.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1054,67 +1674,79 @@ async def validate_custom_domain( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ValidateCustomDomainOutput', pipeline_response) + deserialized = self._deserialize("ValidateCustomDomainOutput", pipeline_response) if cls: 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 - + 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: Any - ) -> AsyncIterable["_models.ResourceUsageListResult"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ResourceUsage"]: """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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ResourceUsage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ResourceUsage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUsageListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceUsageListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1128,7 +1760,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1138,8 +1772,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage'} # type: ignore + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage"} # type: ignore 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 58e90f654a83..67c8dfcfcd9a 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,102 +7,122 @@ # 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 typing import Any, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +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, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class LogAnalyticsOperations: - """LogAnalyticsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class LogAnalyticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`log_analytics` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get_log_analytics_metrics( self, resource_group_name: str, profile_name: str, - metrics: List[Union[str, "_models.LogMetric"]], + metrics: List[Union[str, _models.LogMetric]], date_time_begin: datetime.datetime, date_time_end: datetime.datetime, - granularity: Union[str, "_models.LogMetricsGranularity"], + granularity: Union[str, _models.LogMetricsGranularity], custom_domains: List[str], protocols: List[str], - group_by: Optional[List[Union[str, "_models.LogMetricsGroupBy"]]] = None, + 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": + ) -> _models.MetricsResponse: """Get log report for AFD profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :type profile_name: str - :param metrics: + :param metrics: Required. :type metrics: list[str or ~azure.mgmt.cdn.models.LogMetric] - :param date_time_begin: + :param date_time_begin: Required. :type date_time_begin: ~datetime.datetime - :param date_time_end: + :param date_time_end: Required. :type date_time_end: ~datetime.datetime - :param granularity: + :param granularity: Known values are: "PT5M", "PT1H", and "P1D". Required. :type granularity: str or ~azure.mgmt.cdn.models.LogMetricsGranularity - :param custom_domains: + :param custom_domains: Required. :type custom_domains: list[str] - :param protocols: + :param protocols: Required. :type protocols: list[str] - :param group_by: + :param group_by: Default value is None. :type group_by: list[str or ~azure.mgmt.cdn.models.LogMetricsGroupBy] - :param continents: + :param continents: Default value is None. :type continents: list[str] - :param country_or_regions: + :param country_or_regions: Default value is None. :type country_or_regions: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: MetricsResponse, or the result of cls(response) + :return: MetricsResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.MetricsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricsResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricsResponse] - request = build_get_log_analytics_metrics_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, profile_name=profile_name, + subscription_id=self._config.subscription_id, metrics=metrics, date_time_begin=date_time_begin, date_time_end=date_time_end, @@ -111,12 +132,18 @@ async def get_log_analytics_metrics( group_by=group_by, continents=continents, country_or_regions=country_or_regions, - template_url=self.get_log_analytics_metrics.metadata['url'], + api_version=api_version, + template_url=self.get_log_analytics_metrics.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -124,76 +151,88 @@ async def get_log_analytics_metrics( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MetricsResponse', pipeline_response) + deserialized = self._deserialize("MetricsResponse", pipeline_response) if cls: 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 - + 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, profile_name: str, - rankings: List[Union[str, "_models.LogRanking"]], - metrics: List[Union[str, "_models.LogRankingMetric"]], + 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": + ) -> _models.RankingsResponse: """Get log analytics ranking report for AFD profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :type profile_name: str - :param rankings: + :param rankings: Required. :type rankings: list[str or ~azure.mgmt.cdn.models.LogRanking] - :param metrics: + :param metrics: Required. :type metrics: list[str or ~azure.mgmt.cdn.models.LogRankingMetric] - :param max_ranking: + :param max_ranking: Required. :type max_ranking: int - :param date_time_begin: + :param date_time_begin: Required. :type date_time_begin: ~datetime.datetime - :param date_time_end: + :param date_time_end: Required. :type date_time_end: ~datetime.datetime - :param custom_domains: + :param custom_domains: Default value is None. :type custom_domains: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: RankingsResponse, or the result of cls(response) + :return: RankingsResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.RankingsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RankingsResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RankingsResponse] - request = build_get_log_analytics_rankings_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, profile_name=profile_name, + subscription_id=self._config.subscription_id, 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'], + api_version=api_version, + template_url=self.get_log_analytics_rankings.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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,52 +240,61 @@ async def get_log_analytics_rankings( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('RankingsResponse', pipeline_response) + deserialized = self._deserialize("RankingsResponse", pipeline_response) if cls: 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 - + 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: Any - ) -> "_models.ContinentsResponse": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :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) + :return: ContinentsResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ContinentsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContinentsResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContinentsResponse] - 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'], + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_log_analytics_locations.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -254,52 +302,61 @@ async def get_log_analytics_locations( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ContinentsResponse', pipeline_response) + deserialized = self._deserialize("ContinentsResponse", pipeline_response) if cls: 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 - + 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: Any - ) -> "_models.ResourcesResponse": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :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) + :return: ResourcesResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ResourcesResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourcesResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourcesResponse] - 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'], + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_log_analytics_resources.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -307,67 +364,73 @@ async def get_log_analytics_resources( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourcesResponse', pipeline_response) + deserialized = self._deserialize("ResourcesResponse", pipeline_response) if cls: 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 - + 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, profile_name: str, - metrics: List[Union[str, "_models.WafMetric"]], + 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, + 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": + ) -> _models.WafMetricsResponse: """Get Waf related log analytics report for AFD profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :type profile_name: str - :param metrics: + :param metrics: Required. :type metrics: list[str or ~azure.mgmt.cdn.models.WafMetric] - :param date_time_begin: + :param date_time_begin: Required. :type date_time_begin: ~datetime.datetime - :param date_time_end: + :param date_time_end: Required. :type date_time_end: ~datetime.datetime - :param granularity: + :param granularity: Known values are: "PT5M", "PT1H", and "P1D". Required. :type granularity: str or ~azure.mgmt.cdn.models.WafGranularity - :param actions: + :param actions: Default value is None. :type actions: list[str or ~azure.mgmt.cdn.models.WafAction] - :param group_by: + :param group_by: Default value is None. :type group_by: list[str or ~azure.mgmt.cdn.models.WafRankingGroupBy] - :param rule_types: + :param rule_types: Default value is None. :type rule_types: list[str or ~azure.mgmt.cdn.models.WafRuleType] :keyword callable cls: A custom type or function that will be passed the direct response - :return: WafMetricsResponse, or the result of cls(response) + :return: WafMetricsResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.WafMetricsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WafMetricsResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.WafMetricsResponse] - request = build_get_waf_log_analytics_metrics_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, profile_name=profile_name, + subscription_id=self._config.subscription_id, metrics=metrics, date_time_begin=date_time_begin, date_time_end=date_time_end, @@ -375,12 +438,18 @@ async def get_waf_log_analytics_metrics( actions=actions, group_by=group_by, rule_types=rule_types, - template_url=self.get_waf_log_analytics_metrics.metadata['url'], + api_version=api_version, + template_url=self.get_waf_log_analytics_metrics.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -388,67 +457,73 @@ async def get_waf_log_analytics_metrics( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('WafMetricsResponse', pipeline_response) + deserialized = self._deserialize("WafMetricsResponse", pipeline_response) if cls: 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 - + 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, profile_name: str, - metrics: List[Union[str, "_models.WafMetric"]], + 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, + 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": + ) -> _models.WafRankingsResponse: """Get WAF log analytics charts for AFD profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :type profile_name: str - :param metrics: + :param metrics: Required. :type metrics: list[str or ~azure.mgmt.cdn.models.WafMetric] - :param date_time_begin: + :param date_time_begin: Required. :type date_time_begin: ~datetime.datetime - :param date_time_end: + :param date_time_end: Required. :type date_time_end: ~datetime.datetime - :param max_ranking: + :param max_ranking: Required. :type max_ranking: int - :param rankings: + :param rankings: Required. :type rankings: list[str or ~azure.mgmt.cdn.models.WafRankingType] - :param actions: + :param actions: Default value is None. :type actions: list[str or ~azure.mgmt.cdn.models.WafAction] - :param rule_types: + :param rule_types: Default value is None. :type rule_types: list[str or ~azure.mgmt.cdn.models.WafRuleType] :keyword callable cls: A custom type or function that will be passed the direct response - :return: WafRankingsResponse, or the result of cls(response) + :return: WafRankingsResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.WafRankingsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WafRankingsResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.WafRankingsResponse] - request = build_get_waf_log_analytics_rankings_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, profile_name=profile_name, + subscription_id=self._config.subscription_id, metrics=metrics, date_time_begin=date_time_begin, date_time_end=date_time_end, @@ -456,12 +531,18 @@ async def get_waf_log_analytics_rankings( rankings=rankings, actions=actions, rule_types=rule_types, - template_url=self.get_waf_log_analytics_rankings.metadata['url'], + api_version=api_version, + template_url=self.get_waf_log_analytics_rankings.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -469,12 +550,11 @@ async def get_waf_log_analytics_rankings( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('WafRankingsResponse', pipeline_response) + deserialized = self._deserialize("WafRankingsResponse", pipeline_response) if cls: 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 - + 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 e8c78d01cae7..8a22a7dfda9f 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,84 +6,106 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ManagedRuleSetsOperations: - """ManagedRuleSetsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedRuleSetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`managed_rule_sets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ManagedRuleSetDefinitionList"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedRuleSetDefinition"]: """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 + :return: An iterator like instance of either ManagedRuleSetDefinition or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ManagedRuleSetDefinitionList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ManagedRuleSetDefinition] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedRuleSetDefinitionList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedRuleSetDefinitionList] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -96,7 +119,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,8 +131,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - 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 41d99b3e97e5..e81f264fc127 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,81 +6,103 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class Operations: - """Operations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.OperationsListResult"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.OperationsListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationsListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -93,7 +116,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,8 +128,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.Cdn/operations'} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Cdn/operations"} # type: ignore 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 f7863319e416..c1a48eaa9f05 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,126 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._origin_groups_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_endpoint_request, + build_update_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class OriginGroupsOperations: - """OriginGroupsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OriginGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`origin_groups` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_endpoint( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.OriginGroupListResult"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OriginGroup"]: """Lists all of the existing origin groups within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.OriginGroupListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either OriginGroup or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.OriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroupListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroupListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_endpoint.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -112,7 +139,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,55 +151,64 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - 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 + 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: Any - ) -> "_models.OriginGroup": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OriginGroup, or the result of cls(response) + :return: OriginGroup or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.OriginGroup - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroup"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroup] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -178,15 +216,14 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}"} # type: ignore async def _create_initial( self, @@ -194,55 +231,163 @@ async def _create_initial( profile_name: str, endpoint_name: str, origin_group_name: str, - origin_group: "_models.OriginGroup", + origin_group: Union[_models.OriginGroup, IO], **kwargs: Any - ) -> "_models.OriginGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroup"] + ) -> _models.OriginGroup: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroup] - _json = self._serialize.body(origin_group, 'OriginGroup') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_group, (IO, bytes)): + _content = origin_group + else: + _json = self._serialize.body(origin_group, "OriginGroup") - request = build_create_request_initial( + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: 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 + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}"} # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group: _models.OriginGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OriginGroup]: + """Creates a new origin group within the specified endpoint. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group: Origin group properties. Required. + :type origin_group: ~azure.mgmt.cdn.models.OriginGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.OriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OriginGroup]: + """Creates a new origin group within the specified endpoint. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group: Origin group properties. Required. + :type origin_group: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.OriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -251,21 +396,27 @@ async def begin_create( profile_name: str, endpoint_name: str, origin_group_name: str, - origin_group: "_models.OriginGroup", + origin_group: Union[_models.OriginGroup, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.OriginGroup"]: + ) -> AsyncLROPoller[_models.OriginGroup]: """Creates a new origin group within the specified endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_group_name: str - :param origin_group: Origin group properties. - :type origin_group: ~azure.mgmt.cdn.models.OriginGroup + :param origin_group: Origin group properties. Is either a model type or a IO type. Required. + :type origin_group: ~azure.mgmt.cdn.models.OriginGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -277,51 +428,55 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroup] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_group_name=origin_group_name, origin_group=origin_group, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}"} # type: ignore async def _update_initial( self, @@ -329,52 +484,160 @@ async def _update_initial( profile_name: str, endpoint_name: str, origin_group_name: str, - origin_group_update_properties: "_models.OriginGroupUpdateParameters", + origin_group_update_properties: Union[_models.OriginGroupUpdateParameters, IO], **kwargs: Any - ) -> "_models.OriginGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroup"] + ) -> _models.OriginGroup: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(origin_group_update_properties, 'OriginGroupUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroup] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_group_update_properties, (IO, bytes)): + _content = origin_group_update_properties + else: + _json = self._serialize.body(origin_group_update_properties, "OriginGroupUpdateParameters") + + request = build_update_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: 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 + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}"} # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group_update_properties: _models.OriginGroupUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OriginGroup]: + """Updates an existing origin group within an endpoint. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group_update_properties: Origin group properties. Required. + :type origin_group_update_properties: ~azure.mgmt.cdn.models.OriginGroupUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.OriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group_update_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OriginGroup]: + """Updates an existing origin group within an endpoint. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group_update_properties: Origin group properties. Required. + :type origin_group_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.OriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_update( @@ -383,21 +646,28 @@ async def begin_update( profile_name: str, endpoint_name: str, origin_group_name: str, - origin_group_update_properties: "_models.OriginGroupUpdateParameters", + origin_group_update_properties: Union[_models.OriginGroupUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.OriginGroup"]: + ) -> AsyncLROPoller[_models.OriginGroup]: """Updates an existing origin group within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_group_name: str - :param origin_group_update_properties: Origin group properties. - :type origin_group_update_properties: ~azure.mgmt.cdn.models.OriginGroupUpdateParameters + :param origin_group_update_properties: Origin group properties. Is either a model type or a IO + type. Required. + :type origin_group_update_properties: ~azure.mgmt.cdn.models.OriginGroupUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -409,109 +679,119 @@ async def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroup] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_group_name=origin_group_name, origin_group_update_properties=origin_group_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}"} # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - origin_group_name: str, - **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - - request = build_delete_request_initial( + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore - + _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: Any + self, resource_group_name: str, profile_name: str, endpoint_name: str, origin_group_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing origin group within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :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. @@ -523,42 +803,47 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_group_name=origin_group_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 e128b86100f5..aeedeae73402 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,99 +6,126 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._origins_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_endpoint_request, + build_update_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class OriginsOperations: - """OriginsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OriginsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`origins` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_endpoint( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.OriginListResult"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Origin"]: """Lists all of the existing origins within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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 OriginListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.OriginListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Origin or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Origin] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_endpoint.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -111,7 +139,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -121,55 +151,63 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - 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 + 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: Any - ) -> "_models.Origin": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param origin_name: Name of the origin which is unique within the endpoint. + :param origin_name: Name of the origin which is unique within the endpoint. Required. :type origin_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Origin, or the result of cls(response) + :return: Origin or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Origin - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Origin"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Origin] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,15 +215,14 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}"} # type: ignore async def _create_initial( self, @@ -193,55 +230,161 @@ async def _create_initial( profile_name: str, endpoint_name: str, origin_name: str, - origin: "_models.Origin", + origin: Union[_models.Origin, IO], **kwargs: Any - ) -> "_models.Origin": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Origin"] + ) -> _models.Origin: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Origin] - _json = self._serialize.body(origin, 'Origin') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin, (IO, bytes)): + _content = origin + else: + _json = self._serialize.body(origin, "Origin") - request = build_create_request_initial( + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if cls: 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 + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}"} # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin: _models.Origin, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Origin]: + """Creates a new origin within the specified endpoint. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_name: Name of the origin that is unique within the endpoint. Required. + :type origin_name: str + :param origin: Origin properties. Required. + :type origin: ~azure.mgmt.cdn.models.Origin + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Origin] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Origin]: + """Creates a new origin within the specified endpoint. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_name: Name of the origin that is unique within the endpoint. Required. + :type origin_name: str + :param origin: Origin properties. Required. + :type origin: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Origin] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -250,21 +393,26 @@ async def begin_create( profile_name: str, endpoint_name: str, origin_name: str, - origin: "_models.Origin", + origin: Union[_models.Origin, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.Origin"]: + ) -> AsyncLROPoller[_models.Origin]: """Creates a new origin within the specified endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param origin_name: Name of the origin that is unique within the endpoint. + :param origin_name: Name of the origin that is unique within the endpoint. Required. :type origin_name: str - :param origin: Origin properties. - :type origin: ~azure.mgmt.cdn.models.Origin + :param origin: Origin properties. Is either a model type or a IO type. Required. + :type origin: ~azure.mgmt.cdn.models.Origin or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -276,51 +424,55 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Origin] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_name=origin_name, origin=origin, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}"} # type: ignore async def _update_initial( self, @@ -328,52 +480,158 @@ async def _update_initial( profile_name: str, endpoint_name: str, origin_name: str, - origin_update_properties: "_models.OriginUpdateParameters", + origin_update_properties: Union[_models.OriginUpdateParameters, IO], **kwargs: Any - ) -> "_models.Origin": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Origin"] + ) -> _models.Origin: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(origin_update_properties, 'OriginUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Origin] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_update_properties, (IO, bytes)): + _content = origin_update_properties + else: + _json = self._serialize.body(origin_update_properties, "OriginUpdateParameters") + + request = build_update_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if cls: 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 + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}"} # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin_update_properties: _models.OriginUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Origin]: + """Updates an existing origin within an endpoint. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_name: Name of the origin which is unique within the endpoint. Required. + :type origin_name: str + :param origin_update_properties: Origin properties. Required. + :type origin_update_properties: ~azure.mgmt.cdn.models.OriginUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Origin] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin_update_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Origin]: + """Updates an existing origin within an endpoint. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_name: Name of the origin which is unique within the endpoint. Required. + :type origin_name: str + :param origin_update_properties: Origin properties. Required. + :type origin_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Origin] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_update( @@ -382,21 +640,27 @@ async def begin_update( profile_name: str, endpoint_name: str, origin_name: str, - origin_update_properties: "_models.OriginUpdateParameters", + origin_update_properties: Union[_models.OriginUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.Origin"]: + ) -> AsyncLROPoller[_models.Origin]: """Updates an existing origin within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param origin_name: Name of the origin which is unique within the endpoint. + :param origin_name: Name of the origin which is unique within the endpoint. Required. :type origin_name: str - :param origin_update_properties: Origin properties. - :type origin_update_properties: ~azure.mgmt.cdn.models.OriginUpdateParameters + :param origin_update_properties: Origin properties. Is either a model type or a IO type. + Required. + :type origin_update_properties: ~azure.mgmt.cdn.models.OriginUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -408,109 +672,118 @@ async def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Origin] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_name=origin_name, origin_update_properties=origin_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}"} # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - origin_name: str, - **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore - + _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: Any + self, resource_group_name: str, profile_name: str, endpoint_name: str, origin_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing origin within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param origin_name: Name of the origin which is unique within the endpoint. + :param origin_name: Name of the origin which is unique within the endpoint. Required. :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. @@ -522,42 +795,47 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_name=origin_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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/_patch.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 73e268ced93d..bb1707a8a4d5 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,91 +6,118 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._policies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class PoliciesOperations: - """PoliciesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`policies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.CdnWebApplicationFirewallPolicyList"]: + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.CdnWebApplicationFirewallPolicy"]: """Lists all of the protection policies within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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) + :return: An iterator like instance of either CdnWebApplicationFirewallPolicy or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicyList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicyList] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -103,7 +131,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,47 +143,55 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - 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: Any - ) -> "_models.CdnWebApplicationFirewallPolicy": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CdnWebApplicationFirewallPolicy, or the result of cls(response) + :return: CdnWebApplicationFirewallPolicy or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicy] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,85 +199,181 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: 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", + cdn_web_application_firewall_policy: Union[_models.CdnWebApplicationFirewallPolicy, IO], **kwargs: Any - ) -> "_models.CdnWebApplicationFirewallPolicy": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicy"] + ) -> _models.CdnWebApplicationFirewallPolicy: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(cdn_web_application_firewall_policy, 'CdnWebApplicationFirewallPolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicy] - request = build_create_or_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cdn_web_application_firewall_policy, (IO, bytes)): + _content = cdn_web_application_firewall_policy + else: + _json = self._serialize.body(cdn_web_application_firewall_policy, "CdnWebApplicationFirewallPolicy") + + request = build_create_or_update_request( resource_group_name=resource_group_name, policy_name=policy_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: 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 + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy: _models.CdnWebApplicationFirewallPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_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. Required. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. + :type policy_name: str + :param cdn_web_application_firewall_policy: Policy to be created. Required. + :type cdn_web_application_firewall_policy: + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_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. Required. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. + :type policy_name: str + :param cdn_web_application_firewall_policy: Policy to be created. Required. + :type cdn_web_application_firewall_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, policy_name: str, - cdn_web_application_firewall_policy: "_models.CdnWebApplicationFirewallPolicy", + cdn_web_application_firewall_policy: Union[_models.CdnWebApplicationFirewallPolicy, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.CdnWebApplicationFirewallPolicy"]: + ) -> AsyncLROPoller[_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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. :type policy_name: str - :param cdn_web_application_firewall_policy: Policy to be created. + :param cdn_web_application_firewall_policy: Policy to be created. Is either a model type or a + IO type. Required. :type cdn_web_application_firewall_policy: - ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -252,118 +386,228 @@ async def begin_create_or_update( the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicy] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy=cdn_web_application_firewall_policy, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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", + cdn_web_application_firewall_policy_patch_parameters: Union[ + _models.CdnWebApplicationFirewallPolicyPatchParameters, IO + ], **kwargs: Any - ) -> "_models.CdnWebApplicationFirewallPolicy": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicy"] + ) -> _models.CdnWebApplicationFirewallPolicy: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(cdn_web_application_firewall_policy_patch_parameters, 'CdnWebApplicationFirewallPolicyPatchParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicy] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cdn_web_application_firewall_policy_patch_parameters, (IO, bytes)): + _content = cdn_web_application_firewall_policy_patch_parameters + else: + _json = self._serialize.body( + cdn_web_application_firewall_policy_patch_parameters, "CdnWebApplicationFirewallPolicyPatchParameters" + ) + + request = build_update_request( resource_group_name=resource_group_name, policy_name=policy_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: 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 + + @overload + async def begin_update( + self, + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy_patch_parameters: _models.CdnWebApplicationFirewallPolicyPatchParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CdnWebApplicationFirewallPolicy]: + """Update an existing CdnWebApplicationFirewallPolicy with the specified policy name under the + specified subscription and resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. + :type policy_name: str + :param cdn_web_application_firewall_policy_patch_parameters: CdnWebApplicationFirewallPolicy + parameters to be patched. Required. + :type cdn_web_application_firewall_policy_patch_parameters: + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy_patch_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CdnWebApplicationFirewallPolicy]: + """Update an existing CdnWebApplicationFirewallPolicy with the specified policy name under the + specified subscription and resource group. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. + :type policy_name: str + :param cdn_web_application_firewall_policy_patch_parameters: CdnWebApplicationFirewallPolicy + parameters to be patched. Required. + :type cdn_web_application_firewall_policy_patch_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ @distributed_trace_async async def begin_update( self, resource_group_name: str, policy_name: str, - cdn_web_application_firewall_policy_patch_parameters: "_models.CdnWebApplicationFirewallPolicyPatchParameters", + cdn_web_application_firewall_policy_patch_parameters: Union[ + _models.CdnWebApplicationFirewallPolicyPatchParameters, IO + ], **kwargs: Any - ) -> AsyncLROPoller["_models.CdnWebApplicationFirewallPolicy"]: + ) -> AsyncLROPoller[_models.CdnWebApplicationFirewallPolicy]: """Update an existing CdnWebApplicationFirewallPolicy with the specified policy name under the specified subscription and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. :type policy_name: str :param cdn_web_application_firewall_policy_patch_parameters: CdnWebApplicationFirewallPolicy - parameters to be patched. + parameters to be patched. Is either a model type or a IO type. Required. :type cdn_web_application_firewall_policy_patch_parameters: - ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -376,85 +620,99 @@ async def begin_update( the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicy] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy_patch_parameters=cdn_web_application_firewall_policy_patch_parameters, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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: Any + async def delete( # pylint: disable=inconsistent-return-statements + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - 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'], + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -465,5 +723,4 @@ async def delete( 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 cfe604df6ed0..d4ca450cbe5e 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,85 +6,118 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._profiles_operations import ( + build_create_request, + build_delete_request, + 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, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProfilesOperations: - """ProfilesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`profiles` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ProfileListResult"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Profile"]: """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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ProfileListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Profile or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProfileListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProfileListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -97,7 +131,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,53 +143,65 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles'} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ProfileListResult"]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Profile"]: """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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProfileListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ProfileListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Profile or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProfileListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProfileListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -167,7 +215,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,49 +227,55 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles'} # type: ignore + 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: Any - ) -> "_models.Profile": + async def get(self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :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) + :return: Profile or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Profile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Profile] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -227,86 +283,106 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore - + 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: Any - ) -> "_models.Profile": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] + self, resource_group_name: str, profile_name: str, profile: Union[_models.Profile, IO], **kwargs: Any + ) -> _models.Profile: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(profile, 'Profile') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Profile] - request = build_create_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(profile, (IO, bytes)): + _content = profile + else: + _json = self._serialize.body(profile, "Profile") + + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore - + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore - @distributed_trace_async + @overload async def begin_create( self, resource_group_name: str, profile_name: str, - profile: "_models.Profile", + profile: _models.Profile, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.Profile"]: + ) -> AsyncLROPoller[_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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :type profile_name: str - :param profile: Profile properties needed to create a new profile. + :param profile: Profile properties needed to create a new profile. Required. :type profile: ~azure.mgmt.cdn.models.Profile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -318,117 +394,216 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + profile: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_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. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param profile: Profile properties needed to create a new profile. Required. + :type profile: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, resource_group_name: str, profile_name: str, profile: Union[_models.Profile, IO], **kwargs: Any + ) -> AsyncLROPoller[_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. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param profile: Profile properties needed to create a new profile. Is either a model type or a + IO type. Required. + :type profile: ~azure.mgmt.cdn.models.Profile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Profile] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, profile=profile, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore async def _update_initial( self, resource_group_name: str, profile_name: str, - profile_update_parameters: "_models.ProfileUpdateParameters", + profile_update_parameters: Union[_models.ProfileUpdateParameters, IO], **kwargs: Any - ) -> "_models.Profile": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] + ) -> _models.Profile: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(profile_update_parameters, 'ProfileUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Profile] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(profile_update_parameters, (IO, bytes)): + _content = profile_update_parameters + else: + _json = self._serialize.body(profile_update_parameters, "ProfileUpdateParameters") + + request = build_update_request( resource_group_name=resource_group_name, profile_name=profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore - + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore - @distributed_trace_async + @overload async def begin_update( self, resource_group_name: str, profile_name: str, - profile_update_parameters: "_models.ProfileUpdateParameters", + profile_update_parameters: _models.ProfileUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller["_models.Profile"]: + ) -> AsyncLROPoller[_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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :type profile_name: str :param profile_update_parameters: Profile properties needed to update an existing profile. + Required. :type profile_update_parameters: ~azure.mgmt.cdn.models.ProfileUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -440,100 +615,183 @@ async def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + profile_update_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_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. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param profile_update_parameters: Profile properties needed to update an existing profile. + Required. + :type profile_update_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + profile_update_parameters: Union[_models.ProfileUpdateParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_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. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param profile_update_parameters: Profile properties needed to update an existing profile. Is + either a model type or a IO type. Required. + :type profile_update_parameters: ~azure.mgmt.cdn.models.ProfileUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Profile] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, profile_update_parameters=profile_update_parameters, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( resource_group_name=resource_group_name, profile_name=profile_name, subscription_id=self._config.subscription_id, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore - + _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: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> AsyncLROPoller[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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :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. @@ -545,83 +803,97 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: Any - ) -> "_models.SsoUri": + async def generate_sso_uri(self, 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 real-time stats and alerts in a premium profile. The SSO URI changes approximately every 10 minutes. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SsoUri, or the result of cls(response) + :return: SsoUri or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.SsoUri - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SsoUri"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SsoUri] - 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'], + api_version=api_version, + template_url=self.generate_sso_uri.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -629,53 +901,62 @@ async def generate_sso_uri( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SsoUri', pipeline_response) + deserialized = self._deserialize("SsoUri", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - generate_sso_uri.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri'} # type: ignore - + 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: Any - ) -> "_models.SupportedOptimizationTypesListResult": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :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) + :return: SupportedOptimizationTypesListResult or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.SupportedOptimizationTypesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedOptimizationTypesListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SupportedOptimizationTypesListResult] - 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'], + api_version=api_version, + template_url=self.list_supported_optimization_types.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -683,64 +964,76 @@ async def list_supported_optimization_types( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SupportedOptimizationTypesListResult', pipeline_response) + deserialized = self._deserialize("SupportedOptimizationTypesListResult", pipeline_response) if cls: 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 - + 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: Any - ) -> AsyncIterable["_models.ResourceUsageListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ResourceUsage"]: """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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ResourceUsage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ResourceUsage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUsageListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceUsageListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -754,7 +1047,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -764,8 +1059,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage'} # type: ignore + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage"} # type: ignore 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 dcf2f6ce22ff..2efe56aedf9f 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,83 +6,104 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ResourceUsageOperations: - """ResourceUsageOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResourceUsageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`resource_usage` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ResourceUsageListResult"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceUsage"]: """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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ResourceUsage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.ResourceUsage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUsageListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceUsageListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -95,7 +117,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,8 +129,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage'} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage"} # type: ignore 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 51b0e10500ee..bef111d0fa4c 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,126 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._routes_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_endpoint_request, + build_update_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class RoutesOperations: - """RoutesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RoutesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`routes` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_endpoint( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.RouteListResult"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Route"]: """Lists all of the existing origins within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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 RouteListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.RouteListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Route or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RouteListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_endpoint.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -112,7 +139,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,57 +151,64 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - 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 + 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: Any - ) -> "_models.Route": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param route_name: Name of the routing rule. + :param route_name: Name of the routing rule. Required. :type route_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Route, or the result of cls(response) + :return: Route or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Route - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Route"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Route] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -180,15 +216,14 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}"} # type: ignore async def _create_initial( self, @@ -196,55 +231,161 @@ async def _create_initial( profile_name: str, endpoint_name: str, route_name: str, - route: "_models.Route", + route: Union[_models.Route, IO], **kwargs: Any - ) -> "_models.Route": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Route"] + ) -> _models.Route: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Route] - _json = self._serialize.body(route, 'Route') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route, (IO, bytes)): + _content = route + else: + _json = self._serialize.body(route, "Route") - request = build_create_request_initial( + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if cls: 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 + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}"} # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route: _models.Route, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param route_name: Name of the routing rule. Required. + :type route_name: str + :param route: Route properties. Required. + :type route: ~azure.mgmt.cdn.models.Route + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Route or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param route_name: Name of the routing rule. Required. + :type route_name: str + :param route: Route properties. Required. + :type route: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Route or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -253,23 +394,27 @@ async def begin_create( profile_name: str, endpoint_name: str, route_name: str, - route: "_models.Route", + route: Union[_models.Route, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.Route"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param route_name: Name of the routing rule. + :param route_name: Name of the routing rule. Required. :type route_name: str - :param route: Route properties. - :type route: ~azure.mgmt.cdn.models.Route + :param route: Route properties. Is either a model type or a IO type. Required. + :type route: ~azure.mgmt.cdn.models.Route or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -280,51 +425,58 @@ async def begin_create( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Route] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, route_name=route_name, route=route, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}"} # type: ignore async def _update_initial( self, @@ -332,52 +484,158 @@ async def _update_initial( profile_name: str, endpoint_name: str, route_name: str, - route_update_properties: "_models.RouteUpdateParameters", + route_update_properties: Union[_models.RouteUpdateParameters, IO], **kwargs: Any - ) -> "_models.Route": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Route"] + ) -> _models.Route: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(route_update_properties, 'RouteUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Route] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_update_properties, (IO, bytes)): + _content = route_update_properties + else: + _json = self._serialize.body(route_update_properties, "RouteUpdateParameters") + + request = build_update_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if cls: 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 + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}"} # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route_update_properties: _models.RouteUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param route_name: Name of the routing rule. Required. + :type route_name: str + :param route_update_properties: Route update properties. Required. + :type route_update_properties: ~azure.mgmt.cdn.models.RouteUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Route or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param route_name: Name of the routing rule. Required. + :type route_name: str + :param route_update_properties: Route update properties. Required. + :type route_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Route or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_update( @@ -386,23 +644,28 @@ async def begin_update( profile_name: str, endpoint_name: str, route_name: str, - route_update_properties: "_models.RouteUpdateParameters", + route_update_properties: Union[_models.RouteUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.Route"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param route_name: Name of the routing rule. + :param route_name: Name of the routing rule. Required. :type route_name: str - :param route_update_properties: Route update properties. - :type route_update_properties: ~azure.mgmt.cdn.models.RouteUpdateParameters + :param route_update_properties: Route update properties. Is either a model type or a IO type. + Required. + :type route_update_properties: ~azure.mgmt.cdn.models.RouteUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -413,111 +676,122 @@ async def begin_update( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Route] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, route_name=route_name, route_update_properties=route_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}"} # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - route_name: str, - **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: Any + self, resource_group_name: str, profile_name: str, endpoint_name: str, route_name: str, **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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param route_name: Name of the routing rule. + :param route_name: Name of the routing rule. Required. :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. @@ -529,42 +803,50 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, route_name=route_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 a77865353740..27de2ab036d3 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,95 +6,122 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._rule_sets_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_profile_request, + build_list_resource_usage_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class RuleSetsOperations: - """RuleSetsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RuleSetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`rule_sets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.RuleSetListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> AsyncIterable["_models.RuleSet"]: """Lists existing AzureFrontDoor rule sets within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.RuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RuleSet or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.RuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleSetListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleSetListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -107,7 +135,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,53 +147,61 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets'} # type: ignore + 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: Any - ) -> "_models.RuleSet": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. + Required. :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) + :return: RuleSet or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.RuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleSet"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleSet] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -171,56 +209,65 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('RuleSet', pipeline_response) + deserialized = self._deserialize("RuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}"} # type: ignore @distributed_trace_async async def create( - self, - resource_group_name: str, - profile_name: str, - rule_set_name: str, - **kwargs: Any - ) -> "_models.RuleSet": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. + Required. :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) + :return: RuleSet or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.RuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleSet"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleSet] - 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'], + api_version=api_version, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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]: @@ -229,73 +276,78 @@ async def create( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('RuleSet', pipeline_response) + deserialized = self._deserialize("RuleSet", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('RuleSet', pipeline_response) + deserialized = self._deserialize("RuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore - + 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: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - - request = build_delete_request_initial( + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: Any + self, resource_group_name: str, profile_name: str, rule_set_name: str, **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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. + Required. :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. @@ -307,96 +359,118 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: 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. + self, resource_group_name: str, profile_name: str, rule_set_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Usage"]: + """Checks the quota and actual usage of the given AzureFrontDoor rule set under the given CDN + profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. + Required. :type rule_set_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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.UsagesListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -410,7 +484,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -420,8 +496,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/usages'} # type: ignore + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/usages"} # type: ignore 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 b89b96e70296..b8d3c93f7a09 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,100 +6,125 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._rules_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_rule_set_request, + build_update_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class RulesOperations: - """RulesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class RulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_rule_set( - self, - resource_group_name: str, - profile_name: str, - rule_set_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.RuleListResult"]: + self, resource_group_name: str, profile_name: str, rule_set_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Rule"]: """Lists all of the existing delivery rules within a rule set. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param rule_set_name: Name of the rule set under the profile. + :param rule_set_name: Name of the rule set under the profile. Required. :type rule_set_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_rule_set.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -112,7 +138,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,56 +150,62 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - 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 + 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: Any - ) -> "_models.Rule": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param rule_set_name: Name of the rule set under the profile. + :param rule_set_name: Name of the rule set under the profile. Required. :type rule_set_name: str - :param rule_name: Name of the delivery rule which is unique within the endpoint. + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Rule] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -179,15 +213,14 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}"} # type: ignore async def _create_initial( self, @@ -195,55 +228,157 @@ async def _create_initial( profile_name: str, rule_set_name: str, rule_name: str, - rule: "_models.Rule", + rule: Union[_models.Rule, IO], **kwargs: Any - ) -> "_models.Rule": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + ) -> _models.Rule: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Rule] - _json = self._serialize.body(rule, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rule, (IO, bytes)): + _content = rule + else: + _json = self._serialize.body(rule, "Rule") - request = build_create_request_initial( + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", 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}/rules/{ruleName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}"} # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule: _models.Rule, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param rule_set_name: Name of the rule set under the profile. Required. + :type rule_set_name: str + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. + :type rule_name: str + :param rule: The delivery rule properties. Required. + :type rule: ~azure.mgmt.cdn.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Rule or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param rule_set_name: Name of the rule set under the profile. Required. + :type rule_set_name: str + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. + :type rule_name: str + :param rule: The delivery rule properties. Required. + :type rule: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Rule or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -252,22 +387,25 @@ async def begin_create( profile_name: str, rule_set_name: str, rule_name: str, - rule: "_models.Rule", + rule: Union[_models.Rule, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.Rule"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param rule_set_name: Name of the rule set under the profile. + :param rule_set_name: Name of the rule set under the profile. Required. :type rule_set_name: str - :param rule_name: Name of the delivery rule which is unique within the endpoint. + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. :type rule_name: str - :param rule: The delivery rule properties. - :type rule: ~azure.mgmt.cdn.models.Rule + :param rule: The delivery rule properties. Is either a model type or a IO type. Required. + :type rule: ~azure.mgmt.cdn.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -278,51 +416,58 @@ async def begin_create( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Rule] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, rule_name=rule_name, rule=rule, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}"} # type: ignore async def _update_initial( self, @@ -330,52 +475,154 @@ async def _update_initial( profile_name: str, rule_set_name: str, rule_name: str, - rule_update_properties: "_models.RuleUpdateParameters", + rule_update_properties: Union[_models.RuleUpdateParameters, IO], **kwargs: Any - ) -> "_models.Rule": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + ) -> _models.Rule: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(rule_update_properties, 'RuleUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Rule] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rule_update_properties, (IO, bytes)): + _content = rule_update_properties + else: + _json = self._serialize.body(rule_update_properties, "RuleUpdateParameters") + + request = build_update_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: 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 + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}"} # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule_update_properties: _models.RuleUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param rule_set_name: Name of the rule set under the profile. Required. + :type rule_set_name: str + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. + :type rule_name: str + :param rule_update_properties: Delivery rule properties. Required. + :type rule_update_properties: ~azure.mgmt.cdn.models.RuleUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Rule or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def begin_update( + self, + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param rule_set_name: Name of the rule set under the profile. Required. + :type rule_set_name: str + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. + :type rule_name: str + :param rule_update_properties: Delivery rule properties. Required. + :type rule_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Rule or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_update( @@ -384,22 +631,26 @@ async def begin_update( profile_name: str, rule_set_name: str, rule_name: str, - rule_update_properties: "_models.RuleUpdateParameters", + rule_update_properties: Union[_models.RuleUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.Rule"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param rule_set_name: Name of the rule set under the profile. + :param rule_set_name: Name of the rule set under the profile. Required. :type rule_set_name: str - :param rule_name: Name of the delivery rule which is unique within the endpoint. + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. :type rule_name: str - :param rule_update_properties: Delivery rule properties. - :type rule_update_properties: ~azure.mgmt.cdn.models.RuleUpdateParameters + :param rule_update_properties: Delivery rule properties. Is either a model type or a IO type. + Required. + :type rule_update_properties: ~azure.mgmt.cdn.models.RuleUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -410,110 +661,120 @@ async def begin_update( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Rule] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, rule_name=rule_name, rule_update_properties=rule_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}"} # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - rule_set_name: str, - rule_name: str, - **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: Any + self, resource_group_name: str, profile_name: str, rule_set_name: str, rule_name: str, **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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param rule_set_name: Name of the rule set under the profile. + :param rule_set_name: Name of the rule set under the profile. Required. :type rule_set_name: str - :param rule_name: Name of the delivery rule which is unique within the endpoint. + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. :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. @@ -525,42 +786,50 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, rule_name=rule_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 1995bbf31bcc..52f990c5d2a8 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,95 +6,121 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._secrets_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_profile_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SecretsOperations: - """SecretsOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`secrets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Secret"]: """Lists existing AzureFrontDoor secrets. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :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) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Secret or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.Secret] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -107,7 +134,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,52 +146,57 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets'} # type: ignore + 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: Any - ) -> "_models.Secret": + async def get(self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param secret_name: Name of the Secret under the profile. + :param secret_name: Name of the Secret under the profile. Required. :type secret_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Secret, or the result of cls(response) + :return: Secret or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Secret - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -170,69 +204,166 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Secret', pipeline_response) + deserialized = self._deserialize("Secret", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore - + 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", + secret: Union[_models.Secret, IO], **kwargs: Any - ) -> "_models.Secret": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + ) -> _models.Secret: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(secret, 'Secret') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] - request = build_create_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(secret, (IO, bytes)): + _content = secret + else: + _json = self._serialize.body(secret, "Secret") + + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, secret_name=secret_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Secret', pipeline_response) + deserialized = self._deserialize("Secret", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Secret', pipeline_response) + deserialized = self._deserialize("Secret", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Secret', pipeline_response) + deserialized = self._deserialize("Secret", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}"} # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + secret_name: str, + secret: _models.Secret, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param secret_name: Name of the Secret under the profile. Required. + :type secret_name: str + :param secret: The Secret properties. Required. + :type secret: ~azure.mgmt.cdn.models.Secret + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Secret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + secret_name: str, + secret: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param secret_name: Name of the Secret under the profile. Required. + :type secret_name: str + :param secret: The Secret properties. Required. + :type secret: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Secret] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -240,20 +371,23 @@ async def begin_create( resource_group_name: str, profile_name: str, secret_name: str, - secret: "_models.Secret", + secret: Union[_models.Secret, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.Secret"]: + ) -> AsyncLROPoller[_models.Secret]: """Creates a new Secret within the specified profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param secret_name: Name of the Secret under the profile. + :param secret_name: Name of the Secret under the profile. Required. :type secret_name: str - :param secret: The Secret properties. - :type secret: ~azure.mgmt.cdn.models.Secret + :param secret: The Secret properties. Is either a model type or a IO type. Required. + :type secret: ~azure.mgmt.cdn.models.Secret or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -265,104 +399,116 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, secret_name=secret_name, secret=secret, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Secret', pipeline_response) + deserialized = self._deserialize("Secret", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - - request = build_delete_request_initial( + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( 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'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: Any + self, resource_group_name: str, profile_name: str, secret_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing Secret within profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param secret_name: Name of the Secret under the profile. + :param secret_name: Name of the Secret under the profile. Required. :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. @@ -374,41 +520,49 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, secret_name=secret_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 58a4f718fde5..808a8150e579 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,97 +6,122 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from ...operations._security_policies_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_profile_request, + build_patch_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SecurityPoliciesOperations: - """SecurityPoliciesOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SecurityPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`security_policies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.SecurityPolicyListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SecurityPolicy"]: """Lists security policies associated with the profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :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] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecurityPolicy or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cdn.models.SecurityPolicy] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicyListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicyListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -109,7 +135,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -119,52 +147,59 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies'} # type: ignore + 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: Any - ) -> "_models.SecurityPolicy": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param security_policy_name: Name of the security policy under the profile. + :param security_policy_name: Name of the security policy under the profile. Required. :type security_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityPolicy, or the result of cls(response) + :return: SecurityPolicy or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.SecurityPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicy] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,69 +207,166 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore - + 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", + security_policy: Union[_models.SecurityPolicy, IO], **kwargs: Any - ) -> "_models.SecurityPolicy": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicy"] + ) -> _models.SecurityPolicy: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicy] - _json = self._serialize.body(security_policy, 'SecurityPolicy') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_policy, (IO, bytes)): + _content = security_policy + else: + _json = self._serialize.body(security_policy, "SecurityPolicy") - request = build_create_request_initial( + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}"} # type: ignore + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy: _models.SecurityPolicy, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param security_policy_name: Name of the security policy under the profile. Required. + :type security_policy_name: str + :param security_policy: The security policy properties. Required. + :type security_policy: ~azure.mgmt.cdn.models.SecurityPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.SecurityPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param security_policy_name: Name of the security policy under the profile. Required. + :type security_policy_name: str + :param security_policy: The security policy properties. Required. + :type security_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.SecurityPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_create( @@ -242,20 +374,24 @@ async def begin_create( resource_group_name: str, profile_name: str, security_policy_name: str, - security_policy: "_models.SecurityPolicy", + security_policy: Union[_models.SecurityPolicy, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.SecurityPolicy"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param security_policy_name: Name of the security policy under the profile. + :param security_policy_name: Name of the security policy under the profile. Required. :type security_policy_name: str - :param security_policy: The security policy properties. - :type security_policy: ~azure.mgmt.cdn.models.SecurityPolicy + :param security_policy: The security policy properties. Is either a model type or a IO type. + Required. + :type security_policy: ~azure.mgmt.cdn.models.SecurityPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -267,101 +403,206 @@ async def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicy] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, security_policy=security_policy, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}"} # type: ignore async def _patch_initial( self, resource_group_name: str, profile_name: str, security_policy_name: str, - security_policy_update_properties: "_models.SecurityPolicyUpdateParameters", + security_policy_update_properties: Union[_models.SecurityPolicyUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecurityPolicy": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicy"] + ) -> _models.SecurityPolicy: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicy] - _json = self._serialize.body(security_policy_update_properties, 'SecurityPolicyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_policy_update_properties, (IO, bytes)): + _content = security_policy_update_properties + else: + _json = self._serialize.body(security_policy_update_properties, "SecurityPolicyUpdateParameters") - request = build_patch_request_initial( + request = build_patch_request( resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._patch_initial.metadata['url'], + content=_content, + template_url=self._patch_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + _patch_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}"} # type: ignore + + @overload + async def begin_patch( + self, + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy_update_properties: _models.SecurityPolicyUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityPolicy]: + """Updates an existing security policy within a profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param security_policy_name: Name of the security policy under the profile. Required. + :type security_policy_name: str + :param security_policy_update_properties: Security policy update properties. Required. + :type security_policy_update_properties: ~azure.mgmt.cdn.models.SecurityPolicyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.SecurityPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def begin_patch( + self, + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy_update_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SecurityPolicy]: + """Updates an existing security policy within a profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param security_policy_name: Name of the security policy under the profile. Required. + :type security_policy_name: str + :param security_policy_update_properties: Security policy update properties. Required. + :type security_policy_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.SecurityPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_patch( @@ -369,20 +610,25 @@ async def begin_patch( resource_group_name: str, profile_name: str, security_policy_name: str, - security_policy_update_properties: "_models.SecurityPolicyUpdateParameters", + security_policy_update_properties: Union[_models.SecurityPolicyUpdateParameters, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.SecurityPolicy"]: + ) -> AsyncLROPoller[_models.SecurityPolicy]: """Updates an existing security policy within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param security_policy_name: Name of the security policy under the profile. + :param security_policy_name: Name of the security policy under the profile. Required. :type security_policy_name: str - :param security_policy_update_properties: Security policy update properties. + :param security_policy_update_properties: Security policy update properties. Is either a model + type or a IO type. Required. :type security_policy_update_properties: ~azure.mgmt.cdn.models.SecurityPolicyUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -394,104 +640,116 @@ async def begin_patch( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicy] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._patch_initial( + raw_result = await self._patch_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, security_policy_update_properties=security_policy_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_patch.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}"} # type: ignore - async def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - security_policy_name: str, - **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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, 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.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: Any + self, resource_group_name: str, profile_name: str, security_policy_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an existing security policy within profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param security_policy_name: Name of the security policy under the profile. + :param security_policy_name: Name of the security policy under the profile. Required. :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. @@ -503,41 +761,49 @@ async def begin_delete( 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, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 21205ee09ac2..557716a4ff07 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,80 +6,145 @@ # 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 typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ValidateOperations: - """ValidateOperations async operations. - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ValidateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s + :attr:`validate` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async + @overload async def secret( self, - validate_secret_input: "_models.ValidateSecretInput", + validate_secret_input: _models.ValidateSecretInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.ValidateSecretOutput": + ) -> _models.ValidateSecretOutput: """Validate a Secret in the profile. - :param validate_secret_input: The Secret source. + :param validate_secret_input: The Secret source. Required. :type validate_secret_input: ~azure.mgmt.cdn.models.ValidateSecretInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateSecretOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.ValidateSecretOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def secret( + self, validate_secret_input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidateSecretOutput: + """Validate a Secret in the profile. + + :param validate_secret_input: The Secret source. Required. + :type validate_secret_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateSecretOutput, or the result of cls(response) + :return: ValidateSecretOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ValidateSecretOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def secret( + self, validate_secret_input: Union[_models.ValidateSecretInput, IO], **kwargs: Any + ) -> _models.ValidateSecretOutput: + """Validate a Secret in the profile. + + :param validate_secret_input: The Secret source. Is either a model type or a IO type. Required. + :type validate_secret_input: ~azure.mgmt.cdn.models.ValidateSecretInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateSecretOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.ValidateSecretOutput + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateSecretOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateSecretOutput] - _json = self._serialize.body(validate_secret_input, 'ValidateSecretInput') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_secret_input, (IO, bytes)): + _content = validate_secret_input + else: + _json = self._serialize.body(validate_secret_input, "ValidateSecretInput") request = build_secret_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.secret.metadata['url'], + content=_content, + template_url=self.secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -86,12 +152,11 @@ async def secret( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ValidateSecretOutput', pipeline_response) + deserialized = self._deserialize("ValidateSecretOutput", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - secret.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret'} # type: ignore - + 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 f3b8d9883de7..060ab1bb56ce 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 @@ -67,6 +67,7 @@ from ._models_py3 import CustomRuleList from ._models_py3 import CustomerCertificate from ._models_py3 import CustomerCertificateParameters +from ._models_py3 import DeepCreatedCustomDomain from ._models_py3 import DeepCreatedOrigin from ._models_py3 import DeepCreatedOriginGroup from ._models_py3 import DeliveryRule @@ -248,454 +249,531 @@ from ._models_py3 import WafRankingsResponse from ._models_py3 import WafRankingsResponseDataItem - -from ._cdn_management_client_enums import ( - AFDEndpointProtocols, - ActionType, - AfdCertificateType, - AfdMinimumTlsVersion, - AfdProvisioningState, - AfdQueryStringCachingBehavior, - Algorithm, - AutoGeneratedDomainNameLabelScope, - CacheBehavior, - CacheType, - CertificateSource, - CertificateType, - ClientPortOperator, - CookiesOperator, - CustomDomainResourceState, - CustomHttpsProvisioningState, - CustomHttpsProvisioningSubstate, - CustomRuleEnabledState, - DeleteRule, - DeliveryRuleActionEnum, - DeploymentStatus, - DestinationProtocol, - DomainValidationState, - EnabledState, - EndpointResourceState, - ForwardingProtocol, - GeoFilterActions, - HeaderAction, - HealthProbeRequestType, - HostNameOperator, - HttpVersionOperator, - HttpsRedirect, - IdentityType, - IsDeviceMatchConditionParametersMatchValuesItem, - IsDeviceOperator, - LinkToDefaultDomain, - LogMetric, - LogMetricsGranularity, - LogMetricsGroupBy, - LogRanking, - LogRankingMetric, - ManagedRuleEnabledState, - MatchProcessingBehavior, - MatchVariable, - MetricsResponseGranularity, - MetricsResponseSeriesItemUnit, - MinimumTlsVersion, - Operator, - OptimizationType, - OriginGroupResourceState, - OriginResourceState, - ParamIndicator, - PolicyEnabledState, - PolicyMode, - PolicyResourceState, - PolicySettingsDefaultCustomBlockResponseStatusCode, - PostArgsOperator, - PrivateEndpointStatus, - ProbeProtocol, - ProfileResourceState, - ProtocolType, - ProvisioningState, - QueryStringBehavior, - QueryStringCachingBehavior, - QueryStringOperator, - RedirectType, - RemoteAddressOperator, - RequestBodyOperator, - RequestHeaderOperator, - RequestMethodMatchConditionParametersMatchValuesItem, - RequestMethodOperator, - RequestSchemeMatchConditionParametersMatchValuesItem, - RequestUriOperator, - ResourceType, - ResponseBasedDetectedErrorTypes, - RuleCacheBehavior, - RuleIsCompressionEnabled, - RuleQueryStringCachingBehavior, - SecretType, - SecurityPolicyType, - ServerPortOperator, - SharedPrivateLinkResourceStatus, - SkuName, - SocketAddrOperator, - SslProtocol, - SslProtocolOperator, - Status, - Transform, - TransformType, - UpdateRule, - UrlFileExtensionOperator, - UrlFileNameOperator, - UrlPathOperator, - UsageUnit, - WafAction, - WafGranularity, - WafMatchVariable, - WafMetric, - WafMetricsResponseGranularity, - WafRankingGroupBy, - WafRankingType, - WafRuleType, -) +from ._cdn_management_client_enums import AFDEndpointProtocols +from ._cdn_management_client_enums import ActionType +from ._cdn_management_client_enums import AfdCertificateType +from ._cdn_management_client_enums import AfdMinimumTlsVersion +from ._cdn_management_client_enums import AfdProvisioningState +from ._cdn_management_client_enums import AfdQueryStringCachingBehavior +from ._cdn_management_client_enums import Algorithm +from ._cdn_management_client_enums import AutoGeneratedDomainNameLabelScope +from ._cdn_management_client_enums import CacheBehavior +from ._cdn_management_client_enums import CacheExpirationActionParametersTypeName +from ._cdn_management_client_enums import CacheKeyQueryStringActionParametersTypeName +from ._cdn_management_client_enums import CacheType +from ._cdn_management_client_enums import CdnCertificateSourceParametersTypeName +from ._cdn_management_client_enums import CertificateSource +from ._cdn_management_client_enums import CertificateType +from ._cdn_management_client_enums import ClientPortMatchConditionParametersTypeName +from ._cdn_management_client_enums import ClientPortOperator +from ._cdn_management_client_enums import CookiesMatchConditionParametersTypeName +from ._cdn_management_client_enums import CookiesOperator +from ._cdn_management_client_enums import CustomDomainResourceState +from ._cdn_management_client_enums import CustomHttpsProvisioningState +from ._cdn_management_client_enums import CustomHttpsProvisioningSubstate +from ._cdn_management_client_enums import CustomRuleEnabledState +from ._cdn_management_client_enums import DeleteRule +from ._cdn_management_client_enums import DeliveryRuleActionEnum +from ._cdn_management_client_enums import DeploymentStatus +from ._cdn_management_client_enums import DestinationProtocol +from ._cdn_management_client_enums import DomainValidationState +from ._cdn_management_client_enums import EnabledState +from ._cdn_management_client_enums import EndpointProvisioningState +from ._cdn_management_client_enums import EndpointResourceState +from ._cdn_management_client_enums import ForwardingProtocol +from ._cdn_management_client_enums import GeoFilterActions +from ._cdn_management_client_enums import HeaderAction +from ._cdn_management_client_enums import HeaderActionParametersTypeName +from ._cdn_management_client_enums import HealthProbeRequestType +from ._cdn_management_client_enums import HostNameMatchConditionParametersTypeName +from ._cdn_management_client_enums import HostNameOperator +from ._cdn_management_client_enums import HttpVersionMatchConditionParametersTypeName +from ._cdn_management_client_enums import HttpVersionOperator +from ._cdn_management_client_enums import HttpsRedirect +from ._cdn_management_client_enums import IdentityType +from ._cdn_management_client_enums import IsDeviceMatchConditionParametersMatchValuesItem +from ._cdn_management_client_enums import IsDeviceMatchConditionParametersTypeName +from ._cdn_management_client_enums import IsDeviceOperator +from ._cdn_management_client_enums import KeyVaultCertificateSourceParametersTypeName +from ._cdn_management_client_enums import KeyVaultSigningKeyParametersTypeName +from ._cdn_management_client_enums import LinkToDefaultDomain +from ._cdn_management_client_enums import LogMetric +from ._cdn_management_client_enums import LogMetricsGranularity +from ._cdn_management_client_enums import LogMetricsGroupBy +from ._cdn_management_client_enums import LogRanking +from ._cdn_management_client_enums import LogRankingMetric +from ._cdn_management_client_enums import ManagedRuleEnabledState +from ._cdn_management_client_enums import MatchProcessingBehavior +from ._cdn_management_client_enums import MatchVariable +from ._cdn_management_client_enums import MetricsResponseGranularity +from ._cdn_management_client_enums import MetricsResponseSeriesItemUnit +from ._cdn_management_client_enums import MinimumTlsVersion +from ._cdn_management_client_enums import Operator +from ._cdn_management_client_enums import OptimizationType +from ._cdn_management_client_enums import OriginGroupOverrideActionParametersTypeName +from ._cdn_management_client_enums import OriginGroupProvisioningState +from ._cdn_management_client_enums import OriginGroupResourceState +from ._cdn_management_client_enums import OriginProvisioningState +from ._cdn_management_client_enums import OriginResourceState +from ._cdn_management_client_enums import ParamIndicator +from ._cdn_management_client_enums import PolicyEnabledState +from ._cdn_management_client_enums import PolicyMode +from ._cdn_management_client_enums import PolicyResourceState +from ._cdn_management_client_enums import PolicySettingsDefaultCustomBlockResponseStatusCode +from ._cdn_management_client_enums import PostArgsMatchConditionParametersTypeName +from ._cdn_management_client_enums import PostArgsOperator +from ._cdn_management_client_enums import PrivateEndpointStatus +from ._cdn_management_client_enums import ProbeProtocol +from ._cdn_management_client_enums import ProfileProvisioningState +from ._cdn_management_client_enums import ProfileResourceState +from ._cdn_management_client_enums import ProtocolType +from ._cdn_management_client_enums import ProvisioningState +from ._cdn_management_client_enums import QueryStringBehavior +from ._cdn_management_client_enums import QueryStringCachingBehavior +from ._cdn_management_client_enums import QueryStringMatchConditionParametersTypeName +from ._cdn_management_client_enums import QueryStringOperator +from ._cdn_management_client_enums import RedirectType +from ._cdn_management_client_enums import RemoteAddressMatchConditionParametersTypeName +from ._cdn_management_client_enums import RemoteAddressOperator +from ._cdn_management_client_enums import RequestBodyMatchConditionParametersTypeName +from ._cdn_management_client_enums import RequestBodyOperator +from ._cdn_management_client_enums import RequestHeaderMatchConditionParametersTypeName +from ._cdn_management_client_enums import RequestHeaderOperator +from ._cdn_management_client_enums import RequestMethodMatchConditionParametersMatchValuesItem +from ._cdn_management_client_enums import RequestMethodMatchConditionParametersTypeName +from ._cdn_management_client_enums import RequestMethodOperator +from ._cdn_management_client_enums import RequestSchemeMatchConditionParametersMatchValuesItem +from ._cdn_management_client_enums import RequestSchemeMatchConditionParametersOperator +from ._cdn_management_client_enums import RequestSchemeMatchConditionParametersTypeName +from ._cdn_management_client_enums import RequestUriMatchConditionParametersTypeName +from ._cdn_management_client_enums import RequestUriOperator +from ._cdn_management_client_enums import ResourceType +from ._cdn_management_client_enums import ResourceUsageUnit +from ._cdn_management_client_enums import ResponseBasedDetectedErrorTypes +from ._cdn_management_client_enums import RouteConfigurationOverrideActionParametersTypeName +from ._cdn_management_client_enums import RuleCacheBehavior +from ._cdn_management_client_enums import RuleIsCompressionEnabled +from ._cdn_management_client_enums import RuleQueryStringCachingBehavior +from ._cdn_management_client_enums import SecretType +from ._cdn_management_client_enums import SecurityPolicyType +from ._cdn_management_client_enums import ServerPortMatchConditionParametersTypeName +from ._cdn_management_client_enums import ServerPortOperator +from ._cdn_management_client_enums import SharedPrivateLinkResourceStatus +from ._cdn_management_client_enums import SkuName +from ._cdn_management_client_enums import SocketAddrMatchConditionParametersTypeName +from ._cdn_management_client_enums import SocketAddrOperator +from ._cdn_management_client_enums import SslProtocol +from ._cdn_management_client_enums import SslProtocolMatchConditionParametersTypeName +from ._cdn_management_client_enums import SslProtocolOperator +from ._cdn_management_client_enums import Status +from ._cdn_management_client_enums import Transform +from ._cdn_management_client_enums import TransformType +from ._cdn_management_client_enums import UpdateRule +from ._cdn_management_client_enums import UrlFileExtensionMatchConditionParametersTypeName +from ._cdn_management_client_enums import UrlFileExtensionOperator +from ._cdn_management_client_enums import UrlFileNameMatchConditionParametersTypeName +from ._cdn_management_client_enums import UrlFileNameOperator +from ._cdn_management_client_enums import UrlPathMatchConditionParametersTypeName +from ._cdn_management_client_enums import UrlPathOperator +from ._cdn_management_client_enums import UrlRedirectActionParametersTypeName +from ._cdn_management_client_enums import UrlRewriteActionParametersTypeName +from ._cdn_management_client_enums import UrlSigningActionParametersTypeName +from ._cdn_management_client_enums import UsageUnit +from ._cdn_management_client_enums import WafAction +from ._cdn_management_client_enums import WafGranularity +from ._cdn_management_client_enums import WafMatchVariable +from ._cdn_management_client_enums import WafMetric +from ._cdn_management_client_enums import WafMetricsResponseGranularity +from ._cdn_management_client_enums import WafMetricsResponseSeriesItemUnit +from ._cdn_management_client_enums import WafRankingGroupBy +from ._cdn_management_client_enums import WafRankingType +from ._cdn_management_client_enums import WafRuleType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'AFDDomain', - 'AFDDomainHttpsParameters', - 'AFDDomainListResult', - 'AFDDomainProperties', - 'AFDDomainUpdateParameters', - 'AFDDomainUpdatePropertiesParameters', - 'AFDEndpoint', - 'AFDEndpointListResult', - 'AFDEndpointProperties', - 'AFDEndpointPropertiesUpdateParameters', - 'AFDEndpointUpdateParameters', - 'AFDOrigin', - 'AFDOriginGroup', - 'AFDOriginGroupListResult', - 'AFDOriginGroupProperties', - 'AFDOriginGroupUpdateParameters', - 'AFDOriginGroupUpdatePropertiesParameters', - 'AFDOriginListResult', - 'AFDOriginProperties', - 'AFDOriginUpdateParameters', - 'AFDOriginUpdatePropertiesParameters', - 'AFDStateProperties', - 'ActivatedResourceReference', - 'AfdErrorResponse', - 'AfdPurgeParameters', - 'AfdRouteCacheConfiguration', - 'AzureFirstPartyManagedCertificate', - 'AzureFirstPartyManagedCertificateParameters', - 'CacheConfiguration', - 'CacheExpirationActionParameters', - 'CacheKeyQueryStringActionParameters', - 'CdnCertificateSourceParameters', - 'CdnEndpoint', - 'CdnManagedHttpsParameters', - 'CdnWebApplicationFirewallPolicy', - 'CdnWebApplicationFirewallPolicyList', - 'CdnWebApplicationFirewallPolicyPatchParameters', - 'Certificate', - 'CheckEndpointNameAvailabilityInput', - 'CheckEndpointNameAvailabilityOutput', - 'CheckHostNameAvailabilityInput', - 'CheckNameAvailabilityInput', - 'CheckNameAvailabilityOutput', - 'CidrIpAddress', - 'ClientPortMatchConditionParameters', - 'Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems', - 'Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems', - 'ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems', - 'CompressionSettings', - 'ContinentsResponse', - 'ContinentsResponseContinentsItem', - 'ContinentsResponseCountryOrRegionsItem', - 'CookiesMatchConditionParameters', - 'CustomDomain', - 'CustomDomainHttpsParameters', - 'CustomDomainListResult', - 'CustomDomainParameters', - 'CustomRule', - 'CustomRuleList', - 'CustomerCertificate', - 'CustomerCertificateParameters', - 'DeepCreatedOrigin', - 'DeepCreatedOriginGroup', - 'DeliveryRule', - 'DeliveryRuleAction', - 'DeliveryRuleCacheExpirationAction', - 'DeliveryRuleCacheKeyQueryStringAction', - 'DeliveryRuleClientPortCondition', - 'DeliveryRuleCondition', - 'DeliveryRuleCookiesCondition', - 'DeliveryRuleHostNameCondition', - 'DeliveryRuleHttpVersionCondition', - 'DeliveryRuleIsDeviceCondition', - 'DeliveryRulePostArgsCondition', - 'DeliveryRuleQueryStringCondition', - 'DeliveryRuleRemoteAddressCondition', - 'DeliveryRuleRequestBodyCondition', - 'DeliveryRuleRequestHeaderAction', - 'DeliveryRuleRequestHeaderCondition', - 'DeliveryRuleRequestMethodCondition', - 'DeliveryRuleRequestSchemeCondition', - 'DeliveryRuleRequestUriCondition', - 'DeliveryRuleResponseHeaderAction', - 'DeliveryRuleRouteConfigurationOverrideAction', - 'DeliveryRuleServerPortCondition', - 'DeliveryRuleSocketAddrCondition', - 'DeliveryRuleSslProtocolCondition', - 'DeliveryRuleUrlFileExtensionCondition', - 'DeliveryRuleUrlFileNameCondition', - 'DeliveryRuleUrlPathCondition', - 'DimensionProperties', - 'DomainValidationProperties', - 'EdgeNode', - 'EdgenodeResult', - 'Endpoint', - 'EndpointListResult', - 'EndpointProperties', - 'EndpointPropertiesUpdateParameters', - 'EndpointPropertiesUpdateParametersDeliveryPolicy', - 'EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink', - 'EndpointUpdateParameters', - 'ErrorAdditionalInfo', - 'ErrorDetail', - 'ErrorResponse', - 'GeoFilter', - 'HeaderActionParameters', - 'HealthProbeParameters', - 'HostNameMatchConditionParameters', - 'HttpErrorRangeParameters', - 'HttpVersionMatchConditionParameters', - 'IpAddressGroup', - 'IsDeviceMatchConditionParameters', - 'KeyVaultCertificateSourceParameters', - 'KeyVaultSigningKeyParameters', - 'LoadBalancingSettingsParameters', - 'LoadParameters', - 'LogSpecification', - 'ManagedCertificate', - 'ManagedCertificateParameters', - 'ManagedRuleDefinition', - 'ManagedRuleGroupDefinition', - 'ManagedRuleGroupOverride', - 'ManagedRuleOverride', - 'ManagedRuleSet', - 'ManagedRuleSetDefinition', - 'ManagedRuleSetDefinitionList', - 'ManagedRuleSetList', - 'MatchCondition', - 'MetricAvailability', - 'MetricSpecification', - 'MetricsResponse', - 'MetricsResponseSeriesItem', - 'MetricsResponseSeriesPropertiesItemsItem', - 'Operation', - 'OperationDisplay', - 'OperationsListResult', - 'Origin', - 'OriginGroup', - 'OriginGroupListResult', - 'OriginGroupOverride', - 'OriginGroupOverrideAction', - 'OriginGroupOverrideActionParameters', - 'OriginGroupProperties', - 'OriginGroupUpdateParameters', - 'OriginGroupUpdatePropertiesParameters', - 'OriginListResult', - 'OriginProperties', - 'OriginUpdateParameters', - 'OriginUpdatePropertiesParameters', - 'PolicySettings', - 'PostArgsMatchConditionParameters', - 'Profile', - 'ProfileListResult', - 'ProfileUpdateParameters', - 'ProxyResource', - 'PurgeParameters', - 'QueryStringMatchConditionParameters', - 'RankingsResponse', - 'RankingsResponseTablesItem', - 'RankingsResponseTablesPropertiesItemsItem', - 'RankingsResponseTablesPropertiesItemsMetricsItem', - 'RateLimitRule', - 'RateLimitRuleList', - 'RemoteAddressMatchConditionParameters', - 'RequestBodyMatchConditionParameters', - 'RequestHeaderMatchConditionParameters', - 'RequestMethodMatchConditionParameters', - 'RequestSchemeMatchConditionParameters', - 'RequestUriMatchConditionParameters', - 'Resource', - 'ResourceReference', - 'ResourceUsage', - 'ResourceUsageListResult', - 'ResourcesResponse', - 'ResourcesResponseCustomDomainsItem', - 'ResourcesResponseEndpointsItem', - 'ResourcesResponseEndpointsPropertiesItemsItem', - 'ResponseBasedOriginErrorDetectionParameters', - 'Route', - 'RouteConfigurationOverrideActionParameters', - 'RouteListResult', - 'RouteProperties', - 'RouteUpdateParameters', - 'RouteUpdatePropertiesParameters', - 'Rule', - 'RuleListResult', - 'RuleProperties', - 'RuleSet', - 'RuleSetListResult', - 'RuleSetProperties', - 'RuleUpdateParameters', - 'RuleUpdatePropertiesParameters', - 'Secret', - 'SecretListResult', - 'SecretParameters', - 'SecretProperties', - 'SecurityPolicy', - 'SecurityPolicyListResult', - 'SecurityPolicyProperties', - 'SecurityPolicyPropertiesParameters', - 'SecurityPolicyUpdateParameters', - 'SecurityPolicyWebApplicationFirewallAssociation', - 'SecurityPolicyWebApplicationFirewallParameters', - 'ServerPortMatchConditionParameters', - 'ServiceSpecification', - 'SharedPrivateLinkResourceProperties', - 'Sku', - 'SocketAddrMatchConditionParameters', - 'SslProtocolMatchConditionParameters', - 'SsoUri', - 'SupportedOptimizationTypesListResult', - 'SystemData', - 'TrackedResource', - 'UrlFileExtensionMatchConditionParameters', - 'UrlFileNameMatchConditionParameters', - 'UrlPathMatchConditionParameters', - 'UrlRedirectAction', - 'UrlRedirectActionParameters', - 'UrlRewriteAction', - 'UrlRewriteActionParameters', - 'UrlSigningAction', - 'UrlSigningActionParameters', - 'UrlSigningKey', - 'UrlSigningKeyParameters', - 'UrlSigningParamIdentifier', - 'Usage', - 'UsageName', - 'UsagesListResult', - 'UserManagedHttpsParameters', - 'ValidateCustomDomainInput', - 'ValidateCustomDomainOutput', - 'ValidateProbeInput', - 'ValidateProbeOutput', - 'ValidateSecretInput', - 'ValidateSecretOutput', - 'ValidationToken', - 'WafMetricsResponse', - 'WafMetricsResponseSeriesItem', - 'WafMetricsResponseSeriesPropertiesItemsItem', - 'WafRankingsResponse', - 'WafRankingsResponseDataItem', - 'AFDEndpointProtocols', - 'ActionType', - 'AfdCertificateType', - 'AfdMinimumTlsVersion', - 'AfdProvisioningState', - 'AfdQueryStringCachingBehavior', - 'Algorithm', - 'AutoGeneratedDomainNameLabelScope', - 'CacheBehavior', - 'CacheType', - 'CertificateSource', - 'CertificateType', - 'ClientPortOperator', - 'CookiesOperator', - 'CustomDomainResourceState', - 'CustomHttpsProvisioningState', - 'CustomHttpsProvisioningSubstate', - 'CustomRuleEnabledState', - 'DeleteRule', - 'DeliveryRuleActionEnum', - 'DeploymentStatus', - 'DestinationProtocol', - 'DomainValidationState', - 'EnabledState', - 'EndpointResourceState', - 'ForwardingProtocol', - 'GeoFilterActions', - 'HeaderAction', - 'HealthProbeRequestType', - 'HostNameOperator', - 'HttpVersionOperator', - 'HttpsRedirect', - 'IdentityType', - 'IsDeviceMatchConditionParametersMatchValuesItem', - 'IsDeviceOperator', - 'LinkToDefaultDomain', - 'LogMetric', - 'LogMetricsGranularity', - 'LogMetricsGroupBy', - 'LogRanking', - 'LogRankingMetric', - 'ManagedRuleEnabledState', - 'MatchProcessingBehavior', - 'MatchVariable', - 'MetricsResponseGranularity', - 'MetricsResponseSeriesItemUnit', - 'MinimumTlsVersion', - 'Operator', - 'OptimizationType', - 'OriginGroupResourceState', - 'OriginResourceState', - 'ParamIndicator', - 'PolicyEnabledState', - 'PolicyMode', - 'PolicyResourceState', - 'PolicySettingsDefaultCustomBlockResponseStatusCode', - 'PostArgsOperator', - 'PrivateEndpointStatus', - 'ProbeProtocol', - 'ProfileResourceState', - 'ProtocolType', - 'ProvisioningState', - 'QueryStringBehavior', - 'QueryStringCachingBehavior', - 'QueryStringOperator', - 'RedirectType', - 'RemoteAddressOperator', - 'RequestBodyOperator', - 'RequestHeaderOperator', - 'RequestMethodMatchConditionParametersMatchValuesItem', - 'RequestMethodOperator', - 'RequestSchemeMatchConditionParametersMatchValuesItem', - 'RequestUriOperator', - 'ResourceType', - 'ResponseBasedDetectedErrorTypes', - 'RuleCacheBehavior', - 'RuleIsCompressionEnabled', - 'RuleQueryStringCachingBehavior', - 'SecretType', - 'SecurityPolicyType', - 'ServerPortOperator', - 'SharedPrivateLinkResourceStatus', - 'SkuName', - 'SocketAddrOperator', - 'SslProtocol', - 'SslProtocolOperator', - 'Status', - 'Transform', - 'TransformType', - 'UpdateRule', - 'UrlFileExtensionOperator', - 'UrlFileNameOperator', - 'UrlPathOperator', - 'UsageUnit', - 'WafAction', - 'WafGranularity', - 'WafMatchVariable', - 'WafMetric', - 'WafMetricsResponseGranularity', - 'WafRankingGroupBy', - 'WafRankingType', - 'WafRuleType', + "AFDDomain", + "AFDDomainHttpsParameters", + "AFDDomainListResult", + "AFDDomainProperties", + "AFDDomainUpdateParameters", + "AFDDomainUpdatePropertiesParameters", + "AFDEndpoint", + "AFDEndpointListResult", + "AFDEndpointProperties", + "AFDEndpointPropertiesUpdateParameters", + "AFDEndpointUpdateParameters", + "AFDOrigin", + "AFDOriginGroup", + "AFDOriginGroupListResult", + "AFDOriginGroupProperties", + "AFDOriginGroupUpdateParameters", + "AFDOriginGroupUpdatePropertiesParameters", + "AFDOriginListResult", + "AFDOriginProperties", + "AFDOriginUpdateParameters", + "AFDOriginUpdatePropertiesParameters", + "AFDStateProperties", + "ActivatedResourceReference", + "AfdErrorResponse", + "AfdPurgeParameters", + "AfdRouteCacheConfiguration", + "AzureFirstPartyManagedCertificate", + "AzureFirstPartyManagedCertificateParameters", + "CacheConfiguration", + "CacheExpirationActionParameters", + "CacheKeyQueryStringActionParameters", + "CdnCertificateSourceParameters", + "CdnEndpoint", + "CdnManagedHttpsParameters", + "CdnWebApplicationFirewallPolicy", + "CdnWebApplicationFirewallPolicyList", + "CdnWebApplicationFirewallPolicyPatchParameters", + "Certificate", + "CheckEndpointNameAvailabilityInput", + "CheckEndpointNameAvailabilityOutput", + "CheckHostNameAvailabilityInput", + "CheckNameAvailabilityInput", + "CheckNameAvailabilityOutput", + "CidrIpAddress", + "ClientPortMatchConditionParameters", + "Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems", + "Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems", + "ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems", + "CompressionSettings", + "ContinentsResponse", + "ContinentsResponseContinentsItem", + "ContinentsResponseCountryOrRegionsItem", + "CookiesMatchConditionParameters", + "CustomDomain", + "CustomDomainHttpsParameters", + "CustomDomainListResult", + "CustomDomainParameters", + "CustomRule", + "CustomRuleList", + "CustomerCertificate", + "CustomerCertificateParameters", + "DeepCreatedCustomDomain", + "DeepCreatedOrigin", + "DeepCreatedOriginGroup", + "DeliveryRule", + "DeliveryRuleAction", + "DeliveryRuleCacheExpirationAction", + "DeliveryRuleCacheKeyQueryStringAction", + "DeliveryRuleClientPortCondition", + "DeliveryRuleCondition", + "DeliveryRuleCookiesCondition", + "DeliveryRuleHostNameCondition", + "DeliveryRuleHttpVersionCondition", + "DeliveryRuleIsDeviceCondition", + "DeliveryRulePostArgsCondition", + "DeliveryRuleQueryStringCondition", + "DeliveryRuleRemoteAddressCondition", + "DeliveryRuleRequestBodyCondition", + "DeliveryRuleRequestHeaderAction", + "DeliveryRuleRequestHeaderCondition", + "DeliveryRuleRequestMethodCondition", + "DeliveryRuleRequestSchemeCondition", + "DeliveryRuleRequestUriCondition", + "DeliveryRuleResponseHeaderAction", + "DeliveryRuleRouteConfigurationOverrideAction", + "DeliveryRuleServerPortCondition", + "DeliveryRuleSocketAddrCondition", + "DeliveryRuleSslProtocolCondition", + "DeliveryRuleUrlFileExtensionCondition", + "DeliveryRuleUrlFileNameCondition", + "DeliveryRuleUrlPathCondition", + "DimensionProperties", + "DomainValidationProperties", + "EdgeNode", + "EdgenodeResult", + "Endpoint", + "EndpointListResult", + "EndpointProperties", + "EndpointPropertiesUpdateParameters", + "EndpointPropertiesUpdateParametersDeliveryPolicy", + "EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink", + "EndpointUpdateParameters", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "GeoFilter", + "HeaderActionParameters", + "HealthProbeParameters", + "HostNameMatchConditionParameters", + "HttpErrorRangeParameters", + "HttpVersionMatchConditionParameters", + "IpAddressGroup", + "IsDeviceMatchConditionParameters", + "KeyVaultCertificateSourceParameters", + "KeyVaultSigningKeyParameters", + "LoadBalancingSettingsParameters", + "LoadParameters", + "LogSpecification", + "ManagedCertificate", + "ManagedCertificateParameters", + "ManagedRuleDefinition", + "ManagedRuleGroupDefinition", + "ManagedRuleGroupOverride", + "ManagedRuleOverride", + "ManagedRuleSet", + "ManagedRuleSetDefinition", + "ManagedRuleSetDefinitionList", + "ManagedRuleSetList", + "MatchCondition", + "MetricAvailability", + "MetricSpecification", + "MetricsResponse", + "MetricsResponseSeriesItem", + "MetricsResponseSeriesPropertiesItemsItem", + "Operation", + "OperationDisplay", + "OperationsListResult", + "Origin", + "OriginGroup", + "OriginGroupListResult", + "OriginGroupOverride", + "OriginGroupOverrideAction", + "OriginGroupOverrideActionParameters", + "OriginGroupProperties", + "OriginGroupUpdateParameters", + "OriginGroupUpdatePropertiesParameters", + "OriginListResult", + "OriginProperties", + "OriginUpdateParameters", + "OriginUpdatePropertiesParameters", + "PolicySettings", + "PostArgsMatchConditionParameters", + "Profile", + "ProfileListResult", + "ProfileUpdateParameters", + "ProxyResource", + "PurgeParameters", + "QueryStringMatchConditionParameters", + "RankingsResponse", + "RankingsResponseTablesItem", + "RankingsResponseTablesPropertiesItemsItem", + "RankingsResponseTablesPropertiesItemsMetricsItem", + "RateLimitRule", + "RateLimitRuleList", + "RemoteAddressMatchConditionParameters", + "RequestBodyMatchConditionParameters", + "RequestHeaderMatchConditionParameters", + "RequestMethodMatchConditionParameters", + "RequestSchemeMatchConditionParameters", + "RequestUriMatchConditionParameters", + "Resource", + "ResourceReference", + "ResourceUsage", + "ResourceUsageListResult", + "ResourcesResponse", + "ResourcesResponseCustomDomainsItem", + "ResourcesResponseEndpointsItem", + "ResourcesResponseEndpointsPropertiesItemsItem", + "ResponseBasedOriginErrorDetectionParameters", + "Route", + "RouteConfigurationOverrideActionParameters", + "RouteListResult", + "RouteProperties", + "RouteUpdateParameters", + "RouteUpdatePropertiesParameters", + "Rule", + "RuleListResult", + "RuleProperties", + "RuleSet", + "RuleSetListResult", + "RuleSetProperties", + "RuleUpdateParameters", + "RuleUpdatePropertiesParameters", + "Secret", + "SecretListResult", + "SecretParameters", + "SecretProperties", + "SecurityPolicy", + "SecurityPolicyListResult", + "SecurityPolicyProperties", + "SecurityPolicyPropertiesParameters", + "SecurityPolicyUpdateParameters", + "SecurityPolicyWebApplicationFirewallAssociation", + "SecurityPolicyWebApplicationFirewallParameters", + "ServerPortMatchConditionParameters", + "ServiceSpecification", + "SharedPrivateLinkResourceProperties", + "Sku", + "SocketAddrMatchConditionParameters", + "SslProtocolMatchConditionParameters", + "SsoUri", + "SupportedOptimizationTypesListResult", + "SystemData", + "TrackedResource", + "UrlFileExtensionMatchConditionParameters", + "UrlFileNameMatchConditionParameters", + "UrlPathMatchConditionParameters", + "UrlRedirectAction", + "UrlRedirectActionParameters", + "UrlRewriteAction", + "UrlRewriteActionParameters", + "UrlSigningAction", + "UrlSigningActionParameters", + "UrlSigningKey", + "UrlSigningKeyParameters", + "UrlSigningParamIdentifier", + "Usage", + "UsageName", + "UsagesListResult", + "UserManagedHttpsParameters", + "ValidateCustomDomainInput", + "ValidateCustomDomainOutput", + "ValidateProbeInput", + "ValidateProbeOutput", + "ValidateSecretInput", + "ValidateSecretOutput", + "ValidationToken", + "WafMetricsResponse", + "WafMetricsResponseSeriesItem", + "WafMetricsResponseSeriesPropertiesItemsItem", + "WafRankingsResponse", + "WafRankingsResponseDataItem", + "AFDEndpointProtocols", + "ActionType", + "AfdCertificateType", + "AfdMinimumTlsVersion", + "AfdProvisioningState", + "AfdQueryStringCachingBehavior", + "Algorithm", + "AutoGeneratedDomainNameLabelScope", + "CacheBehavior", + "CacheExpirationActionParametersTypeName", + "CacheKeyQueryStringActionParametersTypeName", + "CacheType", + "CdnCertificateSourceParametersTypeName", + "CertificateSource", + "CertificateType", + "ClientPortMatchConditionParametersTypeName", + "ClientPortOperator", + "CookiesMatchConditionParametersTypeName", + "CookiesOperator", + "CustomDomainResourceState", + "CustomHttpsProvisioningState", + "CustomHttpsProvisioningSubstate", + "CustomRuleEnabledState", + "DeleteRule", + "DeliveryRuleActionEnum", + "DeploymentStatus", + "DestinationProtocol", + "DomainValidationState", + "EnabledState", + "EndpointProvisioningState", + "EndpointResourceState", + "ForwardingProtocol", + "GeoFilterActions", + "HeaderAction", + "HeaderActionParametersTypeName", + "HealthProbeRequestType", + "HostNameMatchConditionParametersTypeName", + "HostNameOperator", + "HttpVersionMatchConditionParametersTypeName", + "HttpVersionOperator", + "HttpsRedirect", + "IdentityType", + "IsDeviceMatchConditionParametersMatchValuesItem", + "IsDeviceMatchConditionParametersTypeName", + "IsDeviceOperator", + "KeyVaultCertificateSourceParametersTypeName", + "KeyVaultSigningKeyParametersTypeName", + "LinkToDefaultDomain", + "LogMetric", + "LogMetricsGranularity", + "LogMetricsGroupBy", + "LogRanking", + "LogRankingMetric", + "ManagedRuleEnabledState", + "MatchProcessingBehavior", + "MatchVariable", + "MetricsResponseGranularity", + "MetricsResponseSeriesItemUnit", + "MinimumTlsVersion", + "Operator", + "OptimizationType", + "OriginGroupOverrideActionParametersTypeName", + "OriginGroupProvisioningState", + "OriginGroupResourceState", + "OriginProvisioningState", + "OriginResourceState", + "ParamIndicator", + "PolicyEnabledState", + "PolicyMode", + "PolicyResourceState", + "PolicySettingsDefaultCustomBlockResponseStatusCode", + "PostArgsMatchConditionParametersTypeName", + "PostArgsOperator", + "PrivateEndpointStatus", + "ProbeProtocol", + "ProfileProvisioningState", + "ProfileResourceState", + "ProtocolType", + "ProvisioningState", + "QueryStringBehavior", + "QueryStringCachingBehavior", + "QueryStringMatchConditionParametersTypeName", + "QueryStringOperator", + "RedirectType", + "RemoteAddressMatchConditionParametersTypeName", + "RemoteAddressOperator", + "RequestBodyMatchConditionParametersTypeName", + "RequestBodyOperator", + "RequestHeaderMatchConditionParametersTypeName", + "RequestHeaderOperator", + "RequestMethodMatchConditionParametersMatchValuesItem", + "RequestMethodMatchConditionParametersTypeName", + "RequestMethodOperator", + "RequestSchemeMatchConditionParametersMatchValuesItem", + "RequestSchemeMatchConditionParametersOperator", + "RequestSchemeMatchConditionParametersTypeName", + "RequestUriMatchConditionParametersTypeName", + "RequestUriOperator", + "ResourceType", + "ResourceUsageUnit", + "ResponseBasedDetectedErrorTypes", + "RouteConfigurationOverrideActionParametersTypeName", + "RuleCacheBehavior", + "RuleIsCompressionEnabled", + "RuleQueryStringCachingBehavior", + "SecretType", + "SecurityPolicyType", + "ServerPortMatchConditionParametersTypeName", + "ServerPortOperator", + "SharedPrivateLinkResourceStatus", + "SkuName", + "SocketAddrMatchConditionParametersTypeName", + "SocketAddrOperator", + "SslProtocol", + "SslProtocolMatchConditionParametersTypeName", + "SslProtocolOperator", + "Status", + "Transform", + "TransformType", + "UpdateRule", + "UrlFileExtensionMatchConditionParametersTypeName", + "UrlFileExtensionOperator", + "UrlFileNameMatchConditionParametersTypeName", + "UrlFileNameOperator", + "UrlPathMatchConditionParametersTypeName", + "UrlPathOperator", + "UrlRedirectActionParametersTypeName", + "UrlRewriteActionParametersTypeName", + "UrlSigningActionParametersTypeName", + "UsageUnit", + "WafAction", + "WafGranularity", + "WafMatchVariable", + "WafMetric", + "WafMetricsResponseGranularity", + "WafMetricsResponseSeriesItemUnit", + "WafRankingGroupBy", + "WafRankingType", + "WafRuleType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() 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 1ceb17b6c201..79857b9e22c2 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 @@ -7,44 +7,42 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Defines the action to take on rule match. - """ +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the action to take on rule match.""" ALLOW = "Allow" BLOCK = "Block" LOG = "Log" REDIRECT = "Redirect" -class AfdCertificateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Defines the source of the SSL certificate. - """ + +class AfdCertificateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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)): - """Supported protocols for the customer's endpoint. - """ + +class AFDEndpointProtocols(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Supported protocols for the customer's endpoint.""" HTTP = "Http" HTTPS = "Https" -class AfdMinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """TLS protocol version that will be used for Https - """ + +class AfdMinimumTlsVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """TLS protocol version that will be used for Https.""" TLS10 = "TLS10" TLS12 = "TLS12" -class AfdProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning status - """ + +class AfdProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning status.""" SUCCEEDED = "Succeeded" FAILED = "Failed" @@ -52,7 +50,8 @@ class AfdProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETING = "Deleting" CREATING = "Creating" -class AfdQueryStringCachingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class AfdQueryStringCachingBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -63,52 +62,78 @@ class AfdQueryStringCachingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, IGNORE_SPECIFIED_QUERY_STRINGS = "IgnoreSpecifiedQueryStrings" INCLUDE_SPECIFIED_QUERY_STRINGS = "IncludeSpecifiedQueryStrings" -class Algorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Algorithm to use for URL signing - """ + +class Algorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Algorithm to use for URL signing.""" SHA256 = "SHA256" -class AutoGeneratedDomainNameLabelScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Indicates the endpoint name reuse scope. The default value is TenantReuse. - """ + +class AutoGeneratedDomainNameLabelScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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 - """ + +class CacheBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Caching behavior for the requests.""" BYPASS_CACHE = "BypassCache" OVERRIDE = "Override" SET_IF_MISSING = "SetIfMissing" -class CacheType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The level at which the content needs to be cached. - """ + +class CacheExpirationActionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CacheExpirationActionParametersTypeName.""" + + DELIVERY_RULE_CACHE_EXPIRATION_ACTION_PARAMETERS = "DeliveryRuleCacheExpirationActionParameters" + + +class CacheKeyQueryStringActionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CacheKeyQueryStringActionParametersTypeName.""" + + DELIVERY_RULE_CACHE_KEY_QUERY_STRING_BEHAVIOR_ACTION_PARAMETERS = ( + "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" + ) + + +class CacheType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The level at which the content needs to be cached.""" ALL = "All" -class CertificateSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Defines the source of the SSL certificate. - """ + +class CdnCertificateSourceParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CdnCertificateSourceParametersTypeName.""" + + CDN_CERTIFICATE_SOURCE_PARAMETERS = "CdnCertificateSourceParameters" + + +class CertificateSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the source of the SSL certificate.""" AZURE_KEY_VAULT = "AzureKeyVault" CDN = "Cdn" -class CertificateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of certificate used - """ + +class CertificateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of certificate used.""" SHARED = "Shared" DEDICATED = "Dedicated" -class ClientPortOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class ClientPortMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ClientPortMatchConditionParametersTypeName.""" + + DELIVERY_RULE_CLIENT_PORT_CONDITION_PARAMETERS = "DeliveryRuleClientPortConditionParameters" + + +class ClientPortOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -121,9 +146,15 @@ class ClientPortOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class CookiesOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class CookiesMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CookiesMatchConditionParametersTypeName.""" + + DELIVERY_RULE_COOKIES_CONDITION_PARAMETERS = "DeliveryRuleCookiesConditionParameters" + + +class CookiesOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -136,17 +167,17 @@ class CookiesOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class CustomDomainResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Resource status of the custom domain. - """ + +class CustomDomainResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource status of the custom domain.""" CREATING = "Creating" ACTIVE = "Active" DELETING = "Deleting" -class CustomHttpsProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning status of Custom Https of the custom domain. - """ + +class CustomHttpsProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning status of the custom domain.""" ENABLING = "Enabling" ENABLED = "Enabled" @@ -154,7 +185,8 @@ class CustomHttpsProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, DISABLED = "Disabled" FAILED = "Failed" -class CustomHttpsProvisioningSubstate(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class CustomHttpsProvisioningSubstate(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. """ @@ -170,7 +202,8 @@ class CustomHttpsProvisioningSubstate(with_metaclass(CaseInsensitiveEnumMeta, st DELETING_CERTIFICATE = "DeletingCertificate" CERTIFICATE_DELETED = "CertificateDeleted" -class CustomRuleEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class CustomRuleEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. """ @@ -178,15 +211,15 @@ class CustomRuleEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DISABLED = "Disabled" ENABLED = "Enabled" -class DeleteRule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes the action that shall be taken when the certificate is removed from Key Vault. - """ + +class DeleteRule(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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)): - """The name of the action for the delivery rule. - """ + +class DeliveryRuleActionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of the action for the delivery rule.""" CACHE_EXPIRATION = "CacheExpiration" CACHE_KEY_QUERY_STRING = "CacheKeyQueryString" @@ -198,22 +231,25 @@ class DeliveryRuleActionEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) ORIGIN_GROUP_OVERRIDE = "OriginGroupOverride" ROUTE_CONFIGURATION_OVERRIDE = "RouteConfigurationOverride" -class DeploymentStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DeploymentStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DeploymentStatus.""" NOT_STARTED = "NotStarted" IN_PROGRESS = "InProgress" SUCCEEDED = "Succeeded" FAILED = "Failed" -class DestinationProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Protocol to use for the redirect. The default value is MatchRequest - """ + +class DestinationProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol to use for the redirect. The default value is MatchRequest.""" MATCH_REQUEST = "MatchRequest" HTTP = "Http" HTTPS = "Https" -class DomainValidationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class DomainValidationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. DCV stands for DomainControlValidation. """ @@ -228,16 +264,26 @@ class DomainValidationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REFRESHING_VALIDATION_TOKEN = "RefreshingValidationToken" INTERNAL_ERROR = "InternalError" -class EnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled' - """ + +class EnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'.""" ENABLED = "Enabled" DISABLED = "Disabled" -class EndpointResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Resource status of the endpoint. - """ + +class EndpointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning status of the endpoint.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + UPDATING = "Updating" + DELETING = "Deleting" + CREATING = "Creating" + + +class EndpointResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource status of the endpoint.""" CREATING = "Creating" DELETING = "Deleting" @@ -246,40 +292,52 @@ class EndpointResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STOPPED = "Stopped" STOPPING = "Stopping" -class ForwardingProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Protocol this rule will use when forwarding traffic to backends. - """ + +class ForwardingProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol this rule will use when forwarding traffic to backends.""" HTTP_ONLY = "HttpOnly" HTTPS_ONLY = "HttpsOnly" MATCH_REQUEST = "MatchRequest" -class GeoFilterActions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Action of the geo filter, i.e. allow or block access. - """ + +class GeoFilterActions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Action of the geo filter, i.e. allow or block access.""" BLOCK = "Block" ALLOW = "Allow" -class HeaderAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Action to perform - """ + +class HeaderAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Action to perform.""" APPEND = "Append" OVERWRITE = "Overwrite" DELETE = "Delete" -class HealthProbeRequestType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of health probe request that is made. - """ + +class HeaderActionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """HeaderActionParametersTypeName.""" + + DELIVERY_RULE_HEADER_ACTION_PARAMETERS = "DeliveryRuleHeaderActionParameters" + + +class HealthProbeRequestType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of health probe request that is made.""" NOT_SET = "NotSet" GET = "GET" HEAD = "HEAD" -class HostNameOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class HostNameMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """HostNameMatchConditionParametersTypeName.""" + + DELIVERY_RULE_HOST_NAME_CONDITION_PARAMETERS = "DeliveryRuleHostNameConditionParameters" + + +class HostNameOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -292,7 +350,8 @@ class HostNameOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class HttpsRedirect(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class HttpsRedirect(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. """ @@ -300,40 +359,68 @@ class HttpsRedirect(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class HttpVersionOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class HttpVersionMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """HttpVersionMatchConditionParametersTypeName.""" + + DELIVERY_RULE_HTTP_VERSION_CONDITION_PARAMETERS = "DeliveryRuleHttpVersionConditionParameters" + + +class HttpVersionOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" EQUAL = "Equal" -class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity that creates/modifies resources - """ + +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that creates/modifies resources.""" USER = "user" APPLICATION = "application" MANAGED_IDENTITY = "managedIdentity" KEY = "key" -class IsDeviceMatchConditionParametersMatchValuesItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class IsDeviceMatchConditionParametersMatchValuesItem(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IsDeviceMatchConditionParametersMatchValuesItem.""" MOBILE = "Mobile" DESKTOP = "Desktop" -class IsDeviceOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class IsDeviceMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IsDeviceMatchConditionParametersTypeName.""" + + DELIVERY_RULE_IS_DEVICE_CONDITION_PARAMETERS = "DeliveryRuleIsDeviceConditionParameters" + + +class IsDeviceOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" EQUAL = "Equal" -class LinkToDefaultDomain(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """whether this route will be linked to the default endpoint domain. - """ + +class KeyVaultCertificateSourceParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyVaultCertificateSourceParametersTypeName.""" + + KEY_VAULT_CERTIFICATE_SOURCE_PARAMETERS = "KeyVaultCertificateSourceParameters" + + +class KeyVaultSigningKeyParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KeyVaultSigningKeyParametersTypeName.""" + + KEY_VAULT_SIGNING_KEY_PARAMETERS = "KeyVaultSigningKeyParameters" + + +class LinkToDefaultDomain(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """whether this route will be linked to the default endpoint domain.""" ENABLED = "Enabled" DISABLED = "Disabled" -class LogMetric(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class LogMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogMetric.""" CLIENT_REQUEST_COUNT = "clientRequestCount" CLIENT_REQUEST_TRAFFIC = "clientRequestTraffic" @@ -342,13 +429,17 @@ class LogMetric(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ORIGIN_REQUEST_BANDWIDTH = "originRequestBandwidth" TOTAL_LATENCY = "totalLatency" -class LogMetricsGranularity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class LogMetricsGranularity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogMetricsGranularity.""" PT5_M = "PT5M" PT1_H = "PT1H" P1_D = "P1D" -class LogMetricsGroupBy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class LogMetricsGroupBy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogMetricsGroupBy.""" HTTP_STATUS_CODE = "httpStatusCode" PROTOCOL = "protocol" @@ -356,7 +447,9 @@ class LogMetricsGroupBy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COUNTRY_OR_REGION = "countryOrRegion" CUSTOM_DOMAIN = "customDomain" -class LogRanking(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class LogRanking(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogRanking.""" URL = "url" REFERRER = "referrer" @@ -364,7 +457,9 @@ class LogRanking(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_AGENT = "userAgent" COUNTRY_OR_REGION = "countryOrRegion" -class LogRankingMetric(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class LogRankingMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogRankingMetric.""" CLIENT_REQUEST_COUNT = "clientRequestCount" CLIENT_REQUEST_TRAFFIC = "clientRequestTraffic" @@ -373,7 +468,8 @@ class LogRankingMetric(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ERROR_COUNT = "userErrorCount" ERROR_COUNT = "errorCount" -class ManagedRuleEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class ManagedRuleEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes if the managed rule is in enabled or disabled state. Defaults to Disabled if not specified. """ @@ -381,17 +477,18 @@ class ManagedRuleEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum) DISABLED = "Disabled" ENABLED = "Enabled" -class MatchProcessingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class MatchProcessingBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. """ - CONTINUE_ENUM = "Continue" + CONTINUE = "Continue" STOP = "Stop" -class MatchVariable(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The name of the condition for the delivery rule. - """ + +class MatchVariable(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of the condition for the delivery rule.""" REMOTE_ADDRESS = "RemoteAddress" REQUEST_METHOD = "RequestMethod" @@ -413,30 +510,34 @@ class MatchVariable(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): HOST_NAME = "HostName" SSL_PROTOCOL = "SslProtocol" -class MetricsResponseGranularity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class MetricsResponseGranularity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MetricsResponseGranularity.""" PT5_M = "PT5M" PT1_H = "PT1H" P1_D = "P1D" -class MetricsResponseSeriesItemUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class MetricsResponseSeriesItemUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MetricsResponseSeriesItemUnit.""" COUNT = "count" BYTES = "bytes" BITS_PER_SECOND = "bitsPerSecond" MILLI_SECONDS = "milliSeconds" -class MinimumTlsVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """TLS protocol version that will be used for Https - """ + +class MinimumTlsVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """TLS protocol version that will be used for Https.""" NONE = "None" TLS10 = "TLS10" TLS12 = "TLS12" -class Operator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class Operator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" IP_MATCH = "IPMatch" @@ -451,7 +552,8 @@ class Operator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENDS_WITH = "EndsWith" REG_EX = "RegEx" -class OptimizationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class OptimizationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. """ @@ -462,47 +564,73 @@ class OptimizationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LARGE_FILE_DOWNLOAD = "LargeFileDownload" DYNAMIC_SITE_ACCELERATION = "DynamicSiteAcceleration" -class OriginGroupResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Resource status of the origin group. - """ + +class OriginGroupOverrideActionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OriginGroupOverrideActionParametersTypeName.""" + + DELIVERY_RULE_ORIGIN_GROUP_OVERRIDE_ACTION_PARAMETERS = "DeliveryRuleOriginGroupOverrideActionParameters" + + +class OriginGroupProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning status of the origin group.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + UPDATING = "Updating" + DELETING = "Deleting" + CREATING = "Creating" + + +class OriginGroupResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource status of the origin group.""" CREATING = "Creating" ACTIVE = "Active" DELETING = "Deleting" -class OriginResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Resource status of the origin. - """ + +class OriginProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning status of the origin.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + UPDATING = "Updating" + DELETING = "Deleting" + CREATING = "Creating" + + +class OriginResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource status of the origin.""" CREATING = "Creating" ACTIVE = "Active" DELETING = "Deleting" -class ParamIndicator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Indicates the purpose of the parameter - """ + +class ParamIndicator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the purpose of the parameter.""" EXPIRES = "Expires" KEY_ID = "KeyId" SIGNATURE = "Signature" -class PolicyEnabledState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """describes if the policy is in enabled state or disabled state - """ + +class PolicyEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """describes if the policy is in enabled state or disabled state.""" DISABLED = "Disabled" ENABLED = "Enabled" -class PolicyMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes if it is in detection mode or prevention mode at policy level. - """ + +class PolicyMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes if it is in detection mode or prevention mode at policy level.""" PREVENTION = "Prevention" DETECTION = "Detection" -class PolicyResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Resource status of the policy. - """ + +class PolicyResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource status of the policy.""" CREATING = "Creating" ENABLING = "Enabling" @@ -511,7 +639,8 @@ class PolicyResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DISABLED = "Disabled" DELETING = "Deleting" -class PolicySettingsDefaultCustomBlockResponseStatusCode(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): + +class PolicySettingsDefaultCustomBlockResponseStatusCode(int, Enum, metaclass=CaseInsensitiveEnumMeta): """If the action type is block, this field defines the default customer overridable http response status code. """ @@ -522,9 +651,15 @@ class PolicySettingsDefaultCustomBlockResponseStatusCode(with_metaclass(CaseInse FOUR_HUNDRED_SIX = 406 FOUR_HUNDRED_TWENTY_NINE = 429 -class PostArgsOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class PostArgsMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """PostArgsMatchConditionParametersTypeName.""" + + DELIVERY_RULE_POST_ARGS_CONDITION_PARAMETERS = "DeliveryRulePostArgsConditionParameters" + + +class PostArgsOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -537,9 +672,9 @@ class PostArgsOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class PrivateEndpointStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The approval status for the connection to the Private Link - """ + +class PrivateEndpointStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The approval status for the connection to the Private Link.""" PENDING = "Pending" APPROVED = "Approved" @@ -547,48 +682,59 @@ class PrivateEndpointStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DISCONNECTED = "Disconnected" TIMEOUT = "Timeout" -class ProbeProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Protocol to use for health probe. - """ + +class ProbeProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol to use for health probe.""" NOT_SET = "NotSet" HTTP = "Http" HTTPS = "Https" -class ProfileResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Resource status of the profile. - """ + +class ProfileProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning status of the profile.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + UPDATING = "Updating" + DELETING = "Deleting" + CREATING = "Creating" + + +class ProfileResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource status of the profile.""" CREATING = "Creating" ACTIVE = "Active" DELETING = "Deleting" DISABLED = "Disabled" -class ProtocolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Defines the TLS extension protocol that is used for secure delivery. - """ + +class ProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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)): - """Provisioning state of the WebApplicationFirewallPolicy. - """ + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the WebApplicationFirewallPolicy.""" CREATING = "Creating" SUCCEEDED = "Succeeded" FAILED = "Failed" -class QueryStringBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Caching behavior for the requests - """ + +class QueryStringBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Caching behavior for the requests.""" INCLUDE = "Include" INCLUDE_ALL = "IncludeAll" EXCLUDE = "Exclude" EXCLUDE_ALL = "ExcludeAll" -class QueryStringCachingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class QueryStringCachingBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -599,9 +745,15 @@ class QueryStringCachingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, En USE_QUERY_STRING = "UseQueryString" NOT_SET = "NotSet" -class QueryStringOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class QueryStringMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """QueryStringMatchConditionParametersTypeName.""" + + DELIVERY_RULE_QUERY_STRING_CONDITION_PARAMETERS = "DeliveryRuleQueryStringConditionParameters" + + +class QueryStringOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -614,26 +766,38 @@ class QueryStringOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class RedirectType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The redirect type the rule will use when redirecting traffic. - """ + +class RedirectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The redirect type the rule will use when redirecting traffic.""" MOVED = "Moved" FOUND = "Found" TEMPORARY_REDIRECT = "TemporaryRedirect" PERMANENT_REDIRECT = "PermanentRedirect" -class RemoteAddressOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class RemoteAddressMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RemoteAddressMatchConditionParametersTypeName.""" + + DELIVERY_RULE_REMOTE_ADDRESS_CONDITION_PARAMETERS = "DeliveryRuleRemoteAddressConditionParameters" + + +class RemoteAddressOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" IP_MATCH = "IPMatch" GEO_MATCH = "GeoMatch" -class RequestBodyOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class RequestBodyMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RequestBodyMatchConditionParametersTypeName.""" + + DELIVERY_RULE_REQUEST_BODY_CONDITION_PARAMETERS = "DeliveryRuleRequestBodyConditionParameters" + + +class RequestBodyOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -646,9 +810,15 @@ class RequestBodyOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class RequestHeaderOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class RequestHeaderMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RequestHeaderMatchConditionParametersTypeName.""" + + DELIVERY_RULE_REQUEST_HEADER_CONDITION_PARAMETERS = "DeliveryRuleRequestHeaderConditionParameters" + + +class RequestHeaderOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -661,7 +831,9 @@ class RequestHeaderOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class RequestMethodMatchConditionParametersMatchValuesItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class RequestMethodMatchConditionParametersMatchValuesItem(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RequestMethodMatchConditionParametersMatchValuesItem.""" GET = "GET" HEAD = "HEAD" @@ -671,20 +843,46 @@ class RequestMethodMatchConditionParametersMatchValuesItem(with_metaclass(CaseIn OPTIONS = "OPTIONS" TRACE = "TRACE" -class RequestMethodOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class RequestMethodMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RequestMethodMatchConditionParametersTypeName.""" + + DELIVERY_RULE_REQUEST_METHOD_CONDITION_PARAMETERS = "DeliveryRuleRequestMethodConditionParameters" + + +class RequestMethodOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" EQUAL = "Equal" -class RequestSchemeMatchConditionParametersMatchValuesItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class RequestSchemeMatchConditionParametersMatchValuesItem(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RequestSchemeMatchConditionParametersMatchValuesItem.""" HTTP = "HTTP" HTTPS = "HTTPS" -class RequestUriOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class RequestSchemeMatchConditionParametersOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" + + EQUAL = "Equal" + + +class RequestSchemeMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RequestSchemeMatchConditionParametersTypeName.""" + + DELIVERY_RULE_REQUEST_SCHEME_CONDITION_PARAMETERS = "DeliveryRuleRequestSchemeConditionParameters" + + +class RequestUriMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RequestUriMatchConditionParametersTypeName.""" + + DELIVERY_RULE_REQUEST_URI_CONDITION_PARAMETERS = "DeliveryRuleRequestUriConditionParameters" + + +class RequestUriOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -697,30 +895,45 @@ class RequestUriOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class ResourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of CDN resource used in CheckNameAvailability. - """ + +class ResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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 - """ + +class ResourceUsageUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Unit of the usage. e.g. count.""" + + COUNT = "count" + + +class ResponseBasedDetectedErrorTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of response errors for real user requests for which origin will be deemed unhealthy.""" NONE = "None" TCP_ERRORS_ONLY = "TcpErrorsOnly" TCP_AND_HTTP_ERRORS = "TcpAndHttpErrors" -class RuleCacheBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Caching behavior for the requests - """ + +class RouteConfigurationOverrideActionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RouteConfigurationOverrideActionParametersTypeName.""" + + DELIVERY_RULE_ROUTE_CONFIGURATION_OVERRIDE_ACTION_PARAMETERS = ( + "DeliveryRuleRouteConfigurationOverrideActionParameters" + ) + + +class RuleCacheBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Caching behavior for the requests.""" HONOR_ORIGIN = "HonorOrigin" OVERRIDE_ALWAYS = "OverrideAlways" OVERRIDE_IF_ORIGIN_MISSING = "OverrideIfOriginMissing" -class RuleIsCompressionEnabled(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class RuleIsCompressionEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -729,7 +942,8 @@ class RuleIsCompressionEnabled(with_metaclass(CaseInsensitiveEnumMeta, str, Enum ENABLED = "Enabled" DISABLED = "Disabled" -class RuleQueryStringCachingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class RuleQueryStringCachingBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. @@ -740,24 +954,30 @@ class RuleQueryStringCachingBehavior(with_metaclass(CaseInsensitiveEnumMeta, str IGNORE_SPECIFIED_QUERY_STRINGS = "IgnoreSpecifiedQueryStrings" INCLUDE_SPECIFIED_QUERY_STRINGS = "IncludeSpecifiedQueryStrings" -class SecretType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the secret resource. - """ + +class SecretType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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)): - """The type of the Security policy to create. - """ + +class SecurityPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the Security policy to create.""" WEB_APPLICATION_FIREWALL = "WebApplicationFirewall" -class ServerPortOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class ServerPortMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ServerPortMatchConditionParametersTypeName.""" + + DELIVERY_RULE_SERVER_PORT_CONDITION_PARAMETERS = "DeliveryRuleServerPortConditionParameters" + + +class ServerPortOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -770,7 +990,8 @@ class ServerPortOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class SharedPrivateLinkResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class SharedPrivateLinkResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status of the shared private link resource. Can be Pending, Approved, Rejected, Disconnected, or Timeout. """ @@ -781,9 +1002,9 @@ class SharedPrivateLinkResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, st DISCONNECTED = "Disconnected" TIMEOUT = "Timeout" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Name of the pricing tier. - """ + +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Name of the pricing tier.""" STANDARD_VERIZON = "Standard_Verizon" PREMIUM_VERIZON = "Premium_Verizon" @@ -799,39 +1020,51 @@ 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 SocketAddrOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class SocketAddrMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SocketAddrMatchConditionParametersTypeName.""" + + DELIVERY_RULE_SOCKET_ADDR_CONDITION_PARAMETERS = "DeliveryRuleSocketAddrConditionParameters" + + +class SocketAddrOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" IP_MATCH = "IPMatch" -class SslProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The protocol of an established TLS connection. - """ + +class SslProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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 - """ + +class SslProtocolMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SslProtocolMatchConditionParametersTypeName.""" + + DELIVERY_RULE_SSL_PROTOCOL_CONDITION_PARAMETERS = "DeliveryRuleSslProtocolConditionParameters" + + +class SslProtocolOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" EQUAL = "Equal" -class Status(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The validation status. - """ + +class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The validation status.""" VALID = "Valid" INVALID = "Invalid" ACCESS_DENIED = "AccessDenied" CERTIFICATE_EXPIRED = "CertificateExpired" -class Transform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes what transforms are applied before matching - """ + +class Transform(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes what transforms are applied before matching.""" LOWERCASE = "Lowercase" UPPERCASE = "Uppercase" @@ -840,9 +1073,9 @@ class Transform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): URL_ENCODE = "UrlEncode" REMOVE_NULLS = "RemoveNulls" -class TransformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes what transforms were applied before matching. - """ + +class TransformType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes what transforms were applied before matching.""" LOWERCASE = "Lowercase" UPPERCASE = "Uppercase" @@ -851,15 +1084,21 @@ class TransformType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): URL_ENCODE = "UrlEncode" REMOVE_NULLS = "RemoveNulls" -class UpdateRule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes the action that shall be taken when the certificate is updated in Key Vault. - """ + +class UpdateRule(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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)): - """Describes operator to be matched - """ + +class UrlFileExtensionMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """UrlFileExtensionMatchConditionParametersTypeName.""" + + DELIVERY_RULE_URL_FILE_EXTENSION_MATCH_CONDITION_PARAMETERS = "DeliveryRuleUrlFileExtensionMatchConditionParameters" + + +class UrlFileExtensionOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -872,9 +1111,15 @@ class UrlFileExtensionOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class UrlFileNameOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class UrlFileNameMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """UrlFileNameMatchConditionParametersTypeName.""" + + DELIVERY_RULE_URL_FILENAME_CONDITION_PARAMETERS = "DeliveryRuleUrlFilenameConditionParameters" + + +class UrlFileNameOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -887,9 +1132,15 @@ class UrlFileNameOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" REG_EX = "RegEx" -class UrlPathOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Describes operator to be matched - """ + +class UrlPathMatchConditionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """UrlPathMatchConditionParametersTypeName.""" + + DELIVERY_RULE_URL_PATH_MATCH_CONDITION_PARAMETERS = "DeliveryRuleUrlPathMatchConditionParameters" + + +class UrlPathOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes operator to be matched.""" ANY = "Any" EQUAL = "Equal" @@ -903,28 +1154,50 @@ class UrlPathOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): WILDCARD = "Wildcard" REG_EX = "RegEx" -class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """An enum describing the unit of measurement. - """ + +class UrlRedirectActionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """UrlRedirectActionParametersTypeName.""" + + DELIVERY_RULE_URL_REDIRECT_ACTION_PARAMETERS = "DeliveryRuleUrlRedirectActionParameters" + + +class UrlRewriteActionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """UrlRewriteActionParametersTypeName.""" + + DELIVERY_RULE_URL_REWRITE_ACTION_PARAMETERS = "DeliveryRuleUrlRewriteActionParameters" + + +class UrlSigningActionParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """UrlSigningActionParametersTypeName.""" + + DELIVERY_RULE_URL_SIGNING_ACTION_PARAMETERS = "DeliveryRuleUrlSigningActionParameters" + + +class UsageUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """An enum describing the unit of measurement.""" COUNT = "Count" -class WafAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class WafAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WafAction.""" ALLOW = "allow" BLOCK = "block" LOG = "log" REDIRECT = "redirect" -class WafGranularity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class WafGranularity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WafGranularity.""" PT5_M = "PT5M" PT1_H = "PT1H" P1_D = "P1D" -class WafMatchVariable(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Match variable to compare against. - """ + +class WafMatchVariable(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Match variable to compare against.""" REMOTE_ADDR = "RemoteAddr" SOCKET_ADDR = "SocketAddr" @@ -936,22 +1209,36 @@ class WafMatchVariable(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COOKIES = "Cookies" POST_ARGS = "PostArgs" -class WafMetric(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class WafMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WafMetric.""" CLIENT_REQUEST_COUNT = "clientRequestCount" -class WafMetricsResponseGranularity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class WafMetricsResponseGranularity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WafMetricsResponseGranularity.""" PT5_M = "PT5M" PT1_H = "PT1H" P1_D = "P1D" -class WafRankingGroupBy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class WafMetricsResponseSeriesItemUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WafMetricsResponseSeriesItemUnit.""" + + COUNT = "count" + + +class WafRankingGroupBy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WafRankingGroupBy.""" HTTP_STATUS_CODE = "httpStatusCode" CUSTOM_DOMAIN = "customDomain" -class WafRankingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class WafRankingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WafRankingType.""" ACTION = "action" RULE_GROUP = "ruleGroup" @@ -962,7 +1249,9 @@ class WafRankingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COUNTRY_OR_REGION = "countryOrRegion" RULE_TYPE = "ruleType" -class WafRuleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class WafRuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WafRuleType.""" MANAGED = "managed" CUSTOM = "custom" 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 70e07204b5e7..a711cfeaf34d 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 @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,15 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from .. import _serialization -from ._cdn_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class ActivatedResourceReference(msrest.serialization.Model): +class ActivatedResourceReference(_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. @@ -27,30 +29,25 @@ class ActivatedResourceReference(msrest.serialization.Model): """ _validation = { - 'is_active': {'readonly': True}, + "is_active": {"readonly": True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'is_active': {'key': 'isActive', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "is_active": {"key": "isActive", "type": "bool"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str """ - super(ActivatedResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.is_active = None -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """The core properties of ARM resources. Variables are only populated by the server, and will be ignored when sending a request. @@ -66,26 +63,22 @@ class Resource(msrest.serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -108,29 +101,25 @@ class ProxyResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) -class AFDDomain(ProxyResource): +class AFDDomain(ProxyResource): # pylint: disable=too-many-instance-attributes """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. @@ -154,16 +143,16 @@ class AFDDomain(ProxyResource): :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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "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", "Rejected", "TimedOut", - "PendingRevalidation", "Approved", "RefreshingValidationToken", "InternalError". + enabling/disabling process step by step. DCV stands for DomainControlValidation. Known values + are: "Unknown", "Submitting", "Pending", "Rejected", "TimedOut", "PendingRevalidation", + "Approved", "RefreshingValidationToken", and "InternalError". :vartype domain_validation_state: str or ~azure.mgmt.cdn.models.DomainValidationState :ivar host_name: The host name of the domain. Must be a domain name. :vartype host_name: str @@ -172,39 +161,42 @@ class AFDDomain(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - '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}, - 'validation_properties': {'readonly': True}, + "id": {"readonly": True}, + "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}, + "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'}, - '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'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'validation_properties': {'key': 'properties.validationProperties', 'type': 'DomainValidationProperties'}, + "id": {"key": "id", "type": "str"}, + "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"}, + "host_name": {"key": "properties.hostName", "type": "str"}, + "validation_properties": {"key": "properties.validationProperties", "type": "DomainValidationProperties"}, } def __init__( self, *, - tls_settings: Optional["AFDDomainHttpsParameters"] = None, - azure_dns_zone: Optional["ResourceReference"] = None, - pre_validated_custom_domain_resource_id: Optional["ResourceReference"] = None, + tls_settings: Optional["_models.AFDDomainHttpsParameters"] = None, + azure_dns_zone: Optional["_models.ResourceReference"] = None, + pre_validated_custom_domain_resource_id: Optional["_models.ResourceReference"] = None, host_name: Optional[str] = None, **kwargs ): @@ -221,7 +213,7 @@ def __init__( :keyword host_name: The host name of the domain. Must be a domain name. :paramtype host_name: str """ - super(AFDDomain, self).__init__(**kwargs) + super().__init__(**kwargs) self.profile_name = None self.tls_settings = tls_settings self.azure_dns_zone = azure_dns_zone @@ -233,56 +225,56 @@ def __init__( self.validation_properties = None -class AFDDomainHttpsParameters(msrest.serialization.Model): +class AFDDomainHttpsParameters(_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. - :ivar certificate_type: Required. Defines the source of the SSL certificate. Possible values - include: "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :ivar certificate_type: Defines the source of the SSL certificate. Required. Known values are: + "CustomerCertificate", "ManagedCertificate", and "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". + :ivar minimum_tls_version: TLS protocol version that will be used for Https. Known values are: + "TLS10" and "TLS12". :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 = { - 'certificate_type': {'required': True}, + "certificate_type": {"required": True}, } _attribute_map = { - 'certificate_type': {'key': 'certificateType', 'type': 'str'}, - 'minimum_tls_version': {'key': 'minimumTlsVersion', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'ResourceReference'}, + "certificate_type": {"key": "certificateType", "type": "str"}, + "minimum_tls_version": {"key": "minimumTlsVersion", "type": "str"}, + "secret": {"key": "secret", "type": "ResourceReference"}, } def __init__( self, *, - certificate_type: Union[str, "AfdCertificateType"], - minimum_tls_version: Optional[Union[str, "AfdMinimumTlsVersion"]] = None, - secret: Optional["ResourceReference"] = None, + certificate_type: Union[str, "_models.AfdCertificateType"], + minimum_tls_version: Optional[Union[str, "_models.AfdMinimumTlsVersion"]] = None, + secret: Optional["_models.ResourceReference"] = None, **kwargs ): """ - :keyword certificate_type: Required. Defines the source of the SSL certificate. Possible values - include: "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :keyword certificate_type: Defines the source of the SSL certificate. Required. Known values + are: "CustomerCertificate", "ManagedCertificate", and "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". + :keyword minimum_tls_version: TLS protocol version that will be used for Https. Known values + are: "TLS10" and "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) + super().__init__(**kwargs) self.certificate_type = certificate_type self.minimum_tls_version = minimum_tls_version self.secret = secret -class AFDDomainListResult(msrest.serialization.Model): +class AFDDomainListResult(_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. @@ -294,64 +286,55 @@ class AFDDomainListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AFDDomain]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AFDDomain]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class AFDStateProperties(msrest.serialization.Model): +class AFDStateProperties(_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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "deployment_status": {"readonly": True}, } _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_status": {"key": "deploymentStatus", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(AFDStateProperties, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.provisioning_state = None self.deployment_status = None -class AFDDomainUpdatePropertiesParameters(msrest.serialization.Model): +class AFDDomainUpdatePropertiesParameters(_serialization.Model): """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. @@ -370,22 +353,25 @@ class AFDDomainUpdatePropertiesParameters(msrest.serialization.Model): """ _validation = { - 'profile_name': {'readonly': True}, + "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'}, + "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__( self, *, - tls_settings: Optional["AFDDomainHttpsParameters"] = None, - azure_dns_zone: Optional["ResourceReference"] = None, - pre_validated_custom_domain_resource_id: Optional["ResourceReference"] = None, + tls_settings: Optional["_models.AFDDomainHttpsParameters"] = None, + azure_dns_zone: Optional["_models.ResourceReference"] = None, + pre_validated_custom_domain_resource_id: Optional["_models.ResourceReference"] = None, **kwargs ): """ @@ -399,7 +385,7 @@ def __init__( where custom domain ownership was prevalidated. :paramtype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference """ - super(AFDDomainUpdatePropertiesParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.profile_name = None self.tls_settings = tls_settings self.azure_dns_zone = azure_dns_zone @@ -413,10 +399,10 @@ class AFDDomainProperties(AFDDomainUpdatePropertiesParameters, AFDStatePropertie 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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar profile_name: The name of the profile which holds the domain. @@ -431,44 +417,47 @@ class AFDDomainProperties(AFDDomainUpdatePropertiesParameters, AFDStatePropertie 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", "Rejected", "TimedOut", - "PendingRevalidation", "Approved", "RefreshingValidationToken", "InternalError". + enabling/disabling process step by step. DCV stands for DomainControlValidation. Known values + are: "Unknown", "Submitting", "Pending", "Rejected", "TimedOut", "PendingRevalidation", + "Approved", "RefreshingValidationToken", and "InternalError". :vartype domain_validation_state: str or ~azure.mgmt.cdn.models.DomainValidationState - :ivar host_name: Required. The host name of the domain. Must be a domain name. + :ivar host_name: The host name of the domain. Must be a domain name. Required. :vartype 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}, - 'profile_name': {'readonly': True}, - 'domain_validation_state': {'readonly': True}, - 'host_name': {'required': True}, - 'validation_properties': {'readonly': True}, + "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}, } _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'}, + "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"}, } def __init__( self, *, host_name: str, - tls_settings: Optional["AFDDomainHttpsParameters"] = None, - azure_dns_zone: Optional["ResourceReference"] = None, - pre_validated_custom_domain_resource_id: Optional["ResourceReference"] = None, + tls_settings: Optional["_models.AFDDomainHttpsParameters"] = None, + azure_dns_zone: Optional["_models.ResourceReference"] = None, + pre_validated_custom_domain_resource_id: Optional["_models.ResourceReference"] = None, **kwargs ): """ @@ -481,10 +470,15 @@ def __init__( :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. + :keyword host_name: The host name of the domain. Must be a domain name. Required. :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) + super().__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 @@ -494,12 +488,9 @@ def __init__( 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 -class AFDDomainUpdateParameters(msrest.serialization.Model): +class AFDDomainUpdateParameters(_serialization.Model): """The domain JSON object required for domain creation or update. Variables are only populated by the server, and will be ignored when sending a request. @@ -518,22 +509,25 @@ class AFDDomainUpdateParameters(msrest.serialization.Model): """ _validation = { - 'profile_name': {'readonly': True}, + "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'}, + "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__( self, *, - tls_settings: Optional["AFDDomainHttpsParameters"] = None, - azure_dns_zone: Optional["ResourceReference"] = None, - pre_validated_custom_domain_resource_id: Optional["ResourceReference"] = None, + tls_settings: Optional["_models.AFDDomainHttpsParameters"] = None, + azure_dns_zone: Optional["_models.ResourceReference"] = None, + pre_validated_custom_domain_resource_id: Optional["_models.ResourceReference"] = None, **kwargs ): """ @@ -547,7 +541,7 @@ def __init__( where custom domain ownership was prevalidated. :paramtype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference """ - super(AFDDomainUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.profile_name = None self.tls_settings = tls_settings self.azure_dns_zone = azure_dns_zone @@ -569,48 +563,42 @@ class TrackedResource(Resource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, + "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}'}, + "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, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ - super(TrackedResource, self).__init__(**kwargs) + super().__init__(**kwargs) self.location = location self.tags = tags -class AFDEndpoint(TrackedResource): +class AFDEndpoint(TrackedResource): # pylint: disable=too-many-instance-attributes """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. @@ -625,56 +613,59 @@ class AFDEndpoint(TrackedResource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar 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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "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". + default value is TenantReuse. Known values are: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", and "NoReuse". :vartype auto_generated_domain_name_label_scope: str or ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'profile_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'host_name': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "profile_name": {"readonly": True}, + "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}'}, - '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'}, + "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}"}, + "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__( @@ -682,25 +673,27 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - enabled_state: Optional[Union[str, "EnabledState"]] = None, - auto_generated_domain_name_label_scope: Optional[Union[str, "AutoGeneratedDomainNameLabelScope"]] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, + auto_generated_domain_name_label_scope: Optional[ + Union[str, "_models.AutoGeneratedDomainNameLabelScope"] + ] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword 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". + 'Disabled'. Known values are: "Enabled" and "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". + default value is TenantReuse. Known values are: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", and "NoReuse". :paramtype auto_generated_domain_name_label_scope: str or ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope """ - super(AFDEndpoint, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.profile_name = None self.enabled_state = enabled_state self.provisioning_state = None @@ -709,7 +702,7 @@ def __init__( self.auto_generated_domain_name_label_scope = auto_generated_domain_name_label_scope -class AFDEndpointListResult(msrest.serialization.Model): +class AFDEndpointListResult(_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. @@ -721,30 +714,25 @@ class AFDEndpointListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AFDEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AFDEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class AFDEndpointPropertiesUpdateParameters(msrest.serialization.Model): +class AFDEndpointPropertiesUpdateParameters(_serialization.Model): """The JSON object containing endpoint update parameters. Variables are only populated by the server, and will be ignored when sending a request. @@ -752,150 +740,145 @@ class AFDEndpointPropertiesUpdateParameters(msrest.serialization.Model): :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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ _validation = { - 'profile_name': {'readonly': True}, + "profile_name": {"readonly": True}, } _attribute_map = { - 'profile_name': {'key': 'profileName', 'type': 'str'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + "profile_name": {"key": "profileName", "type": "str"}, + "enabled_state": {"key": "enabledState", "type": "str"}, } - def __init__( - self, - *, - enabled_state: Optional[Union[str, "EnabledState"]] = None, - **kwargs - ): + def __init__(self, *, enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs): """ :keyword enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or - 'Disabled'. Possible values include: "Enabled", "Disabled". + 'Disabled'. Known values are: "Enabled" and "Disabled". :paramtype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ - super(AFDEndpointPropertiesUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.profile_name = None self.enabled_state = enabled_state -class AFDEndpointProperties(AFDStateProperties, AFDEndpointPropertiesUpdateParameters): +class AFDEndpointProperties(AFDEndpointPropertiesUpdateParameters, AFDStateProperties): """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. + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and + "Failed". + :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :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", - "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". + default value is TenantReuse. Known values are: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", and "NoReuse". :vartype auto_generated_domain_name_label_scope: str or ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope """ _validation = { - 'profile_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'host_name': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "deployment_status": {"readonly": True}, + "profile_name": {"readonly": True}, + "host_name": {"readonly": True}, } _attribute_map = { - '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'}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_status": {"key": "deploymentStatus", "type": "str"}, + "profile_name": {"key": "profileName", "type": "str"}, + "enabled_state": {"key": "enabledState", "type": "str"}, + "host_name": {"key": "hostName", "type": "str"}, + "auto_generated_domain_name_label_scope": {"key": "autoGeneratedDomainNameLabelScope", "type": "str"}, } def __init__( self, *, - enabled_state: Optional[Union[str, "EnabledState"]] = None, - auto_generated_domain_name_label_scope: Optional[Union[str, "AutoGeneratedDomainNameLabelScope"]] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, + auto_generated_domain_name_label_scope: Optional[ + Union[str, "_models.AutoGeneratedDomainNameLabelScope"] + ] = None, **kwargs ): """ :keyword enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or - 'Disabled'. Possible values include: "Enabled", "Disabled". + 'Disabled'. Known values are: "Enabled" and "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". + default value is TenantReuse. Known values are: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", and "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 + super().__init__(enabled_state=enabled_state, **kwargs) 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 + self.profile_name = None + self.enabled_state = enabled_state -class AFDEndpointUpdateParameters(msrest.serialization.Model): +class AFDEndpointUpdateParameters(_serialization.Model): """Properties required to create or update an endpoint. Variables are only populated by the server, and will be ignored when sending a request. - :ivar tags: A set of tags. Endpoint tags. + :ivar 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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ _validation = { - 'profile_name': {'readonly': True}, + "profile_name": {"readonly": True}, } _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, + "tags": {"key": "tags", "type": "{str}"}, + "profile_name": {"key": "properties.profileName", "type": "str"}, + "enabled_state": {"key": "properties.enabledState", "type": "str"}, } def __init__( self, *, tags: Optional[Dict[str, str]] = None, - enabled_state: Optional[Union[str, "EnabledState"]] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs ): """ - :keyword tags: A set of tags. Endpoint tags. + :keyword 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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :paramtype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ - super(AFDEndpointUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.profile_name = None self.enabled_state = enabled_state -class AfdErrorResponse(msrest.serialization.Model): +class AfdErrorResponse(_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.). :ivar error: The error object. @@ -903,24 +886,19 @@ class AfdErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, + "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__( - self, - *, - error: Optional["ErrorDetail"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): """ :keyword error: The error object. :paramtype error: ~azure.mgmt.cdn.models.ErrorDetail """ - super(AfdErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class AFDOrigin(ProxyResource): +class AFDOrigin(ProxyResource): # pylint: disable=too-many-instance-attributes """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. @@ -962,65 +940,68 @@ class AFDOrigin(ProxyResource): ~azure.mgmt.cdn.models.SharedPrivateLinkResourceProperties :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". + enabled backend pool. Known values are: "Enabled" and "Disabled". :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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "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}, - 'origin_group_name': {'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'}, - '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'}, - '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': 'SharedPrivateLinkResourceProperties'}, - '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'}, + "id": {"readonly": True}, + "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}, + "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"}, + "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"}, + "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": "SharedPrivateLinkResourceProperties", + }, + "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"}, } def __init__( self, *, - azure_origin: Optional["ResourceReference"] = None, + azure_origin: Optional["_models.ResourceReference"] = None, host_name: Optional[str] = None, http_port: Optional[int] = None, https_port: Optional[int] = None, origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, - shared_private_link_resource: Optional["SharedPrivateLinkResourceProperties"] = None, - enabled_state: Optional[Union[str, "EnabledState"]] = None, - enforce_certificate_name_check: Optional[bool] = True, + shared_private_link_resource: Optional["_models.SharedPrivateLinkResourceProperties"] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, + enforce_certificate_name_check: bool = True, **kwargs ): """ @@ -1051,13 +1032,13 @@ def __init__( ~azure.mgmt.cdn.models.SharedPrivateLinkResourceProperties :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". + single enabled backend pool. Known values are: "Enabled" and "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) + super().__init__(**kwargs) self.origin_group_name = None self.azure_origin = azure_origin self.host_name = host_name @@ -1073,7 +1054,7 @@ def __init__( self.deployment_status = None -class AFDOriginGroup(ProxyResource): +class AFDOriginGroup(ProxyResource): # pylint: disable=too-many-instance-attributes """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. @@ -1098,48 +1079,54 @@ class AFDOriginGroup(ProxyResource): endpoint is added. Default is 10 mins. This property is currently not supported. :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int :ivar session_affinity_state: Whether to allow session affinity on this host. Valid options are - 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + 'Enabled' or 'Disabled'. Known values are: "Enabled" and "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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "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}, - '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}, + "id": {"readonly": True}, + "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}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - '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'}, - 'session_affinity_state': {'key': 'properties.sessionAffinityState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "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", + }, + "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, *, - load_balancing_settings: Optional["LoadBalancingSettingsParameters"] = None, - health_probe_settings: Optional["HealthProbeParameters"] = None, + load_balancing_settings: Optional["_models.LoadBalancingSettingsParameters"] = None, + health_probe_settings: Optional["_models.HealthProbeParameters"] = None, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Optional[int] = None, - session_affinity_state: Optional[Union[str, "EnabledState"]] = None, + session_affinity_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs ): """ @@ -1153,20 +1140,22 @@ def __init__( 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 session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + are 'Enabled' or 'Disabled'. Known values are: "Enabled" and "Disabled". :paramtype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState """ - super(AFDOriginGroup, self).__init__(**kwargs) + super().__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 + self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = ( + traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + ) self.session_affinity_state = session_affinity_state self.provisioning_state = None self.deployment_status = None -class AFDOriginGroupListResult(msrest.serialization.Model): +class AFDOriginGroupListResult(_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. @@ -1178,30 +1167,25 @@ class AFDOriginGroupListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AFDOriginGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AFDOriginGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class AFDOriginGroupUpdatePropertiesParameters(msrest.serialization.Model): +class AFDOriginGroupUpdatePropertiesParameters(_serialization.Model): """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. @@ -1218,30 +1202,33 @@ class AFDOriginGroupUpdatePropertiesParameters(msrest.serialization.Model): endpoint is added. Default is 10 mins. This property is currently not supported. :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int :ivar session_affinity_state: Whether to allow session affinity on this host. Valid options are - 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + 'Enabled' or 'Disabled'. Known values are: "Enabled" and "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}, + "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'}, - 'session_affinity_state': {'key': 'sessionAffinityState', 'type': 'str'}, + "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", + }, + "session_affinity_state": {"key": "sessionAffinityState", "type": "str"}, } def __init__( self, *, - load_balancing_settings: Optional["LoadBalancingSettingsParameters"] = None, - health_probe_settings: Optional["HealthProbeParameters"] = None, + load_balancing_settings: Optional["_models.LoadBalancingSettingsParameters"] = None, + health_probe_settings: Optional["_models.HealthProbeParameters"] = None, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Optional[int] = None, - session_affinity_state: Optional[Union[str, "EnabledState"]] = None, + session_affinity_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs ): """ @@ -1255,22 +1242,30 @@ def __init__( 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 session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + are 'Enabled' or 'Disabled'. Known values are: "Enabled" and "Disabled". :paramtype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState """ - super(AFDOriginGroupUpdatePropertiesParameters, self).__init__(**kwargs) + super().__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 + self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = ( + traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + ) self.session_affinity_state = session_affinity_state -class AFDOriginGroupProperties(AFDStateProperties, AFDOriginGroupUpdatePropertiesParameters): +class AFDOriginGroupProperties(AFDOriginGroupUpdatePropertiesParameters, AFDStateProperties): """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. + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and + "Failed". + :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :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. @@ -1283,40 +1278,37 @@ class AFDOriginGroupProperties(AFDStateProperties, AFDOriginGroupUpdatePropertie endpoint is added. Default is 10 mins. This property is currently not supported. :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int :ivar session_affinity_state: Whether to allow session affinity on this host. Valid options are - 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + 'Enabled' or 'Disabled'. Known values are: "Enabled" and "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", - "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}, + "provisioning_state": {"readonly": True}, + "deployment_status": {"readonly": True}, + "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'}, - 'session_affinity_state': {'key': 'sessionAffinityState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_status": {"key": "deploymentStatus", "type": "str"}, + "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", + }, + "session_affinity_state": {"key": "sessionAffinityState", "type": "str"}, } def __init__( self, *, - load_balancing_settings: Optional["LoadBalancingSettingsParameters"] = None, - health_probe_settings: Optional["HealthProbeParameters"] = None, + load_balancing_settings: Optional["_models.LoadBalancingSettingsParameters"] = None, + health_probe_settings: Optional["_models.HealthProbeParameters"] = None, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Optional[int] = None, - session_affinity_state: Optional[Union[str, "EnabledState"]] = None, + session_affinity_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs ): """ @@ -1330,20 +1322,28 @@ def __init__( 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 session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + are 'Enabled' or 'Disabled'. Known values are: "Enabled" and "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, session_affinity_state=session_affinity_state, **kwargs) + super().__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, + session_affinity_state=session_affinity_state, + **kwargs + ) + self.provisioning_state = None + self.deployment_status = None 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 + self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = ( + traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + ) self.session_affinity_state = session_affinity_state - self.provisioning_state = None - self.deployment_status = None -class AFDOriginGroupUpdateParameters(msrest.serialization.Model): +class AFDOriginGroupUpdateParameters(_serialization.Model): """AFDOrigin group properties needed for origin group creation or update. Variables are only populated by the server, and will be ignored when sending a request. @@ -1360,30 +1360,36 @@ class AFDOriginGroupUpdateParameters(msrest.serialization.Model): endpoint is added. Default is 10 mins. This property is currently not supported. :vartype traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: int :ivar session_affinity_state: Whether to allow session affinity on this host. Valid options are - 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + 'Enabled' or 'Disabled'. Known values are: "Enabled" and "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}, + "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'}, - 'session_affinity_state': {'key': 'properties.sessionAffinityState', 'type': 'str'}, + "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", + }, + "session_affinity_state": {"key": "properties.sessionAffinityState", "type": "str"}, } def __init__( self, *, - load_balancing_settings: Optional["LoadBalancingSettingsParameters"] = None, - health_probe_settings: Optional["HealthProbeParameters"] = None, + load_balancing_settings: Optional["_models.LoadBalancingSettingsParameters"] = None, + health_probe_settings: Optional["_models.HealthProbeParameters"] = None, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Optional[int] = None, - session_affinity_state: Optional[Union[str, "EnabledState"]] = None, + session_affinity_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs ): """ @@ -1397,18 +1403,20 @@ def __init__( 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 session_affinity_state: Whether to allow session affinity on this host. Valid options - are 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". + are 'Enabled' or 'Disabled'. Known values are: "Enabled" and "Disabled". :paramtype session_affinity_state: str or ~azure.mgmt.cdn.models.EnabledState """ - super(AFDOriginGroupUpdateParameters, self).__init__(**kwargs) + super().__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 + self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = ( + traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + ) self.session_affinity_state = session_affinity_state -class AFDOriginListResult(msrest.serialization.Model): +class AFDOriginListResult(_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. @@ -1420,30 +1428,25 @@ class AFDOriginListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AFDOrigin]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[AFDOrigin]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class AFDOriginUpdatePropertiesParameters(msrest.serialization.Model): +class AFDOriginUpdatePropertiesParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """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. @@ -1477,47 +1480,50 @@ class AFDOriginUpdatePropertiesParameters(msrest.serialization.Model): ~azure.mgmt.cdn.models.SharedPrivateLinkResourceProperties :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". + enabled backend pool. Known values are: "Enabled" and "Disabled". :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}, - 'weight': {'maximum': 1000, 'minimum': 1}, + "origin_group_name": {"readonly": True}, + "http_port": {"maximum": 65535, "minimum": 1}, + "https_port": {"maximum": 65535, "minimum": 1}, + "priority": {"maximum": 5, "minimum": 1}, + "weight": {"maximum": 1000, "minimum": 1}, } _attribute_map = { - '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'}, - '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': 'SharedPrivateLinkResourceProperties'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'enforce_certificate_name_check': {'key': 'enforceCertificateNameCheck', 'type': 'bool'}, + "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"}, + "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": "SharedPrivateLinkResourceProperties", + }, + "enabled_state": {"key": "enabledState", "type": "str"}, + "enforce_certificate_name_check": {"key": "enforceCertificateNameCheck", "type": "bool"}, } def __init__( self, *, - azure_origin: Optional["ResourceReference"] = None, + azure_origin: Optional["_models.ResourceReference"] = None, host_name: Optional[str] = None, http_port: Optional[int] = None, https_port: Optional[int] = None, origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, - shared_private_link_resource: Optional["SharedPrivateLinkResourceProperties"] = None, - enabled_state: Optional[Union[str, "EnabledState"]] = None, - enforce_certificate_name_check: Optional[bool] = True, + shared_private_link_resource: Optional["_models.SharedPrivateLinkResourceProperties"] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, + enforce_certificate_name_check: bool = True, **kwargs ): """ @@ -1548,13 +1554,13 @@ def __init__( ~azure.mgmt.cdn.models.SharedPrivateLinkResourceProperties :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". + single enabled backend pool. Known values are: "Enabled" and "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) + super().__init__(**kwargs) self.origin_group_name = None self.azure_origin = azure_origin self.host_name = host_name @@ -1568,11 +1574,19 @@ def __init__( self.enforce_certificate_name_check = enforce_certificate_name_check -class AFDOriginProperties(AFDStateProperties, AFDOriginUpdatePropertiesParameters): +class AFDOriginProperties( + AFDOriginUpdatePropertiesParameters, AFDStateProperties +): # pylint: disable=too-many-instance-attributes """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. + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and + "Failed". + :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :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. @@ -1602,57 +1616,54 @@ class AFDOriginProperties(AFDStateProperties, AFDOriginUpdatePropertiesParameter ~azure.mgmt.cdn.models.SharedPrivateLinkResourceProperties :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". + enabled backend pool. Known values are: "Enabled" and "Disabled". :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", - "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}, - 'weight': {'maximum': 1000, 'minimum': 1}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "deployment_status": {"readonly": True}, + "origin_group_name": {"readonly": True}, + "http_port": {"maximum": 65535, "minimum": 1}, + "https_port": {"maximum": 65535, "minimum": 1}, + "priority": {"maximum": 5, "minimum": 1}, + "weight": {"maximum": 1000, "minimum": 1}, } _attribute_map = { - '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'}, - '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': 'SharedPrivateLinkResourceProperties'}, - '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'}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_status": {"key": "deploymentStatus", "type": "str"}, + "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"}, + "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": "SharedPrivateLinkResourceProperties", + }, + "enabled_state": {"key": "enabledState", "type": "str"}, + "enforce_certificate_name_check": {"key": "enforceCertificateNameCheck", "type": "bool"}, } def __init__( self, *, - azure_origin: Optional["ResourceReference"] = None, + azure_origin: Optional["_models.ResourceReference"] = None, host_name: Optional[str] = None, http_port: Optional[int] = None, https_port: Optional[int] = None, origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, - shared_private_link_resource: Optional["SharedPrivateLinkResourceProperties"] = None, - enabled_state: Optional[Union[str, "EnabledState"]] = None, - enforce_certificate_name_check: Optional[bool] = True, + shared_private_link_resource: Optional["_models.SharedPrivateLinkResourceProperties"] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, + enforce_certificate_name_check: bool = True, **kwargs ): """ @@ -1683,13 +1694,27 @@ def __init__( ~azure.mgmt.cdn.models.SharedPrivateLinkResourceProperties :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". + single enabled backend pool. Known values are: "Enabled" and "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) + super().__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.provisioning_state = None + self.deployment_status = None self.origin_group_name = None self.azure_origin = azure_origin self.host_name = host_name @@ -1701,11 +1726,9 @@ def __init__( 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 AFDOriginUpdateParameters(msrest.serialization.Model): +class AFDOriginUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """AFDOrigin properties needed for origin update. Variables are only populated by the server, and will be ignored when sending a request. @@ -1739,47 +1762,50 @@ class AFDOriginUpdateParameters(msrest.serialization.Model): ~azure.mgmt.cdn.models.SharedPrivateLinkResourceProperties :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". + enabled backend pool. Known values are: "Enabled" and "Disabled". :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}, - 'weight': {'maximum': 1000, 'minimum': 1}, + "origin_group_name": {"readonly": True}, + "http_port": {"maximum": 65535, "minimum": 1}, + "https_port": {"maximum": 65535, "minimum": 1}, + "priority": {"maximum": 5, "minimum": 1}, + "weight": {"maximum": 1000, "minimum": 1}, } _attribute_map = { - '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'}, - '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': 'SharedPrivateLinkResourceProperties'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - 'enforce_certificate_name_check': {'key': 'properties.enforceCertificateNameCheck', 'type': 'bool'}, + "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"}, + "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": "SharedPrivateLinkResourceProperties", + }, + "enabled_state": {"key": "properties.enabledState", "type": "str"}, + "enforce_certificate_name_check": {"key": "properties.enforceCertificateNameCheck", "type": "bool"}, } def __init__( self, *, - azure_origin: Optional["ResourceReference"] = None, + azure_origin: Optional["_models.ResourceReference"] = None, host_name: Optional[str] = None, http_port: Optional[int] = None, https_port: Optional[int] = None, origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, - shared_private_link_resource: Optional["SharedPrivateLinkResourceProperties"] = None, - enabled_state: Optional[Union[str, "EnabledState"]] = None, - enforce_certificate_name_check: Optional[bool] = True, + shared_private_link_resource: Optional["_models.SharedPrivateLinkResourceProperties"] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, + enforce_certificate_name_check: bool = True, **kwargs ): """ @@ -1810,13 +1836,13 @@ def __init__( ~azure.mgmt.cdn.models.SharedPrivateLinkResourceProperties :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". + single enabled backend pool. Known values are: "Enabled" and "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) + super().__init__(**kwargs) self.origin_group_name = None self.azure_origin = azure_origin self.host_name = host_name @@ -1830,53 +1856,47 @@ def __init__( self.enforce_certificate_name_check = enforce_certificate_name_check -class AfdPurgeParameters(msrest.serialization.Model): +class AfdPurgeParameters(_serialization.Model): """Parameters required for content purge. All required parameters must be populated in order to send to Azure. - :ivar content_paths: Required. The path to the content to be purged. Can describe a file path - or a wild card directory. + :ivar content_paths: The path to the content to be purged. Can describe a file path or a wild + card directory. Required. :vartype content_paths: list[str] :ivar domains: List of domains. :vartype domains: list[str] """ _validation = { - 'content_paths': {'required': True}, + "content_paths": {"required": True}, } _attribute_map = { - 'content_paths': {'key': 'contentPaths', 'type': '[str]'}, - 'domains': {'key': 'domains', 'type': '[str]'}, + "content_paths": {"key": "contentPaths", "type": "[str]"}, + "domains": {"key": "domains", "type": "[str]"}, } - def __init__( - self, - *, - content_paths: List[str], - domains: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, content_paths: List[str], 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. + :keyword content_paths: The path to the content to be purged. Can describe a file path or a + wild card directory. Required. :paramtype content_paths: list[str] :keyword domains: List of domains. :paramtype domains: list[str] """ - super(AfdPurgeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_paths = content_paths self.domains = domains -class AfdRouteCacheConfiguration(msrest.serialization.Model): +class AfdRouteCacheConfiguration(_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", + every request with a unique URL, or cache specific query strings. Known values are: + "IgnoreQueryString", "UseQueryString", "IgnoreSpecifiedQueryStrings", and "IncludeSpecifiedQueryStrings". :vartype query_string_caching_behavior: str or ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior @@ -1887,24 +1907,24 @@ class AfdRouteCacheConfiguration(msrest.serialization.Model): """ _attribute_map = { - 'query_string_caching_behavior': {'key': 'queryStringCachingBehavior', 'type': 'str'}, - 'query_parameters': {'key': 'queryParameters', 'type': 'str'}, - 'compression_settings': {'key': 'compressionSettings', 'type': 'CompressionSettings'}, + "query_string_caching_behavior": {"key": "queryStringCachingBehavior", "type": "str"}, + "query_parameters": {"key": "queryParameters", "type": "str"}, + "compression_settings": {"key": "compressionSettings", "type": "CompressionSettings"}, } def __init__( self, *, - query_string_caching_behavior: Optional[Union[str, "AfdQueryStringCachingBehavior"]] = None, + query_string_caching_behavior: Optional[Union[str, "_models.AfdQueryStringCachingBehavior"]] = None, query_parameters: Optional[str] = None, - compression_settings: Optional["CompressionSettings"] = None, + compression_settings: Optional["_models.CompressionSettings"] = 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", + cache every request with a unique URL, or cache specific query strings. Known values are: + "IgnoreQueryString", "UseQueryString", "IgnoreSpecifiedQueryStrings", and "IncludeSpecifiedQueryStrings". :paramtype query_string_caching_behavior: str or ~azure.mgmt.cdn.models.AfdQueryStringCachingBehavior @@ -1913,19 +1933,19 @@ def __init__( :keyword compression_settings: compression settings. :paramtype compression_settings: ~azure.mgmt.cdn.models.CompressionSettings """ - super(AfdRouteCacheConfiguration, self).__init__(**kwargs) + super().__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): +class Certificate(_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". + :ivar type: The type of the secret resource. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". :vartype type: str or ~azure.mgmt.cdn.models.SecretType :ivar subject: Subject name in the certificate. :vartype subject: str @@ -1934,28 +1954,23 @@ class Certificate(msrest.serialization.Model): """ _validation = { - 'subject': {'readonly': True}, - 'expiration_date': {'readonly': 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'}, + "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 - ): + def __init__(self, *, type: Optional[Union[str, "_models.SecretType"]] = None, **kwargs): """ - :keyword type: The type of the secret resource. Possible values include: "UrlSigningKey", - "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :keyword type: The type of the secret resource. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". :paramtype type: str or ~azure.mgmt.cdn.models.SecretType """ - super(Certificate, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type self.subject = None self.expiration_date = None @@ -1966,8 +1981,8 @@ class AzureFirstPartyManagedCertificate(Certificate): 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". + :ivar type: The type of the secret resource. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". :vartype type: str or ~azure.mgmt.cdn.models.SecretType :ivar subject: Subject name in the certificate. :vartype subject: str @@ -1976,63 +1991,59 @@ class AzureFirstPartyManagedCertificate(Certificate): """ _validation = { - 'subject': {'readonly': True}, - 'expiration_date': {'readonly': 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'}, + "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 - ): + def __init__(self, *, type: Optional[Union[str, "_models.SecretType"]] = None, **kwargs): """ - :keyword type: The type of the secret resource. Possible values include: "UrlSigningKey", - "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :keyword type: The type of the secret resource. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". :paramtype type: str or ~azure.mgmt.cdn.models.SecretType """ - super(AzureFirstPartyManagedCertificate, self).__init__(type=type, **kwargs) + super().__init__(type=type, **kwargs) -class SecretParameters(msrest.serialization.Model): +class SecretParameters(_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. + 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". + :ivar type: The type of the secret resource. Required. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". :vartype type: str or ~azure.mgmt.cdn.models.SecretType """ _validation = { - 'type': {'required': True}, + "type": {"required": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, } _subtype_map = { - 'type': {'AzureFirstPartyManagedCertificate': 'AzureFirstPartyManagedCertificateParameters', 'CustomerCertificate': 'CustomerCertificateParameters', 'ManagedCertificate': 'ManagedCertificateParameters', 'UrlSigningKey': 'UrlSigningKeyParameters'} + "type": { + "AzureFirstPartyManagedCertificate": "AzureFirstPartyManagedCertificateParameters", + "CustomerCertificate": "CustomerCertificateParameters", + "ManagedCertificate": "ManagedCertificateParameters", + "UrlSigningKey": "UrlSigningKeyParameters", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(SecretParameters, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.type = None # type: Optional[str] @@ -2041,37 +2052,32 @@ class AzureFirstPartyManagedCertificateParameters(SecretParameters): 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". + :ivar type: The type of the secret resource. Required. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". :vartype type: str or ~azure.mgmt.cdn.models.SecretType """ _validation = { - 'type': {'required': True}, + "type": {"required": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(AzureFirstPartyManagedCertificateParameters, self).__init__(**kwargs) - self.type = 'AzureFirstPartyManagedCertificate' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.type = "AzureFirstPartyManagedCertificate" # type: str -class CacheConfiguration(msrest.serialization.Model): +class CacheConfiguration(_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", + every request with a unique URL, or cache specific query strings. Known values are: + "IgnoreQueryString", "UseQueryString", "IgnoreSpecifiedQueryStrings", and "IncludeSpecifiedQueryStrings". :vartype query_string_caching_behavior: str or ~azure.mgmt.cdn.models.RuleQueryStringCachingBehavior @@ -2080,10 +2086,10 @@ class CacheConfiguration(msrest.serialization.Model): :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". + larger than 1 MB. Known values are: "Enabled" and "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". + :ivar cache_behavior: Caching behavior for the requests. Known values are: "HonorOrigin", + "OverrideAlways", and "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. @@ -2091,28 +2097,28 @@ class CacheConfiguration(msrest.serialization.Model): """ _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'}, + "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_string_caching_behavior: Optional[Union[str, "_models.RuleQueryStringCachingBehavior"]] = None, query_parameters: Optional[str] = None, - is_compression_enabled: Optional[Union[str, "RuleIsCompressionEnabled"]] = None, - cache_behavior: Optional[Union[str, "RuleCacheBehavior"]] = None, + is_compression_enabled: Optional[Union[str, "_models.RuleIsCompressionEnabled"]] = None, + cache_behavior: Optional[Union[str, "_models.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", + cache every request with a unique URL, or cache specific query strings. Known values are: + "IgnoreQueryString", "UseQueryString", "IgnoreSpecifiedQueryStrings", and "IncludeSpecifiedQueryStrings". :paramtype query_string_caching_behavior: str or ~azure.mgmt.cdn.models.RuleQueryStringCachingBehavior @@ -2121,16 +2127,16 @@ def __init__( :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". + byte or larger than 1 MB. Known values are: "Enabled" and "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". + :keyword cache_behavior: Caching behavior for the requests. Known values are: "HonorOrigin", + "OverrideAlways", and "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) + super().__init__(**kwargs) self.query_string_caching_behavior = query_string_caching_behavior self.query_parameters = query_parameters self.is_compression_enabled = is_compression_enabled @@ -2138,20 +2144,17 @@ def __init__( self.cache_duration = cache_duration -class CacheExpirationActionParameters(msrest.serialization.Model): +class CacheExpirationActionParameters(_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 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". + :ivar type_name: Required. "DeliveryRuleCacheExpirationActionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.CacheExpirationActionParametersTypeName + :ivar cache_behavior: Caching behavior for the requests. Required. Known values are: + "BypassCache", "Override", and "SetIfMissing". :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". + :ivar cache_type: The level at which the content needs to be cached. Required. "All" :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. @@ -2159,136 +2162,136 @@ class CacheExpirationActionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'cache_behavior': {'required': True}, - 'cache_type': {'required': True}, + "type_name": {"required": True}, + "cache_behavior": {"required": True}, + "cache_type": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', 'type': 'str'}, - 'cache_behavior': {'key': 'cacheBehavior', 'type': 'str'}, - 'cache_type': {'key': 'cacheType', 'type': 'str'}, - 'cache_duration': {'key': 'cacheDuration', '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"}, } - type_name = "DeliveryRuleCacheExpirationActionParameters" - def __init__( self, *, - cache_behavior: Union[str, "CacheBehavior"], - cache_type: Union[str, "CacheType"], + type_name: Union[str, "_models.CacheExpirationActionParametersTypeName"], + cache_behavior: Union[str, "_models.CacheBehavior"], + cache_type: Union[str, "_models.CacheType"], cache_duration: Optional[str] = None, **kwargs ): """ - :keyword cache_behavior: Required. Caching behavior for the requests. Possible values include: - "BypassCache", "Override", "SetIfMissing". + :keyword type_name: Required. "DeliveryRuleCacheExpirationActionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.CacheExpirationActionParametersTypeName + :keyword cache_behavior: Caching behavior for the requests. Required. Known values are: + "BypassCache", "Override", and "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". + :keyword cache_type: The level at which the content needs to be cached. Required. "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) + super().__init__(**kwargs) + self.type_name = type_name self.cache_behavior = cache_behavior self.cache_type = cache_type self.cache_duration = cache_duration -class CacheKeyQueryStringActionParameters(msrest.serialization.Model): +class CacheKeyQueryStringActionParameters(_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 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". + :ivar type_name: Required. "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.CacheKeyQueryStringActionParametersTypeName + :ivar query_string_behavior: Caching behavior for the requests. Required. Known values are: + "Include", "IncludeAll", "Exclude", and "ExcludeAll". :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 = { - 'type_name': {'required': True, 'constant': True}, - 'query_string_behavior': {'required': True}, + "type_name": {"required": True}, + "query_string_behavior": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', 'type': 'str'}, - 'query_string_behavior': {'key': 'queryStringBehavior', 'type': 'str'}, - 'query_parameters': {'key': 'queryParameters', 'type': 'str'}, + "type_name": {"key": "typeName", "type": "str"}, + "query_string_behavior": {"key": "queryStringBehavior", "type": "str"}, + "query_parameters": {"key": "queryParameters", "type": "str"}, } - type_name = "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" - def __init__( self, *, - query_string_behavior: Union[str, "QueryStringBehavior"], + type_name: Union[str, "_models.CacheKeyQueryStringActionParametersTypeName"], + query_string_behavior: Union[str, "_models.QueryStringBehavior"], query_parameters: Optional[str] = None, **kwargs ): """ - :keyword query_string_behavior: Required. Caching behavior for the requests. Possible values - include: "Include", "IncludeAll", "Exclude", "ExcludeAll". + :keyword type_name: Required. "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.CacheKeyQueryStringActionParametersTypeName + :keyword query_string_behavior: Caching behavior for the requests. Required. Known values are: + "Include", "IncludeAll", "Exclude", and "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) + super().__init__(**kwargs) + self.type_name = type_name self.query_string_behavior = query_string_behavior self.query_parameters = query_parameters -class CdnCertificateSourceParameters(msrest.serialization.Model): +class CdnCertificateSourceParameters(_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 type_name: Has constant value: "CdnCertificateSourceParameters". - :vartype type_name: str - :ivar certificate_type: Required. Type of certificate used. Possible values include: "Shared", + :ivar type_name: Required. "CdnCertificateSourceParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.CdnCertificateSourceParametersTypeName + :ivar certificate_type: Type of certificate used. Required. Known values are: "Shared" and "Dedicated". :vartype certificate_type: str or ~azure.mgmt.cdn.models.CertificateType """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'certificate_type': {'required': True}, + "type_name": {"required": True}, + "certificate_type": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', 'type': 'str'}, - 'certificate_type': {'key': 'certificateType', 'type': 'str'}, + "type_name": {"key": "typeName", "type": "str"}, + "certificate_type": {"key": "certificateType", "type": "str"}, } - type_name = "CdnCertificateSourceParameters" - def __init__( self, *, - certificate_type: Union[str, "CertificateType"], + type_name: Union[str, "_models.CdnCertificateSourceParametersTypeName"], + certificate_type: Union[str, "_models.CertificateType"], **kwargs ): """ - :keyword certificate_type: Required. Type of certificate used. Possible values include: - "Shared", "Dedicated". + :keyword type_name: Required. "CdnCertificateSourceParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.CdnCertificateSourceParametersTypeName + :keyword certificate_type: Type of certificate used. Required. Known values are: "Shared" and + "Dedicated". :paramtype certificate_type: str or ~azure.mgmt.cdn.models.CertificateType """ - super(CdnCertificateSourceParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.certificate_type = certificate_type -class CdnEndpoint(msrest.serialization.Model): +class CdnEndpoint(_serialization.Model): """Defines the ARM Resource ID for the linked endpoints. :ivar id: ARM Resource ID string. @@ -2296,73 +2299,68 @@ class CdnEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: ARM Resource ID string. :paramtype id: str """ - super(CdnEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class CustomDomainHttpsParameters(msrest.serialization.Model): +class CustomDomainHttpsParameters(_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. + 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. - :ivar certificate_source: Required. Defines the source of the SSL certificate.Constant filled - by server. Possible values include: "AzureKeyVault", "Cdn". + :ivar certificate_source: Defines the source of the SSL certificate. Required. Known values + are: "AzureKeyVault" and "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". + :ivar protocol_type: Defines the TLS extension protocol that is used for secure delivery. + Required. Known values are: "ServerNameIndication" and "IPBased". :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". + :ivar minimum_tls_version: TLS protocol version that will be used for Https. Known values are: + "None", "TLS10", and "TLS12". :vartype minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion """ _validation = { - 'certificate_source': {'required': True}, - 'protocol_type': {'required': True}, + "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'}, + "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'} + "certificate_source": {"AzureKeyVault": "UserManagedHttpsParameters", "Cdn": "CdnManagedHttpsParameters"} } def __init__( self, *, - protocol_type: Union[str, "ProtocolType"], - minimum_tls_version: Optional[Union[str, "MinimumTlsVersion"]] = None, + protocol_type: Union[str, "_models.ProtocolType"], + minimum_tls_version: Optional[Union[str, "_models.MinimumTlsVersion"]] = None, **kwargs ): """ - :keyword protocol_type: Required. Defines the TLS extension protocol that is used for secure - delivery. Possible values include: "ServerNameIndication", "IPBased". + :keyword protocol_type: Defines the TLS extension protocol that is used for secure delivery. + Required. Known values are: "ServerNameIndication" and "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". + :keyword minimum_tls_version: TLS protocol version that will be used for Https. Known values + are: "None", "TLS10", and "TLS12". :paramtype minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion """ - super(CustomDomainHttpsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.certificate_source = None # type: Optional[str] self.protocol_type = protocol_type self.minimum_tls_version = minimum_tls_version @@ -2373,58 +2371,61 @@ class CdnManagedHttpsParameters(CustomDomainHttpsParameters): All required parameters must be populated in order to send to Azure. - :ivar certificate_source: Required. Defines the source of the SSL certificate.Constant filled - by server. Possible values include: "AzureKeyVault", "Cdn". + :ivar certificate_source: Defines the source of the SSL certificate. Required. Known values + are: "AzureKeyVault" and "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". + :ivar protocol_type: Defines the TLS extension protocol that is used for secure delivery. + Required. Known values are: "ServerNameIndication" and "IPBased". :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". + :ivar minimum_tls_version: TLS protocol version that will be used for Https. Known values are: + "None", "TLS10", and "TLS12". :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. + :ivar certificate_source_parameters: Defines the certificate source parameters using CDN + managed certificate for enabling SSL. Required. :vartype certificate_source_parameters: ~azure.mgmt.cdn.models.CdnCertificateSourceParameters """ _validation = { - 'certificate_source': {'required': True}, - 'protocol_type': {'required': True}, - 'certificate_source_parameters': {'required': True}, + "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'}, + "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, *, - protocol_type: Union[str, "ProtocolType"], - certificate_source_parameters: "CdnCertificateSourceParameters", - minimum_tls_version: Optional[Union[str, "MinimumTlsVersion"]] = None, + protocol_type: Union[str, "_models.ProtocolType"], + certificate_source_parameters: "_models.CdnCertificateSourceParameters", + minimum_tls_version: Optional[Union[str, "_models.MinimumTlsVersion"]] = None, **kwargs ): """ - :keyword protocol_type: Required. Defines the TLS extension protocol that is used for secure - delivery. Possible values include: "ServerNameIndication", "IPBased". + :keyword protocol_type: Defines the TLS extension protocol that is used for secure delivery. + Required. Known values are: "ServerNameIndication" and "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". + :keyword minimum_tls_version: TLS protocol version that will be used for Https. Known values + are: "None", "TLS10", and "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. + :keyword certificate_source_parameters: Defines the certificate source parameters using CDN + managed certificate for enabling SSL. Required. :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 + super().__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 -class CdnWebApplicationFirewallPolicy(TrackedResource): +class CdnWebApplicationFirewallPolicy(TrackedResource): # pylint: disable=too-many-instance-attributes """Defines web application firewall policy for Azure CDN. Variables are only populated by the server, and will be ignored when sending a request. @@ -2439,14 +2440,14 @@ class CdnWebApplicationFirewallPolicy(TrackedResource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar 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. + :ivar sku: The pricing tier (defines a CDN provider, feature list and rate) of the + CdnWebApplicationFirewallPolicy. Required. :vartype sku: ~azure.mgmt.cdn.models.Sku :ivar policy_settings: Describes policySettings for policy. :vartype policy_settings: ~azure.mgmt.cdn.models.PolicySettings @@ -2459,66 +2460,66 @@ class CdnWebApplicationFirewallPolicy(TrackedResource): :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". + :ivar provisioning_state: Provisioning state of the WebApplicationFirewallPolicy. Known values + are: "Creating", "Succeeded", and "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". + :ivar resource_state: Resource status of the policy. Known values are: "Creating", "Enabling", + "Enabled", "Disabling", "Disabled", and "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}, + "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'}, + "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, *, location: str, - sku: "Sku", + sku: "_models.Sku", tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, - policy_settings: Optional["PolicySettings"] = None, - rate_limit_rules: Optional["RateLimitRuleList"] = None, - custom_rules: Optional["CustomRuleList"] = None, - managed_rules: Optional["ManagedRuleSetList"] = None, + policy_settings: Optional["_models.PolicySettings"] = None, + rate_limit_rules: Optional["_models.RateLimitRuleList"] = None, + custom_rules: Optional["_models.CustomRuleList"] = None, + managed_rules: Optional["_models.ManagedRuleSetList"] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword 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. + :keyword sku: The pricing tier (defines a CDN provider, feature list and rate) of the + CdnWebApplicationFirewallPolicy. Required. :paramtype sku: ~azure.mgmt.cdn.models.Sku :keyword policy_settings: Describes policySettings for policy. :paramtype policy_settings: ~azure.mgmt.cdn.models.PolicySettings @@ -2529,7 +2530,7 @@ def __init__( :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) + super().__init__(location=location, tags=tags, **kwargs) self.etag = etag self.sku = sku self.policy_settings = policy_settings @@ -2541,7 +2542,7 @@ def __init__( self.resource_state = None -class CdnWebApplicationFirewallPolicyList(msrest.serialization.Model): +class CdnWebApplicationFirewallPolicyList(_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. @@ -2554,110 +2555,102 @@ class CdnWebApplicationFirewallPolicyList(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CdnWebApplicationFirewallPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CdnWebApplicationFirewallPolicy]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class CdnWebApplicationFirewallPolicyPatchParameters(msrest.serialization.Model): +class CdnWebApplicationFirewallPolicyPatchParameters(_serialization.Model): """Properties required to update a CdnWebApplicationFirewallPolicy. - :ivar tags: A set of tags. CdnWebApplicationFirewallPolicy tags. + :ivar tags: CdnWebApplicationFirewallPolicy tags. :vartype tags: dict[str, str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): """ - :keyword tags: A set of tags. CdnWebApplicationFirewallPolicy tags. + :keyword tags: CdnWebApplicationFirewallPolicy tags. :paramtype tags: dict[str, str] """ - super(CdnWebApplicationFirewallPolicyPatchParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags -class CheckEndpointNameAvailabilityInput(msrest.serialization.Model): +class CheckEndpointNameAvailabilityInput(_serialization.Model): """Input of CheckNameAvailability API. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The resource name to validate. + :ivar name: The resource name to validate. Required. :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". + :ivar type: The type of the resource whose name is to be validated. Required. Known values are: + "Microsoft.Cdn/Profiles/Endpoints" and "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". + default value is TenantReuse. Known values are: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", and "NoReuse". :vartype auto_generated_domain_name_label_scope: str or ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope """ _validation = { - 'name': {'required': True}, - 'type': {'required': True}, + "name": {"required": True}, + "type": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'auto_generated_domain_name_label_scope': {'key': 'autoGeneratedDomainNameLabelScope', '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, *, name: str, - type: Union[str, "ResourceType"], - auto_generated_domain_name_label_scope: Optional[Union[str, "AutoGeneratedDomainNameLabelScope"]] = None, + type: Union[str, "_models.ResourceType"], + auto_generated_domain_name_label_scope: Optional[ + Union[str, "_models.AutoGeneratedDomainNameLabelScope"] + ] = None, **kwargs ): """ - :keyword name: Required. The resource name to validate. + :keyword name: The resource name to validate. Required. :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". + :keyword type: The type of the resource whose name is to be validated. Required. Known values + are: "Microsoft.Cdn/Profiles/Endpoints" and "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". + default value is TenantReuse. Known values are: "TenantReuse", "SubscriptionReuse", + "ResourceGroupReuse", and "NoReuse". :paramtype auto_generated_domain_name_label_scope: str or ~azure.mgmt.cdn.models.AutoGeneratedDomainNameLabelScope """ - super(CheckEndpointNameAvailabilityInput, self).__init__(**kwargs) + super().__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): +class CheckEndpointNameAvailabilityOutput(_serialization.Model): """Output of check name availability API. Variables are only populated by the server, and will be ignored when sending a request. @@ -2675,105 +2668,90 @@ class CheckEndpointNameAvailabilityOutput(msrest.serialization.Model): """ _validation = { - 'name_available': {'readonly': True}, - 'available_hostname': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, + "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'}, + "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(CheckEndpointNameAvailabilityOutput, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name_available = None self.available_hostname = None self.reason = None self.message = None -class CheckHostNameAvailabilityInput(msrest.serialization.Model): +class CheckHostNameAvailabilityInput(_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. + :ivar host_name: The host name to validate. Required. :vartype host_name: str """ _validation = { - 'host_name': {'required': True}, + "host_name": {"required": True}, } _attribute_map = { - 'host_name': {'key': 'hostName', 'type': 'str'}, + "host_name": {"key": "hostName", "type": "str"}, } - def __init__( - self, - *, - host_name: str, - **kwargs - ): + def __init__(self, *, host_name: str, **kwargs): """ - :keyword host_name: Required. The host name to validate. + :keyword host_name: The host name to validate. Required. :paramtype host_name: str """ - super(CheckHostNameAvailabilityInput, self).__init__(**kwargs) + super().__init__(**kwargs) self.host_name = host_name -class CheckNameAvailabilityInput(msrest.serialization.Model): +class CheckNameAvailabilityInput(_serialization.Model): """Input of CheckNameAvailability API. All required parameters must be populated in order to send to Azure. - :ivar name: Required. The resource name to validate. + :ivar name: The resource name to validate. Required. :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". + :ivar type: The type of the resource whose name is to be validated. Required. Known values are: + "Microsoft.Cdn/Profiles/Endpoints" and "Microsoft.Cdn/Profiles/AfdEndpoints". :vartype type: str or ~azure.mgmt.cdn.models.ResourceType """ _validation = { - 'name': {'required': True}, - 'type': {'required': True}, + "name": {"required": True}, + "type": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - name: str, - type: Union[str, "ResourceType"], - **kwargs - ): + def __init__(self, *, name: str, type: Union[str, "_models.ResourceType"], **kwargs): """ - :keyword name: Required. The resource name to validate. + :keyword name: The resource name to validate. Required. :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". + :keyword type: The type of the resource whose name is to be validated. Required. Known values + are: "Microsoft.Cdn/Profiles/Endpoints" and "Microsoft.Cdn/Profiles/AfdEndpoints". :paramtype type: str or ~azure.mgmt.cdn.models.ResourceType """ - super(CheckNameAvailabilityInput, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.type = type -class CheckNameAvailabilityOutput(msrest.serialization.Model): +class CheckNameAvailabilityOutput(_serialization.Model): """Output of check name availability API. Variables are only populated by the server, and will be ignored when sending a request. @@ -2787,30 +2765,26 @@ class CheckNameAvailabilityOutput(msrest.serialization.Model): """ _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name_available = None self.reason = None self.message = None -class CidrIpAddress(msrest.serialization.Model): +class CidrIpAddress(_serialization.Model): """CIDR Ip address. :ivar base_ip_address: Ip address itself. @@ -2820,40 +2794,32 @@ class CidrIpAddress(msrest.serialization.Model): """ _attribute_map = { - 'base_ip_address': {'key': 'baseIpAddress', 'type': 'str'}, - 'prefix_length': {'key': 'prefixLength', 'type': 'int'}, + "base_ip_address": {"key": "baseIpAddress", "type": "str"}, + "prefix_length": {"key": "prefixLength", "type": "int"}, } - def __init__( - self, - *, - base_ip_address: Optional[str] = None, - prefix_length: Optional[int] = None, - **kwargs - ): + def __init__(self, *, base_ip_address: Optional[str] = None, prefix_length: Optional[int] = None, **kwargs): """ :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) + super().__init__(**kwargs) self.base_ip_address = base_ip_address self.prefix_length = prefix_length -class ClientPortMatchConditionParameters(msrest.serialization.Model): +class ClientPortMatchConditionParameters(_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". + :ivar type_name: Required. "DeliveryRuleClientPortConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.ClientPortMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "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 @@ -2864,33 +2830,34 @@ class ClientPortMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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"], + type_name: Union[str, "_models.ClientPortMatchConditionParametersTypeName"], + operator: Union[str, "_models.ClientPortOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword type_name: Required. "DeliveryRuleClientPortConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.ClientPortMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -2899,14 +2866,15 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(ClientPortMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(msrest.serialization.Model): +class Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(_serialization.Model): """Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems. :ivar date_time: @@ -2916,29 +2884,23 @@ class Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesD """ _attribute_map = { - 'date_time': {'key': 'dateTime', 'type': 'iso-8601'}, - 'value': {'key': 'value', 'type': 'float'}, + "date_time": {"key": "dateTime", "type": "iso-8601"}, + "value": {"key": "value", "type": "float"}, } - def __init__( - self, - *, - date_time: Optional[datetime.datetime] = None, - value: Optional[float] = None, - **kwargs - ): + def __init__(self, *, date_time: Optional[datetime.datetime] = None, value: Optional[float] = None, **kwargs): """ :keyword date_time: :paramtype date_time: ~datetime.datetime :keyword value: :paramtype value: float """ - super(Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems, self).__init__(**kwargs) + super().__init__(**kwargs) self.date_time = date_time self.value = value -class Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(msrest.serialization.Model): +class Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(_serialization.Model): """Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems. :ivar date_time: @@ -2948,68 +2910,57 @@ class Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesData """ _attribute_map = { - 'date_time': {'key': 'dateTime', 'type': 'iso-8601'}, - 'value': {'key': 'value', 'type': 'float'}, + "date_time": {"key": "dateTime", "type": "iso-8601"}, + "value": {"key": "value", "type": "float"}, } - def __init__( - self, - *, - date_time: Optional[datetime.datetime] = None, - value: Optional[float] = None, - **kwargs - ): + def __init__(self, *, date_time: Optional[datetime.datetime] = None, value: Optional[float] = None, **kwargs): """ :keyword date_time: :paramtype date_time: ~datetime.datetime :keyword value: :paramtype value: float """ - super(Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems, self).__init__(**kwargs) + super().__init__(**kwargs) self.date_time = date_time self.value = value -class ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(msrest.serialization.Model): +class ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(_serialization.Model): """ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems. :ivar metric: :vartype metric: str :ivar value: - :vartype value: long + :vartype value: int :ivar percentage: :vartype percentage: float """ _attribute_map = { - 'metric': {'key': 'metric', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'long'}, - 'percentage': {'key': 'percentage', 'type': 'float'}, + "metric": {"key": "metric", "type": "str"}, + "value": {"key": "value", "type": "int"}, + "percentage": {"key": "percentage", "type": "float"}, } def __init__( - self, - *, - metric: Optional[str] = None, - value: Optional[int] = None, - percentage: Optional[float] = None, - **kwargs + self, *, metric: Optional[str] = None, value: Optional[int] = None, percentage: Optional[float] = None, **kwargs ): """ :keyword metric: :paramtype metric: str :keyword value: - :paramtype value: long + :paramtype value: int :keyword percentage: :paramtype percentage: float """ - super(ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems, self).__init__(**kwargs) + super().__init__(**kwargs) self.metric = metric self.value = value self.percentage = percentage -class CompressionSettings(msrest.serialization.Model): +class CompressionSettings(_serialization.Model): """settings for compression. :ivar content_types_to_compress: List of content types on which compression applies. The value @@ -3023,8 +2974,8 @@ class CompressionSettings(msrest.serialization.Model): """ _attribute_map = { - 'content_types_to_compress': {'key': 'contentTypesToCompress', 'type': '[str]'}, - 'is_compression_enabled': {'key': 'isCompressionEnabled', 'type': 'bool'}, + "content_types_to_compress": {"key": "contentTypesToCompress", "type": "[str]"}, + "is_compression_enabled": {"key": "isCompressionEnabled", "type": "bool"}, } def __init__( @@ -3044,12 +2995,12 @@ def __init__( AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. :paramtype is_compression_enabled: bool """ - super(CompressionSettings, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_types_to_compress = content_types_to_compress self.is_compression_enabled = is_compression_enabled -class ContinentsResponse(msrest.serialization.Model): +class ContinentsResponse(_serialization.Model): """Continents Response. :ivar continents: @@ -3060,15 +3011,15 @@ class ContinentsResponse(msrest.serialization.Model): """ _attribute_map = { - 'continents': {'key': 'continents', 'type': '[ContinentsResponseContinentsItem]'}, - 'country_or_regions': {'key': 'countryOrRegions', 'type': '[ContinentsResponseCountryOrRegionsItem]'}, + "continents": {"key": "continents", "type": "[ContinentsResponseContinentsItem]"}, + "country_or_regions": {"key": "countryOrRegions", "type": "[ContinentsResponseCountryOrRegionsItem]"}, } def __init__( self, *, - continents: Optional[List["ContinentsResponseContinentsItem"]] = None, - country_or_regions: Optional[List["ContinentsResponseCountryOrRegionsItem"]] = None, + continents: Optional[List["_models.ContinentsResponseContinentsItem"]] = None, + country_or_regions: Optional[List["_models.ContinentsResponseCountryOrRegionsItem"]] = None, **kwargs ): """ @@ -3078,12 +3029,12 @@ def __init__( :paramtype country_or_regions: list[~azure.mgmt.cdn.models.ContinentsResponseCountryOrRegionsItem] """ - super(ContinentsResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.continents = continents self.country_or_regions = country_or_regions -class ContinentsResponseContinentsItem(msrest.serialization.Model): +class ContinentsResponseContinentsItem(_serialization.Model): """ContinentsResponseContinentsItem. :ivar id: @@ -3091,24 +3042,19 @@ class ContinentsResponseContinentsItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: :paramtype id: str """ - super(ContinentsResponseContinentsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class ContinentsResponseCountryOrRegionsItem(msrest.serialization.Model): +class ContinentsResponseCountryOrRegionsItem(_serialization.Model): """ContinentsResponseCountryOrRegionsItem. :ivar id: @@ -3118,14 +3064,14 @@ class ContinentsResponseCountryOrRegionsItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'continent_id': {'key': 'continentId', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "continent_id": {"key": "continentId", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin continent_id: Optional[str] = None, **kwargs ): @@ -3135,25 +3081,23 @@ def __init__( :keyword continent_id: :paramtype continent_id: str """ - super(ContinentsResponseCountryOrRegionsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.continent_id = continent_id -class CookiesMatchConditionParameters(msrest.serialization.Model): +class CookiesMatchConditionParameters(_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 type_name: Has constant value: "DeliveryRuleCookiesConditionParameters". - :vartype type_name: str + :ivar type_name: Required. "DeliveryRuleCookiesConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.CookiesMatchConditionParametersTypeName :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". + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "RegEx". :vartype operator: str or ~azure.mgmt.cdn.models.CookiesOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool @@ -3164,37 +3108,38 @@ class CookiesMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": True}, + "operator": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', '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]'}, + "type_name": {"key": "typeName", "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]"}, } - type_name = "DeliveryRuleCookiesConditionParameters" - def __init__( self, *, - operator: Union[str, "CookiesOperator"], + type_name: Union[str, "_models.CookiesMatchConditionParametersTypeName"], + operator: Union[str, "_models.CookiesOperator"], selector: Optional[str] = None, negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ + :keyword type_name: Required. "DeliveryRuleCookiesConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.CookiesMatchConditionParametersTypeName :keyword selector: Name of Cookies to be matched. :paramtype selector: str - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -3203,7 +3148,8 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(CookiesMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.selector = selector self.operator = operator self.negate_condition = negate_condition @@ -3211,7 +3157,7 @@ def __init__( self.transforms = transforms -class CustomDomain(ProxyResource): +class CustomDomain(ProxyResource): # pylint: disable=too-many-instance-attributes """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. @@ -3226,19 +3172,19 @@ class CustomDomain(ProxyResource): :vartype system_data: ~azure.mgmt.cdn.models.SystemData :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". + :ivar resource_state: Resource status of the custom domain. Known values are: "Creating", + "Active", and "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". + :ivar custom_https_provisioning_state: Provisioning status of the custom domain. Known values + are: "Enabling", "Enabled", "Disabling", "Disabled", and "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: + HTTPS enabling/disabling process step by step. Known values are: "SubmittingDomainControlValidationRequest", "PendingDomainControlValidationREquestApproval", "DomainControlValidationRequestApproved", "DomainControlValidationRequestRejected", "DomainControlValidationRequestTimedOut", "IssuingCertificate", "DeployingCertificate", - "CertificateDeployed", "DeletingCertificate", "CertificateDeleted". + "CertificateDeployed", "DeletingCertificate", and "CertificateDeleted". :vartype custom_https_provisioning_substate: str or ~azure.mgmt.cdn.models.CustomHttpsProvisioningSubstate :ivar custom_https_parameters: Certificate parameters for securing custom HTTPS. @@ -3247,40 +3193,41 @@ class CustomDomain(ProxyResource): regions due to local compliance reasons. E.g. ICP license number of a custom domain is required to deliver content in China. :vartype validation_data: str - :ivar provisioning_state: Provisioning status of the custom domain. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning status of Custom Https of the custom domain. Known + values are: "Enabling", "Enabled", "Disabling", "Disabled", and "Failed". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.CustomHttpsProvisioningState """ _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}, + "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'}, - 'custom_https_parameters': {'key': 'properties.customHttpsParameters', 'type': 'CustomDomainHttpsParameters'}, - 'validation_data': {'key': 'properties.validationData', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + "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"}, + "custom_https_parameters": {"key": "properties.customHttpsParameters", "type": "CustomDomainHttpsParameters"}, + "validation_data": {"key": "properties.validationData", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( self, *, host_name: Optional[str] = None, - custom_https_parameters: Optional["CustomDomainHttpsParameters"] = None, + custom_https_parameters: Optional["_models.CustomDomainHttpsParameters"] = None, validation_data: Optional[str] = None, **kwargs ): @@ -3294,7 +3241,7 @@ def __init__( required to deliver content in China. :paramtype validation_data: str """ - super(CustomDomain, self).__init__(**kwargs) + super().__init__(**kwargs) self.host_name = host_name self.resource_state = None self.custom_https_provisioning_state = None @@ -3304,7 +3251,7 @@ def __init__( self.provisioning_state = None -class CustomDomainListResult(msrest.serialization.Model): +class CustomDomainListResult(_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. @@ -3316,30 +3263,25 @@ class CustomDomainListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CustomDomain]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[CustomDomain]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class CustomDomainParameters(msrest.serialization.Model): +class CustomDomainParameters(_serialization.Model): """The customDomain JSON object required for custom domain creation or update. :ivar host_name: The host name of the custom domain. Must be a domain name. @@ -3347,20 +3289,15 @@ class CustomDomainParameters(msrest.serialization.Model): """ _attribute_map = { - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + "host_name": {"key": "properties.hostName", "type": "str"}, } - def __init__( - self, - *, - host_name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.host_name = host_name @@ -3369,8 +3306,8 @@ class CustomerCertificate(Certificate): 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". + :ivar type: The type of the secret resource. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". :vartype type: str or ~azure.mgmt.cdn.models.SecretType :ivar subject: Subject name in the certificate. :vartype subject: str @@ -3393,37 +3330,37 @@ class CustomerCertificate(Certificate): """ _validation = { - 'subject': {'readonly': True}, - 'expiration_date': {'readonly': True}, - 'certificate_authority': {'readonly': True}, - 'thumbprint': {'readonly': True}, + "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'}, - '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]'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, + "subject": {"key": "subject", "type": "str"}, + "expiration_date": {"key": "expirationDate", "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]"}, + "thumbprint": {"key": "thumbprint", "type": "str"}, } def __init__( self, *, - type: Optional[Union[str, "SecretType"]] = None, - secret_source: Optional["ResourceReference"] = None, + type: Optional[Union[str, "_models.SecretType"]] = None, + secret_source: Optional["_models.ResourceReference"] = None, secret_version: Optional[str] = None, use_latest_version: Optional[bool] = None, subject_alternative_names: Optional[List[str]] = None, **kwargs ): """ - :keyword type: The type of the secret resource. Possible values include: "UrlSigningKey", - "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :keyword type: The type of the secret resource. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "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 @@ -3436,7 +3373,7 @@ def __init__( :keyword subject_alternative_names: The list of SANs. :paramtype subject_alternative_names: list[str] """ - super(CustomerCertificate, self).__init__(type=type, **kwargs) + super().__init__(type=type, **kwargs) self.secret_source = secret_source self.secret_version = secret_version self.certificate_authority = None @@ -3452,13 +3389,13 @@ class CustomerCertificateParameters(SecretParameters): 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". + :ivar type: The type of the secret resource. Required. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "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 + :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}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + Required. :vartype secret_source: ~azure.mgmt.cdn.models.ResourceReference :ivar secret_version: Version of the secret to be used. :vartype secret_version: str @@ -3477,39 +3414,40 @@ class CustomerCertificateParameters(SecretParameters): """ _validation = { - 'type': {'required': True}, - 'secret_source': {'required': True}, - 'subject': {'readonly': True}, - 'expiration_date': {'readonly': True}, - 'certificate_authority': {'readonly': True}, - 'thumbprint': {'readonly': True}, + "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'}, - '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'}, + "type": {"key": "type", "type": "str"}, + "secret_source": {"key": "secretSource", "type": "ResourceReference"}, + "secret_version": {"key": "secretVersion", "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__( self, *, - secret_source: "ResourceReference", + secret_source: "_models.ResourceReference", secret_version: 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 + :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}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + Required. :paramtype secret_source: ~azure.mgmt.cdn.models.ResourceReference :keyword secret_version: Version of the secret to be used. :paramtype secret_version: str @@ -3518,8 +3456,8 @@ def __init__( :keyword subject_alternative_names: The list of SANs. :paramtype subject_alternative_names: list[str] """ - super(CustomerCertificateParameters, self).__init__(**kwargs) - self.type = 'CustomerCertificate' # type: str + super().__init__(**kwargs) + self.type = "CustomerCertificate" # type: str self.secret_source = secret_source self.secret_version = secret_version self.use_latest_version = use_latest_version @@ -3530,39 +3468,39 @@ def __init__( self.thumbprint = None -class CustomRule(msrest.serialization.Model): +class CustomRule(_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. - :ivar name: Required. Defines the name of the custom rule. + :ivar name: Defines the name of the custom rule. Required. :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". + Enabled if not specified. Known values are: "Disabled" and "Enabled". :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. + :ivar priority: Defines in what order this rule be evaluated in the overall list of custom + rules. Required. :vartype priority: int - :ivar match_conditions: Required. List of match conditions. + :ivar match_conditions: List of match conditions. Required. :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". + :ivar action: Describes what action to be applied when rule matches. Required. Known values + are: "Allow", "Block", "Log", and "Redirect". :vartype 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}, + "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'}, + "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__( @@ -3570,27 +3508,27 @@ def __init__( *, name: str, priority: int, - match_conditions: List["MatchCondition"], - action: Union[str, "ActionType"], - enabled_state: Optional[Union[str, "CustomRuleEnabledState"]] = None, + match_conditions: List["_models.MatchCondition"], + action: Union[str, "_models.ActionType"], + enabled_state: Optional[Union[str, "_models.CustomRuleEnabledState"]] = None, **kwargs ): """ - :keyword name: Required. Defines the name of the custom rule. + :keyword name: Defines the name of the custom rule. Required. :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". + to Enabled if not specified. Known values are: "Disabled" and "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. + :keyword priority: Defines in what order this rule be evaluated in the overall list of custom + rules. Required. :paramtype priority: int - :keyword match_conditions: Required. List of match conditions. + :keyword match_conditions: List of match conditions. Required. :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". + :keyword action: Describes what action to be applied when rule matches. Required. Known values + are: "Allow", "Block", "Log", and "Redirect". :paramtype action: str or ~azure.mgmt.cdn.models.ActionType """ - super(CustomRule, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.enabled_state = enabled_state self.priority = priority @@ -3598,7 +3536,7 @@ def __init__( self.action = action -class CustomRuleList(msrest.serialization.Model): +class CustomRuleList(_serialization.Model): """Defines contents of custom rules. :ivar rules: List of rules. @@ -3606,31 +3544,68 @@ class CustomRuleList(msrest.serialization.Model): """ _attribute_map = { - 'rules': {'key': 'rules', 'type': '[CustomRule]'}, + "rules": {"key": "rules", "type": "[CustomRule]"}, } - def __init__( - self, - *, - rules: Optional[List["CustomRule"]] = None, - **kwargs - ): + def __init__(self, *, rules: Optional[List["_models.CustomRule"]] = None, **kwargs): """ :keyword rules: List of rules. :paramtype rules: list[~azure.mgmt.cdn.models.CustomRule] """ - super(CustomRuleList, self).__init__(**kwargs) + super().__init__(**kwargs) self.rules = rules -class DeepCreatedOrigin(msrest.serialization.Model): +class DeepCreatedCustomDomain(_serialization.Model): + """Custom domains created on the CDN endpoint. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Custom domain name. Required. + :vartype name: str + :ivar host_name: The host name of the custom domain. Must be a domain name. + :vartype host_name: str + :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. + :vartype validation_data: str + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "host_name": {"key": "properties.hostName", "type": "str"}, + "validation_data": {"key": "properties.validationData", "type": "str"}, + } + + def __init__(self, *, name: str, host_name: Optional[str] = None, validation_data: Optional[str] = None, **kwargs): + """ + :keyword name: Custom domain name. Required. + :paramtype name: str + :keyword host_name: The host name of the custom domain. Must be a domain name. + :paramtype host_name: str + :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().__init__(**kwargs) + self.name = name + self.host_name = host_name + self.validation_data = validation_data + + +class DeepCreatedOrigin(_serialization.Model): # pylint: disable=too-many-instance-attributes """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. - :ivar name: Required. Origin name which must be unique within the endpoint. + :ivar name: Origin name which must be unique within the endpoint. Required. :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. @@ -3667,33 +3642,33 @@ class DeepCreatedOrigin(msrest.serialization.Model): 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". + Known values are: "Pending", "Approved", "Rejected", "Disconnected", and "Timeout". :vartype private_endpoint_status: str or ~azure.mgmt.cdn.models.PrivateEndpointStatus """ _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}, - 'private_endpoint_status': {'readonly': True}, + "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}, + "private_endpoint_status": {"readonly": True}, } _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'}, - 'private_endpoint_status': {'key': 'properties.privateEndpointStatus', 'type': 'str'}, + "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"}, + "private_endpoint_status": {"key": "properties.privateEndpointStatus", "type": "str"}, } def __init__( @@ -3714,7 +3689,7 @@ def __init__( **kwargs ): """ - :keyword name: Required. Origin name which must be unique within the endpoint. + :keyword name: Origin name which must be unique within the endpoint. Required. :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. @@ -3751,7 +3726,7 @@ def __init__( to connect to the Private Link. :paramtype private_link_approval_message: str """ - super(DeepCreatedOrigin, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.host_name = host_name self.http_port = http_port @@ -3767,12 +3742,12 @@ def __init__( self.private_endpoint_status = None -class DeepCreatedOriginGroup(msrest.serialization.Model): +class DeepCreatedOriginGroup(_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. - :ivar name: Required. Origin group name which must be unique within the endpoint. + :ivar name: Origin group name which must be unique within the endpoint. Required. :vartype name: str :ivar health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. @@ -3791,30 +3766,38 @@ class DeepCreatedOriginGroup(msrest.serialization.Model): """ _validation = { - 'name': {'required': True}, - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, + "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'}, + "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, *, name: str, - health_probe_settings: Optional["HealthProbeParameters"] = None, - origins: Optional[List["ResourceReference"]] = None, + health_probe_settings: Optional["_models.HealthProbeParameters"] = None, + origins: Optional[List["_models.ResourceReference"]] = None, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Optional[int] = None, - response_based_origin_error_detection_settings: Optional["ResponseBasedOriginErrorDetectionParameters"] = None, + response_based_origin_error_detection_settings: Optional[ + "_models.ResponseBasedOriginErrorDetectionParameters" + ] = None, **kwargs ): """ - :keyword name: Required. Origin group name which must be unique within the endpoint. + :keyword name: Origin group name which must be unique within the endpoint. Required. :paramtype name: str :keyword health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. @@ -3831,109 +3814,120 @@ def __init__( :paramtype response_based_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters """ - super(DeepCreatedOriginGroup, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.health_probe_settings = health_probe_settings self.origins = origins - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = ( + traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + ) self.response_based_origin_error_detection_settings = response_based_origin_error_detection_settings -class DeliveryRule(msrest.serialization.Model): +class DeliveryRule(_serialization.Model): """A rule that specifies a set of actions and conditions. All required parameters must be populated in order to send to Azure. :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. + :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. Required. :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. + :ivar actions: A list of actions that are executed when all the conditions of a rule are + satisfied. Required. :vartype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] """ _validation = { - 'order': {'required': True}, - 'actions': {'required': True}, + "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]'}, + "name": {"key": "name", "type": "str"}, + "order": {"key": "order", "type": "int"}, + "conditions": {"key": "conditions", "type": "[DeliveryRuleCondition]"}, + "actions": {"key": "actions", "type": "[DeliveryRuleAction]"}, } def __init__( self, *, order: int, - actions: List["DeliveryRuleAction"], + actions: List["_models.DeliveryRuleAction"], name: Optional[str] = None, - conditions: Optional[List["DeliveryRuleCondition"]] = None, + conditions: Optional[List["_models.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. + :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. Required. :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. + :keyword actions: A list of actions that are executed when all the conditions of a rule are + satisfied. Required. :paramtype actions: list[~azure.mgmt.cdn.models.DeliveryRuleAction] """ - super(DeliveryRule, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.order = order self.conditions = conditions self.actions = actions -class DeliveryRuleAction(msrest.serialization.Model): +class DeliveryRuleAction(_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, DeliveryRuleRouteConfigurationOverrideAction, UrlRedirectAction, UrlRewriteAction, UrlSigningAction. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DeliveryRuleCacheExpirationAction, DeliveryRuleCacheKeyQueryStringAction, + DeliveryRuleRequestHeaderAction, DeliveryRuleResponseHeaderAction, OriginGroupOverrideAction, + DeliveryRuleRouteConfigurationOverrideAction, UrlRedirectAction, UrlRewriteAction, + UrlSigningAction 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", + :ivar name: The name of the action for the delivery rule. Required. Known values are: + "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", "ModifyResponseHeader", + "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", and "RouteConfigurationOverride". :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } _subtype_map = { - '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) + "name": { + "CacheExpiration": "DeliveryRuleCacheExpirationAction", + "CacheKeyQueryString": "DeliveryRuleCacheKeyQueryStringAction", + "ModifyRequestHeader": "DeliveryRuleRequestHeaderAction", + "ModifyResponseHeader": "DeliveryRuleResponseHeaderAction", + "OriginGroupOverride": "OriginGroupOverrideAction", + "RouteConfigurationOverride": "DeliveryRuleRouteConfigurationOverrideAction", + "UrlRedirect": "UrlRedirectAction", + "UrlRewrite": "UrlRewriteAction", + "UrlSigning": "UrlSigningAction", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.name = None # type: Optional[str] @@ -3942,37 +3936,32 @@ class DeliveryRuleCacheExpirationAction(DeliveryRuleAction): 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", + :ivar name: The name of the action for the delivery rule. Required. Known values are: + "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", "ModifyResponseHeader", + "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", and "RouteConfigurationOverride". :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :ivar parameters: Required. Defines the parameters for the action. + :ivar parameters: Defines the parameters for the action. Required. :vartype parameters: ~azure.mgmt.cdn.models.CacheExpirationActionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'CacheExpirationActionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "CacheExpirationActionParameters"}, } - def __init__( - self, - *, - parameters: "CacheExpirationActionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.CacheExpirationActionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the action. + :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.CacheExpirationActionParameters """ - super(DeliveryRuleCacheExpirationAction, self).__init__(**kwargs) - self.name = 'CacheExpiration' # type: str + super().__init__(**kwargs) + self.name = "CacheExpiration" # type: str self.parameters = parameters @@ -3981,75 +3970,93 @@ class DeliveryRuleCacheKeyQueryStringAction(DeliveryRuleAction): 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", + :ivar name: The name of the action for the delivery rule. Required. Known values are: + "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", "ModifyResponseHeader", + "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", and "RouteConfigurationOverride". :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :ivar parameters: Required. Defines the parameters for the action. + :ivar parameters: Defines the parameters for the action. Required. :vartype parameters: ~azure.mgmt.cdn.models.CacheKeyQueryStringActionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'CacheKeyQueryStringActionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "CacheKeyQueryStringActionParameters"}, } - def __init__( - self, - *, - parameters: "CacheKeyQueryStringActionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.CacheKeyQueryStringActionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the action. + :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.CacheKeyQueryStringActionParameters """ - super(DeliveryRuleCacheKeyQueryStringAction, self).__init__(**kwargs) - self.name = 'CacheKeyQueryString' # type: str + super().__init__(**kwargs) + self.name = "CacheKeyQueryString" # type: str self.parameters = parameters -class DeliveryRuleCondition(msrest.serialization.Model): +class DeliveryRuleCondition(_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: DeliveryRuleClientPortCondition, DeliveryRuleCookiesCondition, DeliveryRuleHostNameCondition, DeliveryRuleHttpVersionCondition, DeliveryRuleIsDeviceCondition, DeliveryRulePostArgsCondition, DeliveryRuleQueryStringCondition, DeliveryRuleRemoteAddressCondition, DeliveryRuleRequestBodyCondition, DeliveryRuleRequestHeaderCondition, DeliveryRuleRequestMethodCondition, DeliveryRuleRequestSchemeCondition, DeliveryRuleRequestUriCondition, DeliveryRuleServerPortCondition, DeliveryRuleSocketAddrCondition, DeliveryRuleSslProtocolCondition, DeliveryRuleUrlFileExtensionCondition, DeliveryRuleUrlFileNameCondition, DeliveryRuleUrlPathCondition. + You probably want to use the sub-classes and not this class directly. Known 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. - :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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable """ _validation = { - 'name': {'required': True}, + "name": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } _subtype_map = { - '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) + "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().__init__(**kwargs) self.name = None # type: Optional[str] @@ -4058,38 +4065,32 @@ class DeliveryRuleClientPortCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.ClientPortMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'ClientPortMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "ClientPortMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "ClientPortMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.ClientPortMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.ClientPortMatchConditionParameters """ - super(DeliveryRuleClientPortCondition, self).__init__(**kwargs) - self.name = 'ClientPort' # type: str + super().__init__(**kwargs) + self.name = "ClientPort" # type: str self.parameters = parameters @@ -4098,38 +4099,32 @@ class DeliveryRuleCookiesCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.CookiesMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'CookiesMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "CookiesMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "CookiesMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.CookiesMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.CookiesMatchConditionParameters """ - super(DeliveryRuleCookiesCondition, self).__init__(**kwargs) - self.name = 'Cookies' # type: str + super().__init__(**kwargs) + self.name = "Cookies" # type: str self.parameters = parameters @@ -4138,38 +4133,32 @@ class DeliveryRuleHostNameCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.HostNameMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'HostNameMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "HostNameMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "HostNameMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.HostNameMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.HostNameMatchConditionParameters """ - super(DeliveryRuleHostNameCondition, self).__init__(**kwargs) - self.name = 'HostName' # type: str + super().__init__(**kwargs) + self.name = "HostName" # type: str self.parameters = parameters @@ -4178,38 +4167,32 @@ class DeliveryRuleHttpVersionCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.HttpVersionMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'HttpVersionMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "HttpVersionMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "HttpVersionMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.HttpVersionMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.HttpVersionMatchConditionParameters """ - super(DeliveryRuleHttpVersionCondition, self).__init__(**kwargs) - self.name = 'HttpVersion' # type: str + super().__init__(**kwargs) + self.name = "HttpVersion" # type: str self.parameters = parameters @@ -4218,38 +4201,32 @@ class DeliveryRuleIsDeviceCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.IsDeviceMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'IsDeviceMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "IsDeviceMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "IsDeviceMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.IsDeviceMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.IsDeviceMatchConditionParameters """ - super(DeliveryRuleIsDeviceCondition, self).__init__(**kwargs) - self.name = 'IsDevice' # type: str + super().__init__(**kwargs) + self.name = "IsDevice" # type: str self.parameters = parameters @@ -4258,38 +4235,32 @@ class DeliveryRulePostArgsCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.PostArgsMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'PostArgsMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "PostArgsMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "PostArgsMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.PostArgsMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.PostArgsMatchConditionParameters """ - super(DeliveryRulePostArgsCondition, self).__init__(**kwargs) - self.name = 'PostArgs' # type: str + super().__init__(**kwargs) + self.name = "PostArgs" # type: str self.parameters = parameters @@ -4298,38 +4269,32 @@ class DeliveryRuleQueryStringCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.QueryStringMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'QueryStringMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "QueryStringMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "QueryStringMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.QueryStringMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.QueryStringMatchConditionParameters """ - super(DeliveryRuleQueryStringCondition, self).__init__(**kwargs) - self.name = 'QueryString' # type: str + super().__init__(**kwargs) + self.name = "QueryString" # type: str self.parameters = parameters @@ -4338,38 +4303,32 @@ class DeliveryRuleRemoteAddressCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.RemoteAddressMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RemoteAddressMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "RemoteAddressMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "RemoteAddressMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.RemoteAddressMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RemoteAddressMatchConditionParameters """ - super(DeliveryRuleRemoteAddressCondition, self).__init__(**kwargs) - self.name = 'RemoteAddress' # type: str + super().__init__(**kwargs) + self.name = "RemoteAddress" # type: str self.parameters = parameters @@ -4378,38 +4337,32 @@ class DeliveryRuleRequestBodyCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.RequestBodyMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RequestBodyMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "RequestBodyMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "RequestBodyMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.RequestBodyMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RequestBodyMatchConditionParameters """ - super(DeliveryRuleRequestBodyCondition, self).__init__(**kwargs) - self.name = 'RequestBody' # type: str + super().__init__(**kwargs) + self.name = "RequestBody" # type: str self.parameters = parameters @@ -4418,37 +4371,32 @@ class DeliveryRuleRequestHeaderAction(DeliveryRuleAction): 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", + :ivar name: The name of the action for the delivery rule. Required. Known values are: + "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", "ModifyResponseHeader", + "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", and "RouteConfigurationOverride". :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :ivar parameters: Required. Defines the parameters for the action. + :ivar parameters: Defines the parameters for the action. Required. :vartype parameters: ~azure.mgmt.cdn.models.HeaderActionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'HeaderActionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "HeaderActionParameters"}, } - def __init__( - self, - *, - parameters: "HeaderActionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.HeaderActionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the action. + :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.HeaderActionParameters """ - super(DeliveryRuleRequestHeaderAction, self).__init__(**kwargs) - self.name = 'ModifyRequestHeader' # type: str + super().__init__(**kwargs) + self.name = "ModifyRequestHeader" # type: str self.parameters = parameters @@ -4457,38 +4405,32 @@ class DeliveryRuleRequestHeaderCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.RequestHeaderMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RequestHeaderMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "RequestHeaderMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "RequestHeaderMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.RequestHeaderMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RequestHeaderMatchConditionParameters """ - super(DeliveryRuleRequestHeaderCondition, self).__init__(**kwargs) - self.name = 'RequestHeader' # type: str + super().__init__(**kwargs) + self.name = "RequestHeader" # type: str self.parameters = parameters @@ -4497,38 +4439,32 @@ class DeliveryRuleRequestMethodCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.RequestMethodMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RequestMethodMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "RequestMethodMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "RequestMethodMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.RequestMethodMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RequestMethodMatchConditionParameters """ - super(DeliveryRuleRequestMethodCondition, self).__init__(**kwargs) - self.name = 'RequestMethod' # type: str + super().__init__(**kwargs) + self.name = "RequestMethod" # type: str self.parameters = parameters @@ -4537,38 +4473,32 @@ class DeliveryRuleRequestSchemeCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RequestSchemeMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "RequestSchemeMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "RequestSchemeMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.RequestSchemeMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParameters """ - super(DeliveryRuleRequestSchemeCondition, self).__init__(**kwargs) - self.name = 'RequestScheme' # type: str + super().__init__(**kwargs) + self.name = "RequestScheme" # type: str self.parameters = parameters @@ -4577,38 +4507,32 @@ class DeliveryRuleRequestUriCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype 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'}, + "name": {"required": True}, + "parameters": {"required": True}, } - def __init__( - self, - *, - parameters: "RequestUriMatchConditionParameters", - **kwargs - ): + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "RequestUriMatchConditionParameters"}, + } + + def __init__(self, *, parameters: "_models.RequestUriMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RequestUriMatchConditionParameters """ - super(DeliveryRuleRequestUriCondition, self).__init__(**kwargs) - self.name = 'RequestUri' # type: str + super().__init__(**kwargs) + self.name = "RequestUri" # type: str self.parameters = parameters @@ -4617,37 +4541,32 @@ class DeliveryRuleResponseHeaderAction(DeliveryRuleAction): 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", + :ivar name: The name of the action for the delivery rule. Required. Known values are: + "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", "ModifyResponseHeader", + "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", and "RouteConfigurationOverride". :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :ivar parameters: Required. Defines the parameters for the action. + :ivar parameters: Defines the parameters for the action. Required. :vartype parameters: ~azure.mgmt.cdn.models.HeaderActionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'HeaderActionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "HeaderActionParameters"}, } - def __init__( - self, - *, - parameters: "HeaderActionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.HeaderActionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the action. + :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.HeaderActionParameters """ - super(DeliveryRuleResponseHeaderAction, self).__init__(**kwargs) - self.name = 'ModifyResponseHeader' # type: str + super().__init__(**kwargs) + self.name = "ModifyResponseHeader" # type: str self.parameters = parameters @@ -4656,37 +4575,32 @@ class DeliveryRuleRouteConfigurationOverrideAction(DeliveryRuleAction): 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", + :ivar name: The name of the action for the delivery rule. Required. Known values are: + "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", "ModifyResponseHeader", + "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", and "RouteConfigurationOverride". :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :ivar parameters: Required. Defines the parameters for the action. + :ivar parameters: Defines the parameters for the action. Required. :vartype parameters: ~azure.mgmt.cdn.models.RouteConfigurationOverrideActionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'RouteConfigurationOverrideActionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "RouteConfigurationOverrideActionParameters"}, } - def __init__( - self, - *, - parameters: "RouteConfigurationOverrideActionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.RouteConfigurationOverrideActionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the action. + :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RouteConfigurationOverrideActionParameters """ - super(DeliveryRuleRouteConfigurationOverrideAction, self).__init__(**kwargs) - self.name = 'RouteConfigurationOverride' # type: str + super().__init__(**kwargs) + self.name = "RouteConfigurationOverride" # type: str self.parameters = parameters @@ -4695,38 +4609,32 @@ class DeliveryRuleServerPortCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.ServerPortMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'ServerPortMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "ServerPortMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "ServerPortMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.ServerPortMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.ServerPortMatchConditionParameters """ - super(DeliveryRuleServerPortCondition, self).__init__(**kwargs) - self.name = 'ServerPort' # type: str + super().__init__(**kwargs) + self.name = "ServerPort" # type: str self.parameters = parameters @@ -4735,38 +4643,32 @@ class DeliveryRuleSocketAddrCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.SocketAddrMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'SocketAddrMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "SocketAddrMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "SocketAddrMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.SocketAddrMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.SocketAddrMatchConditionParameters """ - super(DeliveryRuleSocketAddrCondition, self).__init__(**kwargs) - self.name = 'SocketAddr' # type: str + super().__init__(**kwargs) + self.name = "SocketAddr" # type: str self.parameters = parameters @@ -4775,38 +4677,32 @@ class DeliveryRuleSslProtocolCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.SslProtocolMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'SslProtocolMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "SslProtocolMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "SslProtocolMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.SslProtocolMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.SslProtocolMatchConditionParameters """ - super(DeliveryRuleSslProtocolCondition, self).__init__(**kwargs) - self.name = 'SslProtocol' # type: str + super().__init__(**kwargs) + self.name = "SslProtocol" # type: str self.parameters = parameters @@ -4815,38 +4711,32 @@ class DeliveryRuleUrlFileExtensionCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.UrlFileExtensionMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlFileExtensionMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "UrlFileExtensionMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "UrlFileExtensionMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.UrlFileExtensionMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlFileExtensionMatchConditionParameters """ - super(DeliveryRuleUrlFileExtensionCondition, self).__init__(**kwargs) - self.name = 'UrlFileExtension' # type: str + super().__init__(**kwargs) + self.name = "UrlFileExtension" # type: str self.parameters = parameters @@ -4855,38 +4745,32 @@ class DeliveryRuleUrlFileNameCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.UrlFileNameMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlFileNameMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "UrlFileNameMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "UrlFileNameMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.UrlFileNameMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlFileNameMatchConditionParameters """ - super(DeliveryRuleUrlFileNameCondition, self).__init__(**kwargs) - self.name = 'UrlFileName' # type: str + super().__init__(**kwargs) + self.name = "UrlFileName" # type: str self.parameters = parameters @@ -4895,42 +4779,36 @@ class DeliveryRuleUrlPathCondition(DeliveryRuleCondition): 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". + :ivar name: The name of the condition for the delivery rule. Required. Known values are: + "RemoteAddress", "RequestMethod", "QueryString", "PostArgs", "RequestUri", "RequestHeader", + "RequestBody", "RequestScheme", "UrlPath", "UrlFileExtension", "UrlFileName", "HttpVersion", + "Cookies", "IsDevice", "SocketAddr", "ClientPort", "ServerPort", "HostName", and "SslProtocol". :vartype name: str or ~azure.mgmt.cdn.models.MatchVariable - :ivar parameters: Required. Defines the parameters for the condition. + :ivar parameters: Defines the parameters for the condition. Required. :vartype parameters: ~azure.mgmt.cdn.models.UrlPathMatchConditionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlPathMatchConditionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "UrlPathMatchConditionParameters"}, } - def __init__( - self, - *, - parameters: "UrlPathMatchConditionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.UrlPathMatchConditionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the condition. + :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlPathMatchConditionParameters """ - super(DeliveryRuleUrlPathCondition, self).__init__(**kwargs) - self.name = 'UrlPath' # type: str + super().__init__(**kwargs) + self.name = "UrlPath" # type: str self.parameters = parameters -class DimensionProperties(msrest.serialization.Model): +class DimensionProperties(_serialization.Model): """Type of operation: get, read, delete, etc. :ivar name: Name of dimension. @@ -4942,9 +4820,9 @@ class DimensionProperties(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'internal_name': {'key': 'internalName', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "internal_name": {"key": "internalName", "type": "str"}, } def __init__( @@ -4963,13 +4841,13 @@ def __init__( :keyword internal_name: Internal name of dimension. :paramtype internal_name: str """ - super(DimensionProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display_name = display_name self.internal_name = internal_name -class DomainValidationProperties(msrest.serialization.Model): +class DomainValidationProperties(_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. @@ -4981,22 +4859,18 @@ class DomainValidationProperties(msrest.serialization.Model): """ _validation = { - 'validation_token': {'readonly': True}, - 'expiration_date': {'readonly': True}, + "validation_token": {"readonly": True}, + "expiration_date": {"readonly": True}, } _attribute_map = { - 'validation_token': {'key': 'validationToken', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + "validation_token": {"key": "validationToken", "type": "str"}, + "expiration_date": {"key": "expirationDate", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(DomainValidationProperties, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.validation_token = None self.expiration_date = None @@ -5019,35 +4893,30 @@ class EdgeNode(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, + "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]'}, + "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, - *, - ip_address_groups: Optional[List["IpAddressGroup"]] = None, - **kwargs - ): + def __init__(self, *, ip_address_groups: Optional[List["_models.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) + super().__init__(**kwargs) self.ip_address_groups = ip_address_groups -class EdgenodeResult(msrest.serialization.Model): +class EdgenodeResult(_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. @@ -5059,30 +4928,25 @@ class EdgenodeResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[EdgeNode]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[EdgeNode]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class Endpoint(TrackedResource): +class Endpoint(TrackedResource): # pylint: disable=too-many-instance-attributes """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. @@ -5097,9 +4961,9 @@ class Endpoint(TrackedResource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar 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. @@ -5126,14 +4990,14 @@ class Endpoint(TrackedResource): :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". + contain query strings from being cached, or cache every request with a unique URL. Known values + are: "IgnoreQueryString", "BypassCaching", "UseQueryString", and "NotSet". :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". + driven optimization. Known values are: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", and "DynamicSiteAcceleration". :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 @@ -5163,56 +5027,63 @@ class Endpoint(TrackedResource): the traffic based on availability. :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 custom_domains: list[~azure.mgmt.cdn.models.DeepCreatedCustomDomain] + :ivar resource_state: Resource status of the endpoint. Known values are: "Creating", + "Deleting", "Running", "Starting", "Stopped", and "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}, - 'custom_domains': {'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]'}, - 'custom_domains': {'key': 'properties.customDomains', 'type': '[CustomDomain]'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( + :ivar provisioning_state: Provisioning status of the endpoint. Known values are: "Succeeded", + "Failed", "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.EndpointProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "host_name": {"readonly": True}, + "custom_domains": {"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]"}, + "custom_domains": {"key": "properties.customDomains", "type": "[DeepCreatedCustomDomain]"}, + "resource_state": {"key": "properties.resourceState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -5223,22 +5094,24 @@ def __init__( is_compression_enabled: Optional[bool] = None, is_http_allowed: Optional[bool] = None, is_https_allowed: Optional[bool] = None, - query_string_caching_behavior: Optional[Union[str, "QueryStringCachingBehavior"]] = None, - optimization_type: Optional[Union[str, "OptimizationType"]] = None, + query_string_caching_behavior: Optional[Union[str, "_models.QueryStringCachingBehavior"]] = None, + optimization_type: Optional[Union[str, "_models.OptimizationType"]] = None, probe_path: Optional[str] = None, - geo_filters: Optional[List["GeoFilter"]] = None, - default_origin_group: Optional["ResourceReference"] = None, - url_signing_keys: Optional[List["UrlSigningKey"]] = None, - delivery_policy: Optional["EndpointPropertiesUpdateParametersDeliveryPolicy"] = None, - web_application_firewall_policy_link: Optional["EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink"] = None, - origins: Optional[List["DeepCreatedOrigin"]] = None, - origin_groups: Optional[List["DeepCreatedOriginGroup"]] = None, + geo_filters: Optional[List["_models.GeoFilter"]] = None, + default_origin_group: Optional["_models.ResourceReference"] = None, + url_signing_keys: Optional[List["_models.UrlSigningKey"]] = None, + delivery_policy: Optional["_models.EndpointPropertiesUpdateParametersDeliveryPolicy"] = None, + web_application_firewall_policy_link: Optional[ + "_models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink" + ] = None, + origins: Optional[List["_models.DeepCreatedOrigin"]] = None, + origin_groups: Optional[List["_models.DeepCreatedOriginGroup"]] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword 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. @@ -5265,14 +5138,14 @@ def __init__( :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". + contain query strings from being cached, or cache every request with a unique URL. Known values + are: "IgnoreQueryString", "BypassCaching", "UseQueryString", and "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". + driven optimization. Known values are: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", and "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 @@ -5300,7 +5173,7 @@ def __init__( balancing the traffic based on availability. :paramtype origin_groups: list[~azure.mgmt.cdn.models.DeepCreatedOriginGroup] """ - super(Endpoint, self).__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, **kwargs) self.origin_path = origin_path self.content_types_to_compress = content_types_to_compress self.origin_host_header = origin_host_header @@ -5323,7 +5196,7 @@ def __init__( self.provisioning_state = None -class EndpointListResult(msrest.serialization.Model): +class EndpointListResult(_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. @@ -5335,30 +5208,25 @@ class EndpointListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Endpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Endpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class EndpointPropertiesUpdateParameters(msrest.serialization.Model): +class EndpointPropertiesUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """The JSON object containing endpoint update parameters. :ivar origin_path: A directory path on the origin that CDN can use to retrieve content from, @@ -5386,14 +5254,14 @@ class EndpointPropertiesUpdateParameters(msrest.serialization.Model): :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". + contain query strings from being cached, or cache every request with a unique URL. Known values + are: "IgnoreQueryString", "BypassCaching", "UseQueryString", and "NotSet". :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". + driven optimization. Known values are: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", and "DynamicSiteAcceleration". :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 @@ -5417,20 +5285,23 @@ class EndpointPropertiesUpdateParameters(msrest.serialization.Model): """ _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'}, + "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__( @@ -5442,14 +5313,16 @@ def __init__( is_compression_enabled: Optional[bool] = None, is_http_allowed: Optional[bool] = None, is_https_allowed: Optional[bool] = None, - query_string_caching_behavior: Optional[Union[str, "QueryStringCachingBehavior"]] = None, - optimization_type: Optional[Union[str, "OptimizationType"]] = None, + query_string_caching_behavior: Optional[Union[str, "_models.QueryStringCachingBehavior"]] = None, + optimization_type: Optional[Union[str, "_models.OptimizationType"]] = None, probe_path: Optional[str] = None, - geo_filters: Optional[List["GeoFilter"]] = None, - default_origin_group: Optional["ResourceReference"] = None, - url_signing_keys: Optional[List["UrlSigningKey"]] = None, - delivery_policy: Optional["EndpointPropertiesUpdateParametersDeliveryPolicy"] = None, - web_application_firewall_policy_link: Optional["EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink"] = None, + geo_filters: Optional[List["_models.GeoFilter"]] = None, + default_origin_group: Optional["_models.ResourceReference"] = None, + url_signing_keys: Optional[List["_models.UrlSigningKey"]] = None, + delivery_policy: Optional["_models.EndpointPropertiesUpdateParametersDeliveryPolicy"] = None, + web_application_firewall_policy_link: Optional[ + "_models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink" + ] = None, **kwargs ): """ @@ -5478,14 +5351,14 @@ def __init__( :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". + contain query strings from being cached, or cache every request with a unique URL. Known values + are: "IgnoreQueryString", "BypassCaching", "UseQueryString", and "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". + driven optimization. Known values are: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", and "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 @@ -5508,7 +5381,7 @@ def __init__( :paramtype web_application_firewall_policy_link: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink """ - super(EndpointPropertiesUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.origin_path = origin_path self.content_types_to_compress = content_types_to_compress self.origin_host_header = origin_host_header @@ -5525,7 +5398,7 @@ def __init__( self.web_application_firewall_policy_link = web_application_firewall_policy_link -class EndpointProperties(EndpointPropertiesUpdateParameters): +class EndpointProperties(EndpointPropertiesUpdateParameters): # pylint: disable=too-many-instance-attributes """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. @@ -5557,14 +5430,14 @@ class EndpointProperties(EndpointPropertiesUpdateParameters): :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". + contain query strings from being cached, or cache every request with a unique URL. Known values + are: "IgnoreQueryString", "BypassCaching", "UseQueryString", and "NotSet". :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". + driven optimization. Known values are: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", and "DynamicSiteAcceleration". :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 @@ -5588,70 +5461,76 @@ class EndpointProperties(EndpointPropertiesUpdateParameters): :ivar host_name: The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net. :vartype host_name: str - :ivar origins: Required. The source of the content being delivered via CDN. + :ivar origins: The source of the content being delivered via CDN. Required. :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. :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 custom_domains: list[~azure.mgmt.cdn.models.DeepCreatedCustomDomain] + :ivar resource_state: Resource status of the endpoint. Known values are: "Creating", + "Deleting", "Running", "Starting", "Stopped", and "Stopping". :vartype resource_state: str or ~azure.mgmt.cdn.models.EndpointResourceState - :ivar provisioning_state: Provisioning status of the endpoint. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning status of the endpoint. Known values are: "Succeeded", + "Failed", "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.EndpointProvisioningState """ _validation = { - 'host_name': {'readonly': True}, - 'origins': {'required': True}, - 'custom_domains': {'readonly': True}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "host_name": {"readonly": True}, + "origins": {"required": True}, + "custom_domains": {"readonly": 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]'}, - 'custom_domains': {'key': 'customDomains', 'type': '[CustomDomain]'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + "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]"}, + "custom_domains": {"key": "customDomains", "type": "[DeepCreatedCustomDomain]"}, + "resource_state": {"key": "resourceState", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( self, *, - origins: List["DeepCreatedOrigin"], + origins: List["_models.DeepCreatedOrigin"], origin_path: Optional[str] = None, content_types_to_compress: Optional[List[str]] = None, origin_host_header: Optional[str] = None, is_compression_enabled: Optional[bool] = None, is_http_allowed: Optional[bool] = None, is_https_allowed: Optional[bool] = None, - query_string_caching_behavior: Optional[Union[str, "QueryStringCachingBehavior"]] = None, - optimization_type: Optional[Union[str, "OptimizationType"]] = None, + query_string_caching_behavior: Optional[Union[str, "_models.QueryStringCachingBehavior"]] = None, + optimization_type: Optional[Union[str, "_models.OptimizationType"]] = None, probe_path: Optional[str] = None, - geo_filters: Optional[List["GeoFilter"]] = None, - default_origin_group: Optional["ResourceReference"] = None, - url_signing_keys: Optional[List["UrlSigningKey"]] = None, - delivery_policy: Optional["EndpointPropertiesUpdateParametersDeliveryPolicy"] = None, - web_application_firewall_policy_link: Optional["EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink"] = None, - origin_groups: Optional[List["DeepCreatedOriginGroup"]] = None, + geo_filters: Optional[List["_models.GeoFilter"]] = None, + default_origin_group: Optional["_models.ResourceReference"] = None, + url_signing_keys: Optional[List["_models.UrlSigningKey"]] = None, + delivery_policy: Optional["_models.EndpointPropertiesUpdateParametersDeliveryPolicy"] = None, + web_application_firewall_policy_link: Optional[ + "_models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink" + ] = None, + origin_groups: Optional[List["_models.DeepCreatedOriginGroup"]] = None, **kwargs ): """ @@ -5680,14 +5559,14 @@ def __init__( :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". + contain query strings from being cached, or cache every request with a unique URL. Known values + are: "IgnoreQueryString", "BypassCaching", "UseQueryString", and "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". + driven optimization. Known values are: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", and "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 @@ -5709,13 +5588,29 @@ def __init__( 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. + :keyword origins: The source of the content being delivered via CDN. Required. :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) + super().__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 @@ -5724,45 +5619,39 @@ def __init__( self.provisioning_state = None -class EndpointPropertiesUpdateParametersDeliveryPolicy(msrest.serialization.Model): +class EndpointPropertiesUpdateParametersDeliveryPolicy(_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. :ivar description: User-friendly description of the policy. :vartype description: str - :ivar rules: Required. A list of the delivery rules. + :ivar rules: A list of the delivery rules. Required. :vartype rules: list[~azure.mgmt.cdn.models.DeliveryRule] """ _validation = { - 'rules': {'required': True}, + "rules": {"required": True}, } _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[DeliveryRule]'}, + "description": {"key": "description", "type": "str"}, + "rules": {"key": "rules", "type": "[DeliveryRule]"}, } - def __init__( - self, - *, - rules: List["DeliveryRule"], - description: Optional[str] = None, - **kwargs - ): + def __init__(self, *, rules: List["_models.DeliveryRule"], 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. + :keyword rules: A list of the delivery rules. Required. :paramtype rules: list[~azure.mgmt.cdn.models.DeliveryRule] """ - super(EndpointPropertiesUpdateParametersDeliveryPolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.description = description self.rules = rules -class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(msrest.serialization.Model): +class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(_serialization.Model): """Defines the Web Application Firewall policy for the endpoint (if applicable). :ivar id: Resource ID. @@ -5770,27 +5659,22 @@ class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(msrest. """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str """ - super(EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class EndpointUpdateParameters(msrest.serialization.Model): +class EndpointUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """Properties required to create or update an endpoint. - :ivar tags: A set of tags. Endpoint tags. + :ivar 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. @@ -5817,14 +5701,14 @@ class EndpointUpdateParameters(msrest.serialization.Model): :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". + contain query strings from being cached, or cache every request with a unique URL. Known values + are: "IgnoreQueryString", "BypassCaching", "UseQueryString", and "NotSet". :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". + driven optimization. Known values are: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", and "DynamicSiteAcceleration". :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 @@ -5848,21 +5732,27 @@ class EndpointUpdateParameters(msrest.serialization.Model): """ _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'}, + "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__( @@ -5875,18 +5765,20 @@ def __init__( is_compression_enabled: Optional[bool] = None, is_http_allowed: Optional[bool] = None, is_https_allowed: Optional[bool] = None, - query_string_caching_behavior: Optional[Union[str, "QueryStringCachingBehavior"]] = None, - optimization_type: Optional[Union[str, "OptimizationType"]] = None, + query_string_caching_behavior: Optional[Union[str, "_models.QueryStringCachingBehavior"]] = None, + optimization_type: Optional[Union[str, "_models.OptimizationType"]] = None, probe_path: Optional[str] = None, - geo_filters: Optional[List["GeoFilter"]] = None, - default_origin_group: Optional["ResourceReference"] = None, - url_signing_keys: Optional[List["UrlSigningKey"]] = None, - delivery_policy: Optional["EndpointPropertiesUpdateParametersDeliveryPolicy"] = None, - web_application_firewall_policy_link: Optional["EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink"] = None, + geo_filters: Optional[List["_models.GeoFilter"]] = None, + default_origin_group: Optional["_models.ResourceReference"] = None, + url_signing_keys: Optional[List["_models.UrlSigningKey"]] = None, + delivery_policy: Optional["_models.EndpointPropertiesUpdateParametersDeliveryPolicy"] = None, + web_application_firewall_policy_link: Optional[ + "_models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink" + ] = None, **kwargs ): """ - :keyword tags: A set of tags. Endpoint tags. + :keyword 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. @@ -5913,14 +5805,14 @@ def __init__( :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". + contain query strings from being cached, or cache every request with a unique URL. Known values + are: "IgnoreQueryString", "BypassCaching", "UseQueryString", and "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". + driven optimization. Known values are: "GeneralWebDelivery", "GeneralMediaStreaming", + "VideoOnDemandMediaStreaming", "LargeFileDownload", and "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 @@ -5943,7 +5835,7 @@ def __init__( :paramtype web_application_firewall_policy_link: ~azure.mgmt.cdn.models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink """ - super(EndpointUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.origin_path = origin_path self.content_types_to_compress = content_types_to_compress @@ -5961,7 +5853,7 @@ def __init__( self.web_application_firewall_policy_link = web_application_firewall_policy_link -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -5969,31 +5861,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorDetail(msrest.serialization.Model): +class ErrorDetail(_serialization.Model): """The error detail. Variables are only populated by the server, and will be ignored when sending a request. @@ -6011,28 +5899,24 @@ class ErrorDetail(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "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]'}, + "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(ErrorDetail, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -6040,7 +5924,7 @@ def __init__( self.additional_info = None -class ErrorResponse(msrest.serialization.Model): +class ErrorResponse(_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. @@ -6048,165 +5932,155 @@ class ErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, + "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__( - self, - *, - error: Optional["ErrorDetail"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): """ :keyword error: The error object. :paramtype error: ~azure.mgmt.cdn.models.ErrorDetail """ - super(ErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class GeoFilter(msrest.serialization.Model): +class GeoFilter(_serialization.Model): """Rules defining user's geo access within a CDN endpoint. All required parameters must be populated in order to send to Azure. - :ivar relative_path: Required. Relative path applicable to geo filter. (e.g. '/mypictures', - '/mypicture/kitty.jpg', and etc.). + :ivar relative_path: Relative path applicable to geo filter. (e.g. '/mypictures', + '/mypicture/kitty.jpg', and etc.). Required. :vartype relative_path: str - :ivar action: Required. Action of the geo filter, i.e. allow or block access. Possible values - include: "Block", "Allow". + :ivar action: Action of the geo filter, i.e. allow or block access. Required. Known values are: + "Block" and "Allow". :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. + :ivar country_codes: Two letter country or region codes defining user country or region access + in a geo filter, e.g. AU, MX, US. Required. :vartype country_codes: list[str] """ _validation = { - 'relative_path': {'required': True}, - 'action': {'required': True}, - 'country_codes': {'required': True}, + "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]'}, + "relative_path": {"key": "relativePath", "type": "str"}, + "action": {"key": "action", "type": "str"}, + "country_codes": {"key": "countryCodes", "type": "[str]"}, } def __init__( - self, - *, - relative_path: str, - action: Union[str, "GeoFilterActions"], - country_codes: List[str], - **kwargs + self, *, relative_path: str, action: Union[str, "_models.GeoFilterActions"], country_codes: List[str], **kwargs ): """ - :keyword relative_path: Required. Relative path applicable to geo filter. (e.g. '/mypictures', - '/mypicture/kitty.jpg', and etc.). + :keyword relative_path: Relative path applicable to geo filter. (e.g. '/mypictures', + '/mypicture/kitty.jpg', and etc.). Required. :paramtype relative_path: str - :keyword action: Required. Action of the geo filter, i.e. allow or block access. Possible - values include: "Block", "Allow". + :keyword action: Action of the geo filter, i.e. allow or block access. Required. Known values + are: "Block" and "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. + :keyword country_codes: Two letter country or region codes defining user country or region + access in a geo filter, e.g. AU, MX, US. Required. :paramtype country_codes: list[str] """ - super(GeoFilter, self).__init__(**kwargs) + super().__init__(**kwargs) self.relative_path = relative_path self.action = action self.country_codes = country_codes -class HeaderActionParameters(msrest.serialization.Model): +class HeaderActionParameters(_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 type_name: Has constant value: "DeliveryRuleHeaderActionParameters". - :vartype type_name: str - :ivar header_action: Required. Action to perform. Possible values include: "Append", - "Overwrite", "Delete". + :ivar type_name: Required. "DeliveryRuleHeaderActionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.HeaderActionParametersTypeName + :ivar header_action: Action to perform. Required. Known values are: "Append", "Overwrite", and + "Delete". :vartype header_action: str or ~azure.mgmt.cdn.models.HeaderAction - :ivar header_name: Required. Name of the header to modify. + :ivar header_name: Name of the header to modify. Required. :vartype header_name: str :ivar value: Value for the specified action. :vartype value: str """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'header_action': {'required': True}, - 'header_name': {'required': True}, + "type_name": {"required": True}, + "header_action": {"required": True}, + "header_name": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', 'type': 'str'}, - 'header_action': {'key': 'headerAction', 'type': 'str'}, - 'header_name': {'key': 'headerName', 'type': 'str'}, - 'value': {'key': 'value', '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"}, } - type_name = "DeliveryRuleHeaderActionParameters" - def __init__( self, *, - header_action: Union[str, "HeaderAction"], + type_name: Union[str, "_models.HeaderActionParametersTypeName"], + header_action: Union[str, "_models.HeaderAction"], header_name: str, value: Optional[str] = None, **kwargs ): """ - :keyword header_action: Required. Action to perform. Possible values include: "Append", - "Overwrite", "Delete". + :keyword type_name: Required. "DeliveryRuleHeaderActionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.HeaderActionParametersTypeName + :keyword header_action: Action to perform. Required. Known values are: "Append", "Overwrite", + and "Delete". :paramtype header_action: str or ~azure.mgmt.cdn.models.HeaderAction - :keyword header_name: Required. Name of the header to modify. + :keyword header_name: Name of the header to modify. Required. :paramtype header_name: str :keyword value: Value for the specified action. :paramtype value: str """ - super(HeaderActionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.header_action = header_action self.header_name = header_name self.value = value -class HealthProbeParameters(msrest.serialization.Model): +class HealthProbeParameters(_serialization.Model): """The JSON object that contains the properties to send health probes to origin. :ivar probe_path: The path relative to the origin that is used to determine the health of the origin. :vartype probe_path: str - :ivar probe_request_type: The type of health probe request that is made. Possible values - include: "NotSet", "GET", "HEAD". + :ivar probe_request_type: The type of health probe request that is made. Known values are: + "NotSet", "GET", and "HEAD". :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". + :ivar probe_protocol: Protocol to use for health probe. Known values are: "NotSet", "Http", and + "Https". :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 = { - 'probe_interval_in_seconds': {'maximum': 255, 'minimum': 1}, + "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'}, + "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, *, probe_path: Optional[str] = None, - probe_request_type: Optional[Union[str, "HealthProbeRequestType"]] = None, - probe_protocol: Optional[Union[str, "ProbeProtocol"]] = None, + probe_request_type: Optional[Union[str, "_models.HealthProbeRequestType"]] = None, + probe_protocol: Optional[Union[str, "_models.ProbeProtocol"]] = None, probe_interval_in_seconds: Optional[int] = None, **kwargs ): @@ -6214,35 +6088,33 @@ def __init__( :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". + :keyword probe_request_type: The type of health probe request that is made. Known values are: + "NotSet", "GET", and "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". + :keyword probe_protocol: Protocol to use for health probe. Known values are: "NotSet", "Http", + and "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) + super().__init__(**kwargs) self.probe_path = probe_path self.probe_request_type = probe_request_type self.probe_protocol = probe_protocol self.probe_interval_in_seconds = probe_interval_in_seconds -class HostNameMatchConditionParameters(msrest.serialization.Model): +class HostNameMatchConditionParameters(_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". + :ivar type_name: Required. "DeliveryRuleHostNameConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.HostNameMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "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 @@ -6253,33 +6125,34 @@ class HostNameMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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"], + type_name: Union[str, "_models.HostNameMatchConditionParametersTypeName"], + operator: Union[str, "_models.HostNameOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword type_name: Required. "DeliveryRuleHostNameConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.HostNameMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -6288,14 +6161,15 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(HostNameMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class HttpErrorRangeParameters(msrest.serialization.Model): +class HttpErrorRangeParameters(_serialization.Model): """The JSON object that represents the range for http status codes. :ivar begin: The inclusive start of the http status code range. @@ -6305,43 +6179,35 @@ class HttpErrorRangeParameters(msrest.serialization.Model): """ _validation = { - 'begin': {'maximum': 999, 'minimum': 100}, - 'end': {'maximum': 999, 'minimum': 100}, + "begin": {"maximum": 999, "minimum": 100}, + "end": {"maximum": 999, "minimum": 100}, } _attribute_map = { - 'begin': {'key': 'begin', 'type': 'int'}, - 'end': {'key': 'end', 'type': 'int'}, + "begin": {"key": "begin", "type": "int"}, + "end": {"key": "end", "type": "int"}, } - def __init__( - self, - *, - begin: Optional[int] = None, - end: Optional[int] = None, - **kwargs - ): + def __init__(self, *, begin: Optional[int] = None, 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) + super().__init__(**kwargs) self.begin = begin self.end = end -class HttpVersionMatchConditionParameters(msrest.serialization.Model): +class HttpVersionMatchConditionParameters(_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 type_name: Has constant value: "DeliveryRuleHttpVersionConditionParameters". - :vartype type_name: str - :ivar operator: Required. Describes operator to be matched. Possible values include: "Equal". + :ivar type_name: Required. "DeliveryRuleHttpVersionConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.HttpVersionMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. "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 @@ -6352,32 +6218,32 @@ class HttpVersionMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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 = "DeliveryRuleHttpVersionConditionParameters" - def __init__( self, *, - operator: Union[str, "HttpVersionOperator"], + type_name: Union[str, "_models.HttpVersionMatchConditionParametersTypeName"], + operator: Union[str, "_models.HttpVersionOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: - "Equal". + :keyword type_name: Required. "DeliveryRuleHttpVersionConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.HttpVersionMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. "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 @@ -6386,14 +6252,15 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(HttpVersionMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class IpAddressGroup(msrest.serialization.Model): +class IpAddressGroup(_serialization.Model): """CDN Ip address group. :ivar delivery_region: The delivery region of the ip address group. @@ -6405,17 +6272,17 @@ class IpAddressGroup(msrest.serialization.Model): """ _attribute_map = { - 'delivery_region': {'key': 'deliveryRegion', 'type': 'str'}, - 'ipv4_addresses': {'key': 'ipv4Addresses', 'type': '[CidrIpAddress]'}, - 'ipv6_addresses': {'key': 'ipv6Addresses', 'type': '[CidrIpAddress]'}, + "delivery_region": {"key": "deliveryRegion", "type": "str"}, + "ipv4_addresses": {"key": "ipv4Addresses", "type": "[CidrIpAddress]"}, + "ipv6_addresses": {"key": "ipv6Addresses", "type": "[CidrIpAddress]"}, } def __init__( self, *, delivery_region: Optional[str] = None, - ipv4_addresses: Optional[List["CidrIpAddress"]] = None, - ipv6_addresses: Optional[List["CidrIpAddress"]] = None, + ipv4_addresses: Optional[List["_models.CidrIpAddress"]] = None, + ipv6_addresses: Optional[List["_models.CidrIpAddress"]] = None, **kwargs ): """ @@ -6426,22 +6293,20 @@ def __init__( :keyword ipv6_addresses: The list of ip v6 addresses. :paramtype ipv6_addresses: list[~azure.mgmt.cdn.models.CidrIpAddress] """ - super(IpAddressGroup, self).__init__(**kwargs) + super().__init__(**kwargs) self.delivery_region = delivery_region self.ipv4_addresses = ipv4_addresses self.ipv6_addresses = ipv6_addresses -class IsDeviceMatchConditionParameters(msrest.serialization.Model): +class IsDeviceMatchConditionParameters(_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 type_name: Has constant value: "DeliveryRuleIsDeviceConditionParameters". - :vartype type_name: str - :ivar operator: Required. Describes operator to be matched. Possible values include: "Equal". + :ivar type_name: Required. "DeliveryRuleIsDeviceConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.IsDeviceMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. "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 @@ -6453,32 +6318,32 @@ class IsDeviceMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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 = "DeliveryRuleIsDeviceConditionParameters" - def __init__( self, *, - operator: Union[str, "IsDeviceOperator"], + type_name: Union[str, "_models.IsDeviceMatchConditionParametersTypeName"], + operator: Union[str, "_models.IsDeviceOperator"], negate_condition: Optional[bool] = None, - match_values: Optional[List[Union[str, "IsDeviceMatchConditionParametersMatchValuesItem"]]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + match_values: Optional[List[Union[str, "_models.IsDeviceMatchConditionParametersMatchValuesItem"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: - "Equal". + :keyword type_name: Required. "DeliveryRuleIsDeviceConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.IsDeviceMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. "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 @@ -6488,100 +6353,101 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(IsDeviceMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class KeyVaultCertificateSourceParameters(msrest.serialization.Model): +class KeyVaultCertificateSourceParameters(_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 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. + :ivar type_name: Required. "KeyVaultCertificateSourceParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.KeyVaultCertificateSourceParametersTypeName + :ivar subscription_id: Subscription Id of the user's Key Vault containing the SSL certificate. + Required. :vartype subscription_id: str - :ivar resource_group_name: Required. Resource group of the user's Key Vault containing the SSL - certificate. + :ivar resource_group_name: Resource group of the user's Key Vault containing the SSL + certificate. Required. :vartype resource_group_name: str - :ivar vault_name: Required. The name of the user's Key Vault containing the SSL certificate. + :ivar vault_name: The name of the user's Key Vault containing the SSL certificate. Required. :vartype vault_name: str - :ivar secret_name: Required. The name of Key Vault Secret (representing the full certificate - PFX) in Key Vault. + :ivar secret_name: The name of Key Vault Secret (representing the full certificate PFX) in Key + Vault. Required. :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". + :ivar update_rule: Describes the action that shall be taken when the certificate is updated in + Key Vault. Required. "NoAction" :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". + :ivar delete_rule: Describes the action that shall be taken when the certificate is removed + from Key Vault. Required. "NoAction" :vartype delete_rule: str or ~azure.mgmt.cdn.models.DeleteRule """ _validation = { - 'type_name': {'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}, + "type_name": {"required": 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 = { - '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'}, - 'secret_name': {'key': 'secretName', 'type': 'str'}, - 'secret_version': {'key': 'secretVersion', 'type': 'str'}, - 'update_rule': {'key': 'updateRule', 'type': 'str'}, - 'delete_rule': {'key': 'deleteRule', '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"}, + "secret_name": {"key": "secretName", "type": "str"}, + "secret_version": {"key": "secretVersion", "type": "str"}, + "update_rule": {"key": "updateRule", "type": "str"}, + "delete_rule": {"key": "deleteRule", "type": "str"}, } - type_name = "KeyVaultCertificateSourceParameters" - def __init__( self, *, + type_name: Union[str, "_models.KeyVaultCertificateSourceParametersTypeName"], subscription_id: str, resource_group_name: str, vault_name: str, secret_name: str, - update_rule: Union[str, "UpdateRule"], - delete_rule: Union[str, "DeleteRule"], + update_rule: Union[str, "_models.UpdateRule"], + delete_rule: Union[str, "_models.DeleteRule"], secret_version: Optional[str] = None, **kwargs ): """ - :keyword subscription_id: Required. Subscription Id of the user's Key Vault containing the SSL - certificate. + :keyword type_name: Required. "KeyVaultCertificateSourceParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.KeyVaultCertificateSourceParametersTypeName + :keyword subscription_id: Subscription Id of the user's Key Vault containing the SSL + certificate. Required. :paramtype subscription_id: str - :keyword resource_group_name: Required. Resource group of the user's Key Vault containing the - SSL certificate. + :keyword resource_group_name: Resource group of the user's Key Vault containing the SSL + certificate. Required. :paramtype resource_group_name: str - :keyword vault_name: Required. The name of the user's Key Vault containing the SSL certificate. + :keyword vault_name: The name of the user's Key Vault containing the SSL certificate. Required. :paramtype vault_name: str - :keyword secret_name: Required. The name of Key Vault Secret (representing the full certificate - PFX) in Key Vault. + :keyword secret_name: The name of Key Vault Secret (representing the full certificate PFX) in + Key Vault. Required. :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". + :keyword update_rule: Describes the action that shall be taken when the certificate is updated + in Key Vault. Required. "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". + :keyword delete_rule: Describes the action that shall be taken when the certificate is removed + from Key Vault. Required. "NoAction" :paramtype delete_rule: str or ~azure.mgmt.cdn.models.DeleteRule """ - super(KeyVaultCertificateSourceParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.subscription_id = subscription_id self.resource_group_name = resource_group_name self.vault_name = vault_name @@ -6591,51 +6457,48 @@ def __init__( self.delete_rule = delete_rule -class KeyVaultSigningKeyParameters(msrest.serialization.Model): +class KeyVaultSigningKeyParameters(_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 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. + :ivar type_name: Required. "KeyVaultSigningKeyParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.KeyVaultSigningKeyParametersTypeName + :ivar subscription_id: Subscription Id of the user's Key Vault containing the secret. Required. :vartype subscription_id: str - :ivar resource_group_name: Required. Resource group of the user's Key Vault containing the - secret. + :ivar resource_group_name: Resource group of the user's Key Vault containing the secret. + Required. :vartype resource_group_name: str - :ivar vault_name: Required. The name of the user's Key Vault containing the secret. + :ivar vault_name: The name of the user's Key Vault containing the secret. Required. :vartype vault_name: str - :ivar secret_name: Required. The name of secret in Key Vault. + :ivar secret_name: The name of secret in Key Vault. Required. :vartype secret_name: str - :ivar secret_version: Required. The version(GUID) of secret in Key Vault. + :ivar secret_version: The version(GUID) of secret in Key Vault. Required. :vartype secret_version: str """ _validation = { - 'type_name': {'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}, + "type_name": {"required": True}, + "subscription_id": {"required": True}, + "resource_group_name": {"required": True}, + "vault_name": {"required": True}, + "secret_name": {"required": True}, + "secret_version": {"required": True}, } _attribute_map = { - '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'}, - 'secret_name': {'key': 'secretName', 'type': 'str'}, - 'secret_version': {'key': 'secretVersion', '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"}, + "secret_name": {"key": "secretName", "type": "str"}, + "secret_version": {"key": "secretVersion", "type": "str"}, } - type_name = "KeyVaultSigningKeyParameters" - def __init__( self, *, + type_name: Union[str, "_models.KeyVaultSigningKeyParametersTypeName"], subscription_id: str, resource_group_name: str, vault_name: str, @@ -6644,20 +6507,23 @@ def __init__( **kwargs ): """ - :keyword subscription_id: Required. Subscription Id of the user's Key Vault containing the - secret. + :keyword type_name: Required. "KeyVaultSigningKeyParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.KeyVaultSigningKeyParametersTypeName + :keyword subscription_id: Subscription Id of the user's Key Vault containing the secret. + Required. :paramtype subscription_id: str - :keyword resource_group_name: Required. Resource group of the user's Key Vault containing the - secret. + :keyword resource_group_name: Resource group of the user's Key Vault containing the secret. + Required. :paramtype resource_group_name: str - :keyword vault_name: Required. The name of the user's Key Vault containing the secret. + :keyword vault_name: The name of the user's Key Vault containing the secret. Required. :paramtype vault_name: str - :keyword secret_name: Required. The name of secret in Key Vault. + :keyword secret_name: The name of secret in Key Vault. Required. :paramtype secret_name: str - :keyword secret_version: Required. The version(GUID) of secret in Key Vault. + :keyword secret_version: The version(GUID) of secret in Key Vault. Required. :paramtype secret_version: str """ - super(KeyVaultSigningKeyParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.subscription_id = subscription_id self.resource_group_name = resource_group_name self.vault_name = vault_name @@ -6665,7 +6531,7 @@ def __init__( self.secret_version = secret_version -class LoadBalancingSettingsParameters(msrest.serialization.Model): +class LoadBalancingSettingsParameters(_serialization.Model): """Round-Robin load balancing settings for a backend pool. :ivar sample_size: The number of samples to consider for load balancing decisions. @@ -6679,9 +6545,9 @@ class LoadBalancingSettingsParameters(msrest.serialization.Model): """ _attribute_map = { - 'sample_size': {'key': 'sampleSize', 'type': 'int'}, - 'successful_samples_required': {'key': 'successfulSamplesRequired', 'type': 'int'}, - 'additional_latency_in_milliseconds': {'key': 'additionalLatencyInMilliseconds', 'type': 'int'}, + "sample_size": {"key": "sampleSize", "type": "int"}, + "successful_samples_required": {"key": "successfulSamplesRequired", "type": "int"}, + "additional_latency_in_milliseconds": {"key": "additionalLatencyInMilliseconds", "type": "int"}, } def __init__( @@ -6702,46 +6568,41 @@ def __init__( to fall into the lowest latency bucket. :paramtype additional_latency_in_milliseconds: int """ - super(LoadBalancingSettingsParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.sample_size = sample_size self.successful_samples_required = successful_samples_required self.additional_latency_in_milliseconds = additional_latency_in_milliseconds -class LoadParameters(msrest.serialization.Model): +class LoadParameters(_serialization.Model): """Parameters required for content load. All required parameters must be populated in order to send to Azure. - :ivar content_paths: Required. The path to the content to be loaded. Path should be a relative - file URL of the origin. + :ivar content_paths: The path to the content to be loaded. Path should be a relative file URL + of the origin. Required. :vartype content_paths: list[str] """ _validation = { - 'content_paths': {'required': True}, + "content_paths": {"required": True}, } _attribute_map = { - 'content_paths': {'key': 'contentPaths', 'type': '[str]'}, + "content_paths": {"key": "contentPaths", "type": "[str]"}, } - def __init__( - self, - *, - content_paths: List[str], - **kwargs - ): + def __init__(self, *, 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. + :keyword content_paths: The path to the content to be loaded. Path should be a relative file + URL of the origin. Required. :paramtype content_paths: list[str] """ - super(LoadParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_paths = content_paths -class LogSpecification(msrest.serialization.Model): +class LogSpecification(_serialization.Model): """Log specification of operation. :ivar name: Name of log specification. @@ -6755,10 +6616,10 @@ class LogSpecification(msrest.serialization.Model): """ _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'}, + "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__( @@ -6780,7 +6641,7 @@ def __init__( :keyword log_filter_pattern: Pattern to filter based on name. :paramtype log_filter_pattern: str """ - super(LogSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration @@ -6792,8 +6653,8 @@ class ManagedCertificate(Certificate): 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". + :ivar type: The type of the secret resource. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". :vartype type: str or ~azure.mgmt.cdn.models.SecretType :ivar subject: Subject name in the certificate. :vartype subject: str @@ -6802,28 +6663,23 @@ class ManagedCertificate(Certificate): """ _validation = { - 'subject': {'readonly': True}, - 'expiration_date': {'readonly': 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'}, + "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 - ): + def __init__(self, *, type: Optional[Union[str, "_models.SecretType"]] = None, **kwargs): """ - :keyword type: The type of the secret resource. Possible values include: "UrlSigningKey", - "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :keyword type: The type of the secret resource. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". :paramtype type: str or ~azure.mgmt.cdn.models.SecretType """ - super(ManagedCertificate, self).__init__(type=type, **kwargs) + super().__init__(type=type, **kwargs) class ManagedCertificateParameters(SecretParameters): @@ -6833,9 +6689,8 @@ class ManagedCertificateParameters(SecretParameters): 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". + :ivar type: The type of the secret resource. Required. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". :vartype type: str or ~azure.mgmt.cdn.models.SecretType :ivar subject: Subject name in the certificate. :vartype subject: str @@ -6844,30 +6699,26 @@ class ManagedCertificateParameters(SecretParameters): """ _validation = { - 'type': {'required': True}, - 'subject': {'readonly': True}, - 'expiration_date': {'readonly': True}, + "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'}, + "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 + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.type = "ManagedCertificate" # type: str self.subject = None self.expiration_date = None -class ManagedRuleDefinition(msrest.serialization.Model): +class ManagedRuleDefinition(_serialization.Model): """Describes a managed rule definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -6879,27 +6730,23 @@ class ManagedRuleDefinition(msrest.serialization.Model): """ _validation = { - 'rule_id': {'readonly': True}, - 'description': {'readonly': True}, + "rule_id": {"readonly": True}, + "description": {"readonly": True}, } _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "rule_id": {"key": "ruleId", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ManagedRuleDefinition, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.rule_id = None self.description = None -class ManagedRuleGroupDefinition(msrest.serialization.Model): +class ManagedRuleGroupDefinition(_serialization.Model): """Describes a managed rule group. Variables are only populated by the server, and will be ignored when sending a request. @@ -6913,128 +6760,118 @@ class ManagedRuleGroupDefinition(msrest.serialization.Model): """ _validation = { - 'rule_group_name': {'readonly': True}, - 'description': {'readonly': True}, - 'rules': {'readonly': True}, + "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]'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.rule_group_name = None self.description = None self.rules = None -class ManagedRuleGroupOverride(msrest.serialization.Model): +class ManagedRuleGroupOverride(_serialization.Model): """Defines a managed rule group override setting. All required parameters must be populated in order to send to Azure. - :ivar rule_group_name: Required. Describes the managed rule group within the rule set to - override. + :ivar rule_group_name: Describes the managed rule group within the rule set to override. + Required. :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. + :ivar rules: List of rules that will be enabled. If none specified, all rules in the group will + be disabled. :vartype rules: list[~azure.mgmt.cdn.models.ManagedRuleOverride] """ _validation = { - 'rule_group_name': {'required': True}, + "rule_group_name": {"required": True}, } _attribute_map = { - 'rule_group_name': {'key': 'ruleGroupName', 'type': 'str'}, - 'rules': {'key': 'rules', 'type': '[ManagedRuleOverride]'}, + "rule_group_name": {"key": "ruleGroupName", "type": "str"}, + "rules": {"key": "rules", "type": "[ManagedRuleOverride]"}, } - def __init__( - self, - *, - rule_group_name: str, - rules: Optional[List["ManagedRuleOverride"]] = None, - **kwargs - ): + def __init__(self, *, rule_group_name: str, rules: Optional[List["_models.ManagedRuleOverride"]] = None, **kwargs): """ - :keyword rule_group_name: Required. Describes the managed rule group within the rule set to - override. + :keyword rule_group_name: Describes the managed rule group within the rule set to override. + Required. :paramtype rule_group_name: str - :keyword rules: List of rules that will be disabled. If none specified, all rules in the group + :keyword rules: List of rules that will be enabled. If none specified, all rules in the group will be disabled. :paramtype rules: list[~azure.mgmt.cdn.models.ManagedRuleOverride] """ - super(ManagedRuleGroupOverride, self).__init__(**kwargs) + super().__init__(**kwargs) self.rule_group_name = rule_group_name self.rules = rules -class ManagedRuleOverride(msrest.serialization.Model): +class ManagedRuleOverride(_serialization.Model): """Defines a managed rule group override setting. All required parameters must be populated in order to send to Azure. - :ivar rule_id: Required. Identifier for the managed rule. + :ivar rule_id: Identifier for the managed rule. Required. :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". + Disabled if not specified. Known values are: "Disabled" and "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". + :ivar action: Describes the override action to be applied when rule matches. Known values are: + "Allow", "Block", "Log", and "Redirect". :vartype action: str or ~azure.mgmt.cdn.models.ActionType """ _validation = { - 'rule_id': {'required': True}, + "rule_id": {"required": True}, } _attribute_map = { - 'rule_id': {'key': 'ruleId', 'type': 'str'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'action': {'key': 'action', 'type': 'str'}, + "rule_id": {"key": "ruleId", "type": "str"}, + "enabled_state": {"key": "enabledState", "type": "str"}, + "action": {"key": "action", "type": "str"}, } def __init__( self, *, rule_id: str, - enabled_state: Optional[Union[str, "ManagedRuleEnabledState"]] = None, - action: Optional[Union[str, "ActionType"]] = None, + enabled_state: Optional[Union[str, "_models.ManagedRuleEnabledState"]] = None, + action: Optional[Union[str, "_models.ActionType"]] = None, **kwargs ): """ - :keyword rule_id: Required. Identifier for the managed rule. + :keyword rule_id: Identifier for the managed rule. Required. :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". + to Disabled if not specified. Known values are: "Disabled" and "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". + :keyword action: Describes the override action to be applied when rule matches. Known values + are: "Allow", "Block", "Log", and "Redirect". :paramtype action: str or ~azure.mgmt.cdn.models.ActionType """ - super(ManagedRuleOverride, self).__init__(**kwargs) + super().__init__(**kwargs) self.rule_id = rule_id self.enabled_state = enabled_state self.action = action -class ManagedRuleSet(msrest.serialization.Model): +class ManagedRuleSet(_serialization.Model): """Defines a managed rule set. All required parameters must be populated in order to send to Azure. - :ivar rule_set_type: Required. Defines the rule set type to use. + :ivar rule_set_type: Defines the rule set type to use. Required. :vartype rule_set_type: str - :ivar rule_set_version: Required. Defines the version of the rule set to use. + :ivar rule_set_version: Defines the version of the rule set to use. Required. :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. @@ -7044,16 +6881,16 @@ class ManagedRuleSet(msrest.serialization.Model): """ _validation = { - 'rule_set_type': {'required': True}, - 'rule_set_version': {'required': True}, - 'anomaly_score': {'maximum': 20, 'minimum': 0}, + "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]'}, + "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__( @@ -7062,13 +6899,13 @@ def __init__( rule_set_type: str, rule_set_version: str, anomaly_score: Optional[int] = None, - rule_group_overrides: Optional[List["ManagedRuleGroupOverride"]] = None, + rule_group_overrides: Optional[List["_models.ManagedRuleGroupOverride"]] = None, **kwargs ): """ - :keyword rule_set_type: Required. Defines the rule set type to use. + :keyword rule_set_type: Defines the rule set type to use. Required. :paramtype rule_set_type: str - :keyword rule_set_version: Required. Defines the version of the rule set to use. + :keyword rule_set_version: Defines the version of the rule set to use. Required. :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. @@ -7076,7 +6913,7 @@ def __init__( :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) + super().__init__(**kwargs) self.rule_set_type = rule_set_type self.rule_set_version = rule_set_version self.anomaly_score = anomaly_score @@ -7110,40 +6947,35 @@ class ManagedRuleSetDefinition(Resource): """ _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}, + "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]'}, + "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, - *, - sku: Optional["Sku"] = None, - **kwargs - ): + def __init__(self, *, sku: Optional["_models.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) + super().__init__(**kwargs) self.sku = sku self.provisioning_state = None self.rule_set_type = None @@ -7151,7 +6983,7 @@ def __init__( self.rule_groups = None -class ManagedRuleSetDefinitionList(msrest.serialization.Model): +class ManagedRuleSetDefinitionList(_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. @@ -7163,30 +6995,25 @@ class ManagedRuleSetDefinitionList(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedRuleSetDefinition]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ManagedRuleSetDefinition]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class ManagedRuleSetList(msrest.serialization.Model): +class ManagedRuleSetList(_serialization.Model): """Defines the list of managed rule sets for the policy. :ivar managed_rule_sets: List of rule sets. @@ -7194,93 +7021,88 @@ class ManagedRuleSetList(msrest.serialization.Model): """ _attribute_map = { - 'managed_rule_sets': {'key': 'managedRuleSets', 'type': '[ManagedRuleSet]'}, + "managed_rule_sets": {"key": "managedRuleSets", "type": "[ManagedRuleSet]"}, } - def __init__( - self, - *, - managed_rule_sets: Optional[List["ManagedRuleSet"]] = None, - **kwargs - ): + def __init__(self, *, managed_rule_sets: Optional[List["_models.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) + super().__init__(**kwargs) self.managed_rule_sets = managed_rule_sets -class MatchCondition(msrest.serialization.Model): +class MatchCondition(_serialization.Model): """Define match conditions. All required parameters must be populated in order to send to Azure. - :ivar match_variable: Required. Match variable to compare against. Possible values include: + :ivar match_variable: Match variable to compare against. Required. Known values are: "RemoteAddr", "SocketAddr", "RequestMethod", "RequestHeader", "RequestUri", "QueryString", - "RequestBody", "Cookies", "PostArgs". + "RequestBody", "Cookies", and "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. :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". + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "IPMatch", + "GeoMatch", "Equal", "Contains", "LessThan", "GreaterThan", "LessThanOrEqual", + "GreaterThanOrEqual", "BeginsWith", "EndsWith", and "RegEx". :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. + :ivar match_value: List of possible match values. Required. :vartype match_value: list[str] :ivar transforms: List of transforms. :vartype transforms: list[str or ~azure.mgmt.cdn.models.TransformType] """ _validation = { - 'match_variable': {'required': True}, - 'operator': {'required': True}, - 'match_value': {'required': True}, + "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]'}, + "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, *, - match_variable: Union[str, "WafMatchVariable"], - operator: Union[str, "Operator"], + match_variable: Union[str, "_models.WafMatchVariable"], + operator: Union[str, "_models.Operator"], match_value: List[str], selector: Optional[str] = None, negate_condition: Optional[bool] = None, - transforms: Optional[List[Union[str, "TransformType"]]] = None, + transforms: Optional[List[Union[str, "_models.TransformType"]]] = None, **kwargs ): """ - :keyword match_variable: Required. Match variable to compare against. Possible values include: + :keyword match_variable: Match variable to compare against. Required. Known values are: "RemoteAddr", "SocketAddr", "RequestMethod", "RequestHeader", "RequestUri", "QueryString", - "RequestBody", "Cookies", "PostArgs". + "RequestBody", "Cookies", and "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", + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "IPMatch", "GeoMatch", "Equal", "Contains", "LessThan", "GreaterThan", "LessThanOrEqual", - "GreaterThanOrEqual", "BeginsWith", "EndsWith", "RegEx". + "GreaterThanOrEqual", "BeginsWith", "EndsWith", and "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. + :keyword match_value: List of possible match values. Required. :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) + super().__init__(**kwargs) self.match_variable = match_variable self.selector = selector self.operator = operator @@ -7289,7 +7111,7 @@ def __init__( self.transforms = transforms -class MetricAvailability(msrest.serialization.Model): +class MetricAvailability(_serialization.Model): """Retention policy of a resource metric. :ivar time_grain: @@ -7299,29 +7121,23 @@ class MetricAvailability(msrest.serialization.Model): """ _attribute_map = { - 'time_grain': {'key': 'timeGrain', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + "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 - ): + 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) + super().__init__(**kwargs) self.time_grain = time_grain self.blob_duration = blob_duration -class MetricSpecification(msrest.serialization.Model): +class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes """Metric specification of operation. :ivar name: Name of metric specification. @@ -7350,17 +7166,17 @@ class MetricSpecification(msrest.serialization.Model): """ _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'}, + "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__( @@ -7371,9 +7187,9 @@ def __init__( display_description: Optional[str] = None, unit: Optional[str] = None, aggregation_type: Optional[str] = None, - availabilities: Optional[List["MetricAvailability"]] = None, + availabilities: Optional[List["_models.MetricAvailability"]] = None, supported_time_grain_types: Optional[List[str]] = None, - dimensions: Optional[List["DimensionProperties"]] = None, + dimensions: Optional[List["_models.DimensionProperties"]] = None, fill_gap_with_zero: Optional[bool] = None, metric_filter_pattern: Optional[str] = None, is_internal: Optional[bool] = None, @@ -7404,7 +7220,7 @@ def __init__( :keyword is_internal: Property to specify metric is internal or not. :paramtype is_internal: bool """ - super(MetricSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display_name = display_name self.display_description = display_description @@ -7418,24 +7234,24 @@ def __init__( self.is_internal = is_internal -class MetricsResponse(msrest.serialization.Model): +class MetricsResponse(_serialization.Model): """Metrics Response. :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". + :ivar granularity: Known values are: "PT5M", "PT1H", and "P1D". :vartype granularity: str or ~azure.mgmt.cdn.models.MetricsResponseGranularity :ivar series: :vartype 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]'}, + "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__( @@ -7443,8 +7259,8 @@ def __init__( *, date_time_begin: Optional[datetime.datetime] = None, date_time_end: Optional[datetime.datetime] = None, - granularity: Optional[Union[str, "MetricsResponseGranularity"]] = None, - series: Optional[List["MetricsResponseSeriesItem"]] = None, + granularity: Optional[Union[str, "_models.MetricsResponseGranularity"]] = None, + series: Optional[List["_models.MetricsResponseSeriesItem"]] = None, **kwargs ): """ @@ -7452,24 +7268,24 @@ def __init__( :paramtype date_time_begin: ~datetime.datetime :keyword date_time_end: :paramtype date_time_end: ~datetime.datetime - :keyword granularity: Possible values include: "PT5M", "PT1H", "P1D". + :keyword granularity: Known values are: "PT5M", "PT1H", and "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) + super().__init__(**kwargs) self.date_time_begin = date_time_begin self.date_time_end = date_time_end self.granularity = granularity self.series = series -class MetricsResponseSeriesItem(msrest.serialization.Model): +class MetricsResponseSeriesItem(_serialization.Model): """MetricsResponseSeriesItem. :ivar metric: :vartype metric: str - :ivar unit: Possible values include: "count", "bytes", "bitsPerSecond", "milliSeconds". + :ivar unit: Known values are: "count", "bytes", "bitsPerSecond", and "milliSeconds". :vartype unit: str or ~azure.mgmt.cdn.models.MetricsResponseSeriesItemUnit :ivar groups: :vartype groups: list[~azure.mgmt.cdn.models.MetricsResponseSeriesPropertiesItemsItem] @@ -7479,25 +7295,30 @@ class MetricsResponseSeriesItem(msrest.serialization.Model): """ _attribute_map = { - 'metric': {'key': 'metric', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[MetricsResponseSeriesPropertiesItemsItem]'}, - 'data': {'key': 'data', 'type': '[Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems]'}, + "metric": {"key": "metric", "type": "str"}, + "unit": {"key": "unit", "type": "str"}, + "groups": {"key": "groups", "type": "[MetricsResponseSeriesPropertiesItemsItem]"}, + "data": { + "key": "data", + "type": "[Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems]", + }, } def __init__( self, *, metric: Optional[str] = None, - unit: Optional[Union[str, "MetricsResponseSeriesItemUnit"]] = None, - groups: Optional[List["MetricsResponseSeriesPropertiesItemsItem"]] = None, - data: Optional[List["Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems"]] = None, + unit: Optional[Union[str, "_models.MetricsResponseSeriesItemUnit"]] = None, + groups: Optional[List["_models.MetricsResponseSeriesPropertiesItemsItem"]] = None, + data: Optional[ + List["_models.Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems"] + ] = None, **kwargs ): """ :keyword metric: :paramtype metric: str - :keyword unit: Possible values include: "count", "bytes", "bitsPerSecond", "milliSeconds". + :keyword unit: Known values are: "count", "bytes", "bitsPerSecond", and "milliSeconds". :paramtype unit: str or ~azure.mgmt.cdn.models.MetricsResponseSeriesItemUnit :keyword groups: :paramtype groups: list[~azure.mgmt.cdn.models.MetricsResponseSeriesPropertiesItemsItem] @@ -7505,14 +7326,14 @@ def __init__( :paramtype data: list[~azure.mgmt.cdn.models.Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems] """ - super(MetricsResponseSeriesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.metric = metric self.unit = unit self.groups = groups self.data = data -class MetricsResponseSeriesPropertiesItemsItem(msrest.serialization.Model): +class MetricsResponseSeriesPropertiesItemsItem(_serialization.Model): """MetricsResponseSeriesPropertiesItemsItem. :ivar name: @@ -7522,29 +7343,23 @@ class MetricsResponseSeriesPropertiesItemsItem(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): """ :keyword name: :paramtype name: str :keyword value: :paramtype value: str """ - super(MetricsResponseSeriesPropertiesItemsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.value = value -class Operation(msrest.serialization.Model): +class Operation(_serialization.Model): """CDN REST API operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -7562,24 +7377,24 @@ class Operation(msrest.serialization.Model): """ _validation = { - 'name': {'readonly': True}, - 'origin': {'readonly': True}, + "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'}, + "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, + display: Optional["_models.OperationDisplay"] = None, + service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs ): """ @@ -7590,7 +7405,7 @@ def __init__( :keyword service_specification: One property of operation, include metric specifications. :paramtype service_specification: ~azure.mgmt.cdn.models.ServiceSpecification """ - super(Operation, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = None self.is_data_action = is_data_action self.display = display @@ -7598,7 +7413,7 @@ def __init__( self.service_specification = service_specification -class OperationDisplay(msrest.serialization.Model): +class OperationDisplay(_serialization.Model): """The object that represents the operation. Variables are only populated by the server, and will be ignored when sending a request. @@ -7614,33 +7429,29 @@ class OperationDisplay(msrest.serialization.Model): """ _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.provider = None self.resource = None self.operation = None self.description = None -class OperationsListResult(msrest.serialization.Model): +class OperationsListResult(_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. :ivar value: List of CDN operations supported by the CDN resource provider. @@ -7650,29 +7461,23 @@ class OperationsListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["Operation"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.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) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class Origin(ProxyResource): +class Origin(ProxyResource): # pylint: disable=too-many-instance-attributes """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. @@ -7718,49 +7523,50 @@ class Origin(ProxyResource): :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". + :ivar resource_state: Resource status of the origin. Known values are: "Creating", "Active", + and "Deleting". :vartype resource_state: str or ~azure.mgmt.cdn.models.OriginResourceState - :ivar provisioning_state: Provisioning status of the origin. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning status of the origin. Known values are: "Succeeded", + "Failed", "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.OriginProvisioningState :ivar private_endpoint_status: The approval status for the connection to the Private Link. - Possible values include: "Pending", "Approved", "Rejected", "Disconnected", "Timeout". + Known values are: "Pending", "Approved", "Rejected", "Disconnected", and "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'}, + "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__( @@ -7814,7 +7620,7 @@ def __init__( to connect to the Private Link. :paramtype private_link_approval_message: str """ - super(Origin, self).__init__(**kwargs) + super().__init__(**kwargs) self.host_name = host_name self.http_port = http_port self.https_port = https_port @@ -7858,43 +7664,52 @@ class OriginGroup(ProxyResource): not supported. :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". + :ivar resource_state: Resource status of the origin group. Known values are: "Creating", + "Active", and "Deleting". :vartype resource_state: str or ~azure.mgmt.cdn.models.OriginGroupResourceState - :ivar provisioning_state: Provisioning status of the origin group. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning status of the origin group. Known values are: + "Succeeded", "Failed", "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.OriginGroupProvisioningState """ _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}, + "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'}, + "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, *, - health_probe_settings: Optional["HealthProbeParameters"] = None, - origins: Optional[List["ResourceReference"]] = None, + health_probe_settings: Optional["_models.HealthProbeParameters"] = None, + origins: Optional[List["_models.ResourceReference"]] = None, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Optional[int] = None, - response_based_origin_error_detection_settings: Optional["ResponseBasedOriginErrorDetectionParameters"] = None, + response_based_origin_error_detection_settings: Optional[ + "_models.ResponseBasedOriginErrorDetectionParameters" + ] = None, **kwargs ): """ @@ -7913,16 +7728,18 @@ def __init__( :paramtype response_based_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters """ - super(OriginGroup, self).__init__(**kwargs) + super().__init__(**kwargs) self.health_probe_settings = health_probe_settings self.origins = origins - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = ( + traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + ) self.response_based_origin_error_detection_settings = response_based_origin_error_detection_settings self.resource_state = None self.provisioning_state = None -class OriginGroupListResult(msrest.serialization.Model): +class OriginGroupListResult(_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. @@ -7934,50 +7751,45 @@ class OriginGroupListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OriginGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[OriginGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class OriginGroupOverride(msrest.serialization.Model): +class OriginGroupOverride(_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". + Known values are: "HttpOnly", "HttpsOnly", and "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'}, + "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, + origin_group: Optional["_models.ResourceReference"] = None, + forwarding_protocol: Optional[Union[str, "_models.ForwardingProtocol"]] = None, **kwargs ): """ @@ -7985,10 +7797,10 @@ def __init__( 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". + Known values are: "HttpOnly", "HttpsOnly", and "MatchRequest". :paramtype forwarding_protocol: str or ~azure.mgmt.cdn.models.ForwardingProtocol """ - super(OriginGroupOverride, self).__init__(**kwargs) + super().__init__(**kwargs) self.origin_group = origin_group self.forwarding_protocol = forwarding_protocol @@ -7998,82 +7810,77 @@ class OriginGroupOverrideAction(DeliveryRuleAction): 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", + :ivar name: The name of the action for the delivery rule. Required. Known values are: + "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", "ModifyResponseHeader", + "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", and "RouteConfigurationOverride". :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :ivar parameters: Required. Defines the parameters for the action. + :ivar parameters: Defines the parameters for the action. Required. :vartype parameters: ~azure.mgmt.cdn.models.OriginGroupOverrideActionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'OriginGroupOverrideActionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "OriginGroupOverrideActionParameters"}, } - def __init__( - self, - *, - parameters: "OriginGroupOverrideActionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.OriginGroupOverrideActionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the action. + :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.OriginGroupOverrideActionParameters """ - super(OriginGroupOverrideAction, self).__init__(**kwargs) - self.name = 'OriginGroupOverride' # type: str + super().__init__(**kwargs) + self.name = "OriginGroupOverride" # type: str self.parameters = parameters -class OriginGroupOverrideActionParameters(msrest.serialization.Model): +class OriginGroupOverrideActionParameters(_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 type_name: Has constant value: "DeliveryRuleOriginGroupOverrideActionParameters". - :vartype type_name: str - :ivar origin_group: Required. defines the OriginGroup that would override the - DefaultOriginGroup. + :ivar type_name: Required. "DeliveryRuleOriginGroupOverrideActionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.OriginGroupOverrideActionParametersTypeName + :ivar origin_group: defines the OriginGroup that would override the DefaultOriginGroup. + Required. :vartype origin_group: ~azure.mgmt.cdn.models.ResourceReference """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'origin_group': {'required': True}, + "type_name": {"required": True}, + "origin_group": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', 'type': 'str'}, - 'origin_group': {'key': 'originGroup', 'type': 'ResourceReference'}, + "type_name": {"key": "typeName", "type": "str"}, + "origin_group": {"key": "originGroup", "type": "ResourceReference"}, } - type_name = "DeliveryRuleOriginGroupOverrideActionParameters" - def __init__( self, *, - origin_group: "ResourceReference", + type_name: Union[str, "_models.OriginGroupOverrideActionParametersTypeName"], + origin_group: "_models.ResourceReference", **kwargs ): """ - :keyword origin_group: Required. defines the OriginGroup that would override the - DefaultOriginGroup. + :keyword type_name: Required. "DeliveryRuleOriginGroupOverrideActionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.OriginGroupOverrideActionParametersTypeName + :keyword origin_group: defines the OriginGroup that would override the DefaultOriginGroup. + Required. :paramtype origin_group: ~azure.mgmt.cdn.models.ResourceReference """ - super(OriginGroupOverrideActionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.origin_group = origin_group -class OriginGroupUpdatePropertiesParameters(msrest.serialization.Model): +class OriginGroupUpdatePropertiesParameters(_serialization.Model): """The JSON object that contains the properties of the origin group. :ivar health_probe_settings: Health probe settings to the origin that is used to determine the @@ -8093,23 +7900,31 @@ class OriginGroupUpdatePropertiesParameters(msrest.serialization.Model): """ _validation = { - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, + "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'}, + "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, *, - health_probe_settings: Optional["HealthProbeParameters"] = None, - origins: Optional[List["ResourceReference"]] = None, + health_probe_settings: Optional["_models.HealthProbeParameters"] = None, + origins: Optional[List["_models.ResourceReference"]] = None, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Optional[int] = None, - response_based_origin_error_detection_settings: Optional["ResponseBasedOriginErrorDetectionParameters"] = None, + response_based_origin_error_detection_settings: Optional[ + "_models.ResponseBasedOriginErrorDetectionParameters" + ] = None, **kwargs ): """ @@ -8128,10 +7943,12 @@ def __init__( :paramtype response_based_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters """ - super(OriginGroupUpdatePropertiesParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.health_probe_settings = health_probe_settings self.origins = origins - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = ( + traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + ) self.response_based_origin_error_detection_settings = response_based_origin_error_detection_settings @@ -8154,35 +7971,44 @@ class OriginGroupProperties(OriginGroupUpdatePropertiesParameters): not supported. :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". + :ivar resource_state: Resource status of the origin group. Known values are: "Creating", + "Active", and "Deleting". :vartype resource_state: str or ~azure.mgmt.cdn.models.OriginGroupResourceState - :ivar provisioning_state: Provisioning status of the origin group. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning status of the origin group. Known values are: + "Succeeded", "Failed", "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.OriginGroupProvisioningState """ _validation = { - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'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 = { - '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'}, + "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, *, - health_probe_settings: Optional["HealthProbeParameters"] = None, - origins: Optional[List["ResourceReference"]] = None, + health_probe_settings: Optional["_models.HealthProbeParameters"] = None, + origins: Optional[List["_models.ResourceReference"]] = None, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Optional[int] = None, - response_based_origin_error_detection_settings: Optional["ResponseBasedOriginErrorDetectionParameters"] = None, + response_based_origin_error_detection_settings: Optional[ + "_models.ResponseBasedOriginErrorDetectionParameters" + ] = None, **kwargs ): """ @@ -8201,12 +8027,18 @@ def __init__( :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) + super().__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 -class OriginGroupUpdateParameters(msrest.serialization.Model): +class OriginGroupUpdateParameters(_serialization.Model): """Origin group properties needed for origin group creation or update. :ivar health_probe_settings: Health probe settings to the origin that is used to determine the @@ -8226,23 +8058,31 @@ class OriginGroupUpdateParameters(msrest.serialization.Model): """ _validation = { - 'traffic_restoration_time_to_healed_or_new_endpoints_in_minutes': {'maximum': 50, 'minimum': 0}, + "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'}, + "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, *, - health_probe_settings: Optional["HealthProbeParameters"] = None, - origins: Optional[List["ResourceReference"]] = None, + health_probe_settings: Optional["_models.HealthProbeParameters"] = None, + origins: Optional[List["_models.ResourceReference"]] = None, traffic_restoration_time_to_healed_or_new_endpoints_in_minutes: Optional[int] = None, - response_based_origin_error_detection_settings: Optional["ResponseBasedOriginErrorDetectionParameters"] = None, + response_based_origin_error_detection_settings: Optional[ + "_models.ResponseBasedOriginErrorDetectionParameters" + ] = None, **kwargs ): """ @@ -8261,14 +8101,16 @@ def __init__( :paramtype response_based_origin_error_detection_settings: ~azure.mgmt.cdn.models.ResponseBasedOriginErrorDetectionParameters """ - super(OriginGroupUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.health_probe_settings = health_probe_settings self.origins = origins - self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + self.traffic_restoration_time_to_healed_or_new_endpoints_in_minutes = ( + traffic_restoration_time_to_healed_or_new_endpoints_in_minutes + ) self.response_based_origin_error_detection_settings = response_based_origin_error_detection_settings -class OriginListResult(msrest.serialization.Model): +class OriginListResult(_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. @@ -8280,30 +8122,25 @@ class OriginListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Origin]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Origin]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class OriginUpdatePropertiesParameters(msrest.serialization.Model): +class OriginUpdatePropertiesParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """The JSON object that contains the properties of the origin. :ivar host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses @@ -8342,24 +8179,24 @@ class OriginUpdatePropertiesParameters(msrest.serialization.Model): """ _validation = { - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, + "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'}, + "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__( @@ -8413,7 +8250,7 @@ def __init__( to connect to the Private Link. :paramtype private_link_approval_message: str """ - super(OriginUpdatePropertiesParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.host_name = host_name self.http_port = http_port self.https_port = https_port @@ -8427,7 +8264,7 @@ def __init__( self.private_link_approval_message = private_link_approval_message -class OriginProperties(OriginUpdatePropertiesParameters): +class OriginProperties(OriginUpdatePropertiesParameters): # pylint: disable=too-many-instance-attributes """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. @@ -8465,41 +8302,42 @@ class OriginProperties(OriginUpdatePropertiesParameters): :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". + :ivar resource_state: Resource status of the origin. Known values are: "Creating", "Active", + and "Deleting". :vartype resource_state: str or ~azure.mgmt.cdn.models.OriginResourceState - :ivar provisioning_state: Provisioning status of the origin. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning status of the origin. Known values are: "Succeeded", + "Failed", "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.OriginProvisioningState :ivar private_endpoint_status: The approval status for the connection to the Private Link. - Possible values include: "Pending", "Approved", "Rejected", "Disconnected", "Timeout". + Known values are: "Pending", "Approved", "Rejected", "Disconnected", and "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}, + "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'}, + "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__( @@ -8553,13 +8391,26 @@ def __init__( 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) + super().__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 self.private_endpoint_status = None -class OriginUpdateParameters(msrest.serialization.Model): +class OriginUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """Origin properties needed for origin update. :ivar host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses @@ -8598,24 +8449,24 @@ class OriginUpdateParameters(msrest.serialization.Model): """ _validation = { - 'http_port': {'maximum': 65535, 'minimum': 1}, - 'https_port': {'maximum': 65535, 'minimum': 1}, - 'priority': {'maximum': 5, 'minimum': 1}, - 'weight': {'maximum': 1000, 'minimum': 1}, + "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'}, + "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__( @@ -8669,7 +8520,7 @@ def __init__( to connect to the Private Link. :paramtype private_link_approval_message: str """ - super(OriginUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.host_name = host_name self.http_port = http_port self.https_port = https_port @@ -8683,21 +8534,21 @@ def __init__( self.private_link_approval_message = private_link_approval_message -class PolicySettings(msrest.serialization.Model): +class PolicySettings(_serialization.Model): """Defines contents of a web application firewall global configuration. - :ivar enabled_state: describes if the policy is in enabled state or disabled state. Possible - values include: "Disabled", "Enabled". + :ivar enabled_state: describes if the policy is in enabled state or disabled state. Known + values are: "Disabled" and "Enabled". :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". + :ivar mode: Describes if it is in detection mode or prevention mode at policy level. Known + values are: "Prevention" and "Detection". :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. :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. + defines the default customer overridable http response status code. Known values are: 200, 403, + 405, 406, and 429. :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 @@ -8706,47 +8557,51 @@ class PolicySettings(msrest.serialization.Model): """ _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})$'}, + "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'}, + "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, *, - enabled_state: Optional[Union[str, "PolicyEnabledState"]] = None, - mode: Optional[Union[str, "PolicyMode"]] = None, + enabled_state: Optional[Union[str, "_models.PolicyEnabledState"]] = None, + mode: Optional[Union[str, "_models.PolicyMode"]] = None, default_redirect_url: Optional[str] = None, - default_custom_block_response_status_code: Optional[Union[int, "PolicySettingsDefaultCustomBlockResponseStatusCode"]] = None, + default_custom_block_response_status_code: Optional[ + Union[int, "_models.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". + :keyword enabled_state: describes if the policy is in enabled state or disabled state. Known + values are: "Disabled" and "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". + :keyword mode: Describes if it is in detection mode or prevention mode at policy level. Known + values are: "Prevention" and "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. + defines the default customer overridable http response status code. Known values are: 200, 403, + 405, 406, and 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) + super().__init__(**kwargs) self.enabled_state = enabled_state self.mode = mode self.default_redirect_url = default_redirect_url @@ -8754,20 +8609,18 @@ def __init__( self.default_custom_block_response_body = default_custom_block_response_body -class PostArgsMatchConditionParameters(msrest.serialization.Model): +class PostArgsMatchConditionParameters(_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 type_name: Has constant value: "DeliveryRulePostArgsConditionParameters". - :vartype type_name: str + :ivar type_name: Required. "DeliveryRulePostArgsConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.PostArgsMatchConditionParametersTypeName :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". + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "RegEx". :vartype operator: str or ~azure.mgmt.cdn.models.PostArgsOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool @@ -8778,37 +8631,38 @@ class PostArgsMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": True}, + "operator": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', '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]'}, + "type_name": {"key": "typeName", "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]"}, } - type_name = "DeliveryRulePostArgsConditionParameters" - def __init__( self, *, - operator: Union[str, "PostArgsOperator"], + type_name: Union[str, "_models.PostArgsMatchConditionParametersTypeName"], + operator: Union[str, "_models.PostArgsOperator"], selector: Optional[str] = None, negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ + :keyword type_name: Required. "DeliveryRulePostArgsConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.PostArgsMatchConditionParametersTypeName :keyword selector: Name of PostArg to be matched. :paramtype selector: str - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -8817,7 +8671,8 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(PostArgsMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.selector = selector self.operator = operator self.negate_condition = negate_condition @@ -8825,7 +8680,7 @@ def __init__( self.transforms = transforms -class Profile(TrackedResource): +class Profile(TrackedResource): # pylint: disable=too-many-instance-attributes """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. @@ -8840,21 +8695,22 @@ class Profile(TrackedResource): :vartype type: str :ivar system_data: Read only system data. :vartype system_data: ~azure.mgmt.cdn.models.SystemData - :ivar location: Required. Resource location. + :ivar location: Resource location. Required. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar 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. + :ivar sku: The pricing tier (defines Azure Front Door Standard or Premium or a CDN provider, + feature list and rate) of the profile. Required. :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". + :ivar resource_state: Resource status of the profile. Known values are: "Creating", "Active", + "Deleting", and "Disabled". :vartype resource_state: str or ~azure.mgmt.cdn.models.ProfileResourceState - :ivar provisioning_state: Provisioning status of the profile. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning status of the profile. Known values are: "Succeeded", + "Failed", "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.ProfileProvisioningState :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 @@ -8863,56 +8719,56 @@ class Profile(TrackedResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'kind': {'readonly': True}, - 'resource_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'front_door_id': {'readonly': True}, - 'origin_response_timeout_seconds': {'minimum': 16}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "sku": {"required": True}, + "kind": {"readonly": True}, + "resource_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "front_door_id": {"readonly": True}, + "origin_response_timeout_seconds": {"minimum": 16}, } _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'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'front_door_id': {'key': 'properties.frontDoorId', 'type': 'str'}, - 'origin_response_timeout_seconds': {'key': 'properties.originResponseTimeoutSeconds', 'type': 'int'}, + "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"}, + "kind": {"key": "kind", "type": "str"}, + "resource_state": {"key": "properties.resourceState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "front_door_id": {"key": "properties.frontDoorId", "type": "str"}, + "origin_response_timeout_seconds": {"key": "properties.originResponseTimeoutSeconds", "type": "int"}, } def __init__( self, *, location: str, - sku: "Sku", + sku: "_models.Sku", tags: Optional[Dict[str, str]] = None, origin_response_timeout_seconds: Optional[int] = None, **kwargs ): """ - :keyword location: Required. Resource location. + :keyword location: Resource location. Required. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword 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. + :keyword sku: The pricing tier (defines Azure Front Door Standard or Premium or a CDN provider, + feature list and rate) of the profile. Required. :paramtype sku: ~azure.mgmt.cdn.models.Sku :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) + super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.kind = None self.resource_state = None @@ -8921,7 +8777,7 @@ def __init__( self.origin_response_timeout_seconds = origin_response_timeout_seconds -class ProfileListResult(msrest.serialization.Model): +class ProfileListResult(_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. @@ -8933,33 +8789,28 @@ class ProfileListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Profile]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Profile]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class ProfileUpdateParameters(msrest.serialization.Model): +class ProfileUpdateParameters(_serialization.Model): """Properties required to update a profile. - :ivar tags: A set of tags. Profile tags. + :ivar tags: Profile tags. :vartype tags: dict[str, 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. @@ -8967,78 +8818,67 @@ class ProfileUpdateParameters(msrest.serialization.Model): """ _validation = { - 'origin_response_timeout_seconds': {'minimum': 16}, + "origin_response_timeout_seconds": {"minimum": 16}, } _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'origin_response_timeout_seconds': {'key': 'properties.originResponseTimeoutSeconds', 'type': 'int'}, + "tags": {"key": "tags", "type": "{str}"}, + "origin_response_timeout_seconds": {"key": "properties.originResponseTimeoutSeconds", "type": "int"}, } def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - origin_response_timeout_seconds: Optional[int] = None, - **kwargs + self, *, tags: Optional[Dict[str, str]] = None, origin_response_timeout_seconds: Optional[int] = None, **kwargs ): """ - :keyword tags: A set of tags. Profile tags. + :keyword tags: Profile tags. :paramtype tags: dict[str, str] :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(ProfileUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.tags = tags self.origin_response_timeout_seconds = origin_response_timeout_seconds -class PurgeParameters(msrest.serialization.Model): +class PurgeParameters(_serialization.Model): """Parameters required for content purge. All required parameters must be populated in order to send to Azure. - :ivar content_paths: Required. The path to the content to be purged. Can describe a file path - or a wild card directory. + :ivar content_paths: The path to the content to be purged. Can describe a file path or a wild + card directory. Required. :vartype content_paths: list[str] """ _validation = { - 'content_paths': {'required': True}, + "content_paths": {"required": True}, } _attribute_map = { - 'content_paths': {'key': 'contentPaths', 'type': '[str]'}, + "content_paths": {"key": "contentPaths", "type": "[str]"}, } - def __init__( - self, - *, - content_paths: List[str], - **kwargs - ): + def __init__(self, *, 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. + :keyword content_paths: The path to the content to be purged. Can describe a file path or a + wild card directory. Required. :paramtype content_paths: list[str] """ - super(PurgeParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.content_paths = content_paths -class QueryStringMatchConditionParameters(msrest.serialization.Model): +class QueryStringMatchConditionParameters(_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 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". + :ivar type_name: Required. "DeliveryRuleQueryStringConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.QueryStringMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "RegEx". :vartype operator: str or ~azure.mgmt.cdn.models.QueryStringOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool @@ -9049,33 +8889,34 @@ class QueryStringMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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 = "DeliveryRuleQueryStringConditionParameters" - def __init__( self, *, - operator: Union[str, "QueryStringOperator"], + type_name: Union[str, "_models.QueryStringMatchConditionParametersTypeName"], + operator: Union[str, "_models.QueryStringOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword type_name: Required. "DeliveryRuleQueryStringConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.QueryStringMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -9084,14 +8925,15 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(QueryStringMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class RankingsResponse(msrest.serialization.Model): +class RankingsResponse(_serialization.Model): """Rankings Response. :ivar date_time_begin: @@ -9103,9 +8945,9 @@ class RankingsResponse(msrest.serialization.Model): """ _attribute_map = { - 'date_time_begin': {'key': 'dateTimeBegin', 'type': 'iso-8601'}, - 'date_time_end': {'key': 'dateTimeEnd', 'type': 'iso-8601'}, - 'tables': {'key': 'tables', 'type': '[RankingsResponseTablesItem]'}, + "date_time_begin": {"key": "dateTimeBegin", "type": "iso-8601"}, + "date_time_end": {"key": "dateTimeEnd", "type": "iso-8601"}, + "tables": {"key": "tables", "type": "[RankingsResponseTablesItem]"}, } def __init__( @@ -9113,7 +8955,7 @@ def __init__( *, date_time_begin: Optional[datetime.datetime] = None, date_time_end: Optional[datetime.datetime] = None, - tables: Optional[List["RankingsResponseTablesItem"]] = None, + tables: Optional[List["_models.RankingsResponseTablesItem"]] = None, **kwargs ): """ @@ -9124,13 +8966,13 @@ def __init__( :keyword tables: :paramtype tables: list[~azure.mgmt.cdn.models.RankingsResponseTablesItem] """ - super(RankingsResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.date_time_begin = date_time_begin self.date_time_end = date_time_end self.tables = tables -class RankingsResponseTablesItem(msrest.serialization.Model): +class RankingsResponseTablesItem(_serialization.Model): """RankingsResponseTablesItem. :ivar ranking: @@ -9140,15 +8982,15 @@ class RankingsResponseTablesItem(msrest.serialization.Model): """ _attribute_map = { - 'ranking': {'key': 'ranking', 'type': 'str'}, - 'data': {'key': 'data', 'type': '[RankingsResponseTablesPropertiesItemsItem]'}, + "ranking": {"key": "ranking", "type": "str"}, + "data": {"key": "data", "type": "[RankingsResponseTablesPropertiesItemsItem]"}, } def __init__( self, *, ranking: Optional[str] = None, - data: Optional[List["RankingsResponseTablesPropertiesItemsItem"]] = None, + data: Optional[List["_models.RankingsResponseTablesPropertiesItemsItem"]] = None, **kwargs ): """ @@ -9157,12 +8999,12 @@ def __init__( :keyword data: :paramtype data: list[~azure.mgmt.cdn.models.RankingsResponseTablesPropertiesItemsItem] """ - super(RankingsResponseTablesItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.ranking = ranking self.data = data -class RankingsResponseTablesPropertiesItemsItem(msrest.serialization.Model): +class RankingsResponseTablesPropertiesItemsItem(_serialization.Model): """RankingsResponseTablesPropertiesItemsItem. :ivar name: @@ -9172,15 +9014,15 @@ class RankingsResponseTablesPropertiesItemsItem(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'metrics': {'key': 'metrics', 'type': '[RankingsResponseTablesPropertiesItemsMetricsItem]'}, + "name": {"key": "name", "type": "str"}, + "metrics": {"key": "metrics", "type": "[RankingsResponseTablesPropertiesItemsMetricsItem]"}, } def __init__( self, *, name: Optional[str] = None, - metrics: Optional[List["RankingsResponseTablesPropertiesItemsMetricsItem"]] = None, + metrics: Optional[List["_models.RankingsResponseTablesPropertiesItemsMetricsItem"]] = None, **kwargs ): """ @@ -9190,45 +9032,40 @@ def __init__( :paramtype metrics: list[~azure.mgmt.cdn.models.RankingsResponseTablesPropertiesItemsMetricsItem] """ - super(RankingsResponseTablesPropertiesItemsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.metrics = metrics -class RankingsResponseTablesPropertiesItemsMetricsItem(msrest.serialization.Model): +class RankingsResponseTablesPropertiesItemsMetricsItem(_serialization.Model): """RankingsResponseTablesPropertiesItemsMetricsItem. :ivar metric: :vartype metric: str :ivar value: - :vartype value: long + :vartype value: int :ivar percentage: :vartype percentage: float """ _attribute_map = { - 'metric': {'key': 'metric', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'long'}, - 'percentage': {'key': 'percentage', 'type': 'float'}, + "metric": {"key": "metric", "type": "str"}, + "value": {"key": "value", "type": "int"}, + "percentage": {"key": "percentage", "type": "float"}, } def __init__( - self, - *, - metric: Optional[str] = None, - value: Optional[int] = None, - percentage: Optional[float] = None, - **kwargs + self, *, metric: Optional[str] = None, value: Optional[int] = None, percentage: Optional[float] = None, **kwargs ): """ :keyword metric: :paramtype metric: str :keyword value: - :paramtype value: long + :paramtype value: int :keyword percentage: :paramtype percentage: float """ - super(RankingsResponseTablesPropertiesItemsMetricsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.metric = metric self.value = value self.percentage = percentage @@ -9239,43 +9076,43 @@ class RateLimitRule(CustomRule): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Defines the name of the custom rule. + :ivar name: Defines the name of the custom rule. Required. :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". + Enabled if not specified. Known values are: "Disabled" and "Enabled". :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. + :ivar priority: Defines in what order this rule be evaluated in the overall list of custom + rules. Required. :vartype priority: int - :ivar match_conditions: Required. List of match conditions. + :ivar match_conditions: List of match conditions. Required. :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". + :ivar action: Describes what action to be applied when rule matches. Required. Known values + are: "Allow", "Block", "Log", and "Redirect". :vartype action: str or ~azure.mgmt.cdn.models.ActionType - :ivar rate_limit_threshold: Required. Defines rate limit threshold. + :ivar rate_limit_threshold: Defines rate limit threshold. Required. :vartype rate_limit_threshold: int - :ivar rate_limit_duration_in_minutes: Required. Defines rate limit duration. Default is 1 - minute. + :ivar rate_limit_duration_in_minutes: Defines rate limit duration. Default is 1 minute. + Required. :vartype 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}, + "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'}, + "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__( @@ -9283,39 +9120,46 @@ def __init__( *, name: str, priority: int, - match_conditions: List["MatchCondition"], - action: Union[str, "ActionType"], + match_conditions: List["_models.MatchCondition"], + action: Union[str, "_models.ActionType"], rate_limit_threshold: int, rate_limit_duration_in_minutes: int, - enabled_state: Optional[Union[str, "CustomRuleEnabledState"]] = None, + enabled_state: Optional[Union[str, "_models.CustomRuleEnabledState"]] = None, **kwargs ): """ - :keyword name: Required. Defines the name of the custom rule. + :keyword name: Defines the name of the custom rule. Required. :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". + to Enabled if not specified. Known values are: "Disabled" and "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. + :keyword priority: Defines in what order this rule be evaluated in the overall list of custom + rules. Required. :paramtype priority: int - :keyword match_conditions: Required. List of match conditions. + :keyword match_conditions: List of match conditions. Required. :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". + :keyword action: Describes what action to be applied when rule matches. Required. Known values + are: "Allow", "Block", "Log", and "Redirect". :paramtype action: str or ~azure.mgmt.cdn.models.ActionType - :keyword rate_limit_threshold: Required. Defines rate limit threshold. + :keyword rate_limit_threshold: Defines rate limit threshold. Required. :paramtype rate_limit_threshold: int - :keyword rate_limit_duration_in_minutes: Required. Defines rate limit duration. Default is 1 - minute. + :keyword rate_limit_duration_in_minutes: Defines rate limit duration. Default is 1 minute. + Required. :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) + super().__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 -class RateLimitRuleList(msrest.serialization.Model): +class RateLimitRuleList(_serialization.Model): """Defines contents of rate limit rules. :ivar rules: List of rules. @@ -9323,34 +9167,27 @@ class RateLimitRuleList(msrest.serialization.Model): """ _attribute_map = { - 'rules': {'key': 'rules', 'type': '[RateLimitRule]'}, + "rules": {"key": "rules", "type": "[RateLimitRule]"}, } - def __init__( - self, - *, - rules: Optional[List["RateLimitRule"]] = None, - **kwargs - ): + def __init__(self, *, rules: Optional[List["_models.RateLimitRule"]] = None, **kwargs): """ :keyword rules: List of rules. :paramtype rules: list[~azure.mgmt.cdn.models.RateLimitRule] """ - super(RateLimitRuleList, self).__init__(**kwargs) + super().__init__(**kwargs) self.rules = rules -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. +class RemoteAddressMatchConditionParameters(_serialization.Model): + """Defines the parameters for RemoteAddress match conditions. All required parameters must be populated in order to send to Azure. - :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". + :ivar type_name: Required. "DeliveryRuleRemoteAddressConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.RemoteAddressMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "IPMatch", + and "GeoMatch". :vartype operator: str or ~azure.mgmt.cdn.models.RemoteAddressOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool @@ -9363,32 +9200,34 @@ class RemoteAddressMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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 = "DeliveryRuleRemoteAddressConditionParameters" - def __init__( self, *, - operator: Union[str, "RemoteAddressOperator"], + type_name: Union[str, "_models.RemoteAddressMatchConditionParametersTypeName"], + operator: Union[str, "_models.RemoteAddressOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", - "IPMatch", "GeoMatch". + :keyword type_name: Required. "DeliveryRuleRemoteAddressConditionParameters" + :paramtype type_name: str or + ~azure.mgmt.cdn.models.RemoteAddressMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", + "IPMatch", and "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 @@ -9399,25 +9238,24 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(RemoteAddressMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class RequestBodyMatchConditionParameters(msrest.serialization.Model): +class RequestBodyMatchConditionParameters(_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 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". + :ivar type_name: Required. "DeliveryRuleRequestBodyConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.RequestBodyMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "RegEx". :vartype operator: str or ~azure.mgmt.cdn.models.RequestBodyOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool @@ -9428,33 +9266,34 @@ class RequestBodyMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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 = "DeliveryRuleRequestBodyConditionParameters" - def __init__( self, *, - operator: Union[str, "RequestBodyOperator"], + type_name: Union[str, "_models.RequestBodyMatchConditionParametersTypeName"], + operator: Union[str, "_models.RequestBodyOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword type_name: Required. "DeliveryRuleRequestBodyConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.RequestBodyMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -9463,27 +9302,26 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(RequestBodyMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class RequestHeaderMatchConditionParameters(msrest.serialization.Model): +class RequestHeaderMatchConditionParameters(_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 type_name: Has constant value: "DeliveryRuleRequestHeaderConditionParameters". - :vartype type_name: str + :ivar type_name: Required. "DeliveryRuleRequestHeaderConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.RequestHeaderMatchConditionParametersTypeName :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". + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "RegEx". :vartype operator: str or ~azure.mgmt.cdn.models.RequestHeaderOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool @@ -9494,37 +9332,39 @@ class RequestHeaderMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": True}, + "operator": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', '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]'}, + "type_name": {"key": "typeName", "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]"}, } - type_name = "DeliveryRuleRequestHeaderConditionParameters" - def __init__( self, *, - operator: Union[str, "RequestHeaderOperator"], + type_name: Union[str, "_models.RequestHeaderMatchConditionParametersTypeName"], + operator: Union[str, "_models.RequestHeaderOperator"], selector: Optional[str] = None, negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ + :keyword type_name: Required. "DeliveryRuleRequestHeaderConditionParameters" + :paramtype type_name: str or + ~azure.mgmt.cdn.models.RequestHeaderMatchConditionParametersTypeName :keyword selector: Name of Header to be matched. :paramtype selector: str - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -9533,7 +9373,8 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(RequestHeaderMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.selector = selector self.operator = operator self.negate_condition = negate_condition @@ -9541,16 +9382,14 @@ def __init__( self.transforms = transforms -class RequestMethodMatchConditionParameters(msrest.serialization.Model): +class RequestMethodMatchConditionParameters(_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 type_name: Has constant value: "DeliveryRuleRequestMethodConditionParameters". - :vartype type_name: str - :ivar operator: Required. Describes operator to be matched. Possible values include: "Equal". + :ivar type_name: Required. "DeliveryRuleRequestMethodConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.RequestMethodMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. "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 @@ -9562,32 +9401,33 @@ class RequestMethodMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": True}, + "operator": {"required": True}, } _attribute_map = { - '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]'}, + "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]"}, } - type_name = "DeliveryRuleRequestMethodConditionParameters" - def __init__( self, *, - operator: Union[str, "RequestMethodOperator"], + type_name: Union[str, "_models.RequestMethodMatchConditionParametersTypeName"], + operator: Union[str, "_models.RequestMethodOperator"], negate_condition: Optional[bool] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, - match_values: Optional[List[Union[str, "RequestMethodMatchConditionParametersMatchValuesItem"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, + match_values: Optional[List[Union[str, "_models.RequestMethodMatchConditionParametersMatchValuesItem"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: - "Equal". + :keyword type_name: Required. "DeliveryRuleRequestMethodConditionParameters" + :paramtype type_name: str or + ~azure.mgmt.cdn.models.RequestMethodMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. "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 @@ -9597,24 +9437,23 @@ def __init__( :paramtype match_values: list[str or ~azure.mgmt.cdn.models.RequestMethodMatchConditionParametersMatchValuesItem] """ - super(RequestMethodMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.transforms = transforms self.match_values = match_values -class RequestSchemeMatchConditionParameters(msrest.serialization.Model): +class RequestSchemeMatchConditionParameters(_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 type_name: Has constant value: "DeliveryRuleRequestSchemeConditionParameters". - :vartype type_name: str - :ivar operator: Describes operator to be matched. Has constant value: "Equal". - :vartype operator: str + :ivar type_name: Required. "DeliveryRuleRequestSchemeConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. "Equal" + :vartype operator: str or ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParametersOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool :ivar transforms: List of transforms. @@ -9625,30 +9464,35 @@ class RequestSchemeMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True, 'constant': True}, + "type_name": {"required": True}, + "operator": {"required": True}, } _attribute_map = { - '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]'}, + "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]"}, } - type_name = "DeliveryRuleRequestSchemeConditionParameters" - operator = "Equal" - def __init__( self, *, + type_name: Union[str, "_models.RequestSchemeMatchConditionParametersTypeName"], + operator: Union[str, "_models.RequestSchemeMatchConditionParametersOperator"], negate_condition: Optional[bool] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, - match_values: Optional[List[Union[str, "RequestSchemeMatchConditionParametersMatchValuesItem"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, + match_values: Optional[List[Union[str, "_models.RequestSchemeMatchConditionParametersMatchValuesItem"]]] = None, **kwargs ): """ + :keyword type_name: Required. "DeliveryRuleRequestSchemeConditionParameters" + :paramtype type_name: str or + ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. "Equal" + :paramtype operator: str or + ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParametersOperator :keyword negate_condition: Describes if this is negate condition or not. :paramtype negate_condition: bool :keyword transforms: List of transforms. @@ -9657,24 +9501,24 @@ def __init__( :paramtype match_values: list[str or ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParametersMatchValuesItem] """ - super(RequestSchemeMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name + self.operator = operator self.negate_condition = negate_condition self.transforms = transforms self.match_values = match_values -class RequestUriMatchConditionParameters(msrest.serialization.Model): +class RequestUriMatchConditionParameters(_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 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". + :ivar type_name: Required. "DeliveryRuleRequestUriConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.RequestUriMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "RegEx". :vartype operator: str or ~azure.mgmt.cdn.models.RequestUriOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool @@ -9685,33 +9529,34 @@ class RequestUriMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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 = "DeliveryRuleRequestUriConditionParameters" - def __init__( self, *, - operator: Union[str, "RequestUriOperator"], + type_name: Union[str, "_models.RequestUriMatchConditionParametersTypeName"], + operator: Union[str, "_models.RequestUriOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword type_name: Required. "DeliveryRuleRequestUriConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.RequestUriMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -9720,14 +9565,15 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(RequestUriMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class ResourceReference(msrest.serialization.Model): +class ResourceReference(_serialization.Model): """Reference to another resource. :ivar id: Resource ID. @@ -9735,24 +9581,19 @@ class ResourceReference(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str """ - super(ResourceReference, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class ResourcesResponse(msrest.serialization.Model): +class ResourcesResponse(_serialization.Model): """Resources Response. :ivar endpoints: @@ -9762,15 +9603,15 @@ class ResourcesResponse(msrest.serialization.Model): """ _attribute_map = { - 'endpoints': {'key': 'endpoints', 'type': '[ResourcesResponseEndpointsItem]'}, - 'custom_domains': {'key': 'customDomains', 'type': '[ResourcesResponseCustomDomainsItem]'}, + "endpoints": {"key": "endpoints", "type": "[ResourcesResponseEndpointsItem]"}, + "custom_domains": {"key": "customDomains", "type": "[ResourcesResponseCustomDomainsItem]"}, } def __init__( self, *, - endpoints: Optional[List["ResourcesResponseEndpointsItem"]] = None, - custom_domains: Optional[List["ResourcesResponseCustomDomainsItem"]] = None, + endpoints: Optional[List["_models.ResourcesResponseEndpointsItem"]] = None, + custom_domains: Optional[List["_models.ResourcesResponseCustomDomainsItem"]] = None, **kwargs ): """ @@ -9779,12 +9620,12 @@ def __init__( :keyword custom_domains: :paramtype custom_domains: list[~azure.mgmt.cdn.models.ResourcesResponseCustomDomainsItem] """ - super(ResourcesResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.endpoints = endpoints self.custom_domains = custom_domains -class ResourcesResponseCustomDomainsItem(msrest.serialization.Model): +class ResourcesResponseCustomDomainsItem(_serialization.Model): """ResourcesResponseCustomDomainsItem. :ivar id: @@ -9798,16 +9639,16 @@ class ResourcesResponseCustomDomainsItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, - 'history': {'key': 'history', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "endpoint_id": {"key": "endpointId", "type": "str"}, + "history": {"key": "history", "type": "bool"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, endpoint_id: Optional[str] = None, history: Optional[bool] = None, @@ -9823,14 +9664,14 @@ def __init__( :keyword history: :paramtype history: bool """ - super(ResourcesResponseCustomDomainsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.endpoint_id = endpoint_id self.history = history -class ResourcesResponseEndpointsItem(msrest.serialization.Model): +class ResourcesResponseEndpointsItem(_serialization.Model): """ResourcesResponseEndpointsItem. :ivar id: @@ -9845,19 +9686,19 @@ class ResourcesResponseEndpointsItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'history': {'key': 'history', 'type': 'bool'}, - 'custom_domains': {'key': 'customDomains', 'type': '[ResourcesResponseEndpointsPropertiesItemsItem]'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "history": {"key": "history", "type": "bool"}, + "custom_domains": {"key": "customDomains", "type": "[ResourcesResponseEndpointsPropertiesItemsItem]"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, history: Optional[bool] = None, - custom_domains: Optional[List["ResourcesResponseEndpointsPropertiesItemsItem"]] = None, + custom_domains: Optional[List["_models.ResourcesResponseEndpointsPropertiesItemsItem"]] = None, **kwargs ): """ @@ -9871,14 +9712,14 @@ def __init__( :paramtype custom_domains: list[~azure.mgmt.cdn.models.ResourcesResponseEndpointsPropertiesItemsItem] """ - super(ResourcesResponseEndpointsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.history = history self.custom_domains = custom_domains -class ResourcesResponseEndpointsPropertiesItemsItem(msrest.serialization.Model): +class ResourcesResponseEndpointsPropertiesItemsItem(_serialization.Model): """ResourcesResponseEndpointsPropertiesItemsItem. :ivar id: @@ -9892,16 +9733,16 @@ class ResourcesResponseEndpointsPropertiesItemsItem(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, - 'history': {'key': 'history', 'type': 'bool'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "endpoint_id": {"key": "endpointId", "type": "str"}, + "history": {"key": "history", "type": "bool"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, endpoint_id: Optional[str] = None, history: Optional[bool] = None, @@ -9917,22 +9758,22 @@ def __init__( :keyword history: :paramtype history: bool """ - super(ResourcesResponseEndpointsPropertiesItemsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.endpoint_id = endpoint_id self.history = history -class ResourceUsage(msrest.serialization.Model): +class ResourceUsage(_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 unit: Unit of the usage. e.g. count. "count" + :vartype unit: str or ~azure.mgmt.cdn.models.ResourceUsageUnit :ivar current_value: Actual value of usage on the specified resource type. :vartype current_value: int :ivar limit: Quota of the specified resource type. @@ -9940,33 +9781,29 @@ class ResourceUsage(msrest.serialization.Model): """ _validation = { - 'resource_type': {'readonly': True}, - 'unit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.resource_type = None self.unit = None self.current_value = None self.limit = None -class ResourceUsageListResult(msrest.serialization.Model): +class ResourceUsageListResult(_serialization.Model): """Output of check resource usage API. Variables are only populated by the server, and will be ignored when sending a request. @@ -9978,34 +9815,29 @@ class ResourceUsageListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceUsage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ResourceUsage]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class ResponseBasedOriginErrorDetectionParameters(msrest.serialization.Model): +class ResponseBasedOriginErrorDetectionParameters(_serialization.Model): """The JSON object that contains the properties to determine origin health using real requests/responses. :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", + which origin will be deemed unhealthy. Known values are: "None", "TcpErrorsOnly", and "TcpAndHttpErrors". :vartype response_based_detected_error_types: str or ~azure.mgmt.cdn.models.ResponseBasedDetectedErrorTypes @@ -10018,26 +9850,29 @@ class ResponseBasedOriginErrorDetectionParameters(msrest.serialization.Model): """ _validation = { - 'response_based_failover_threshold_percentage': {'maximum': 100, 'minimum': 0}, + "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]'}, + "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, *, - response_based_detected_error_types: Optional[Union[str, "ResponseBasedDetectedErrorTypes"]] = None, + response_based_detected_error_types: Optional[Union[str, "_models.ResponseBasedDetectedErrorTypes"]] = None, response_based_failover_threshold_percentage: Optional[int] = None, - http_error_ranges: Optional[List["HttpErrorRangeParameters"]] = None, + http_error_ranges: Optional[List["_models.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", + for which origin will be deemed unhealthy. Known values are: "None", "TcpErrorsOnly", and "TcpAndHttpErrors". :paramtype response_based_detected_error_types: str or ~azure.mgmt.cdn.models.ResponseBasedDetectedErrorTypes @@ -10048,13 +9883,13 @@ def __init__( errors for origin and it is marked as unhealthy. :paramtype http_error_ranges: list[~azure.mgmt.cdn.models.HttpErrorRangeParameters] """ - super(ResponseBasedOriginErrorDetectionParameters, self).__init__(**kwargs) + super().__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(ProxyResource): +class Route(ProxyResource): # pylint: disable=too-many-instance-attributes """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. @@ -10086,71 +9921,71 @@ class Route(ProxyResource): 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". + Known values are: "HttpOnly", "HttpsOnly", and "MatchRequest". :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". + Known values are: "Enabled" and "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". + Known values are: "Enabled" and "Disabled". :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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "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}, - 'endpoint_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "endpoint_name": {"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'}, - '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]'}, - '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'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "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]"}, + "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"}, + "enabled_state": {"key": "properties.enabledState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "deployment_status": {"key": "properties.deploymentStatus", "type": "str"}, } def __init__( self, *, - custom_domains: Optional[List["ActivatedResourceReference"]] = None, - origin_group: Optional["ResourceReference"] = None, + custom_domains: Optional[List["_models.ActivatedResourceReference"]] = None, + origin_group: Optional["_models.ResourceReference"] = None, origin_path: Optional[str] = None, - rule_sets: Optional[List["ResourceReference"]] = None, - supported_protocols: Optional[List[Union[str, "AFDEndpointProtocols"]]] = None, + rule_sets: Optional[List["_models.ResourceReference"]] = None, + supported_protocols: Optional[List[Union[str, "_models.AFDEndpointProtocols"]]] = None, patterns_to_match: Optional[List[str]] = 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, + cache_configuration: Optional["_models.AfdRouteCacheConfiguration"] = None, + forwarding_protocol: Optional[Union[str, "_models.ForwardingProtocol"]] = None, + link_to_default_domain: Optional[Union[str, "_models.LinkToDefaultDomain"]] = None, + https_redirect: Optional[Union[str, "_models.HttpsRedirect"]] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs ): """ @@ -10171,20 +10006,20 @@ def __init__( 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". + Known values are: "HttpOnly", "HttpsOnly", and "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". + domain. Known values are: "Enabled" and "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". + Known values are: "Enabled" and "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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :paramtype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ - super(Route, self).__init__(**kwargs) + super().__init__(**kwargs) self.endpoint_name = None self.custom_domains = custom_domains self.origin_group = origin_group @@ -10201,15 +10036,14 @@ def __init__( self.deployment_status = None -class RouteConfigurationOverrideActionParameters(msrest.serialization.Model): +class RouteConfigurationOverrideActionParameters(_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 type_name: Required. "DeliveryRuleRouteConfigurationOverrideActionParameters" + :vartype type_name: str or + ~azure.mgmt.cdn.models.RouteConfigurationOverrideActionParametersTypeName :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 @@ -10219,25 +10053,27 @@ class RouteConfigurationOverrideActionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, + "type_name": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', 'type': 'str'}, - 'origin_group_override': {'key': 'originGroupOverride', 'type': 'OriginGroupOverride'}, - 'cache_configuration': {'key': 'cacheConfiguration', 'type': 'CacheConfiguration'}, + "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, + type_name: Union[str, "_models.RouteConfigurationOverrideActionParametersTypeName"], + origin_group_override: Optional["_models.OriginGroupOverride"] = None, + cache_configuration: Optional["_models.CacheConfiguration"] = None, **kwargs ): """ + :keyword type_name: Required. "DeliveryRuleRouteConfigurationOverrideActionParameters" + :paramtype type_name: str or + ~azure.mgmt.cdn.models.RouteConfigurationOverrideActionParametersTypeName :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 @@ -10245,12 +10081,13 @@ def __init__( caching, do not provide a cacheConfiguration object. :paramtype cache_configuration: ~azure.mgmt.cdn.models.CacheConfiguration """ - super(RouteConfigurationOverrideActionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.origin_group_override = origin_group_override self.cache_configuration = cache_configuration -class RouteListResult(msrest.serialization.Model): +class RouteListResult(_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. @@ -10262,30 +10099,25 @@ class RouteListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Route]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Route]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class RouteUpdatePropertiesParameters(msrest.serialization.Model): +class RouteUpdatePropertiesParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """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. @@ -10309,53 +10141,53 @@ class RouteUpdatePropertiesParameters(msrest.serialization.Model): 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". + Known values are: "HttpOnly", "HttpsOnly", and "MatchRequest". :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". + Known values are: "Enabled" and "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". + Known values are: "Enabled" and "Disabled". :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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ _validation = { - 'endpoint_name': {'readonly': True}, + "endpoint_name": {"readonly": True}, } _attribute_map = { - '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]'}, - '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'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, + "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]"}, + "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"}, + "enabled_state": {"key": "enabledState", "type": "str"}, } def __init__( self, *, - custom_domains: Optional[List["ActivatedResourceReference"]] = None, - origin_group: Optional["ResourceReference"] = None, + custom_domains: Optional[List["_models.ActivatedResourceReference"]] = None, + origin_group: Optional["_models.ResourceReference"] = None, origin_path: Optional[str] = None, - rule_sets: Optional[List["ResourceReference"]] = None, - supported_protocols: Optional[List[Union[str, "AFDEndpointProtocols"]]] = None, + rule_sets: Optional[List["_models.ResourceReference"]] = None, + supported_protocols: Optional[List[Union[str, "_models.AFDEndpointProtocols"]]] = None, patterns_to_match: Optional[List[str]] = 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, + cache_configuration: Optional["_models.AfdRouteCacheConfiguration"] = None, + forwarding_protocol: Optional[Union[str, "_models.ForwardingProtocol"]] = None, + link_to_default_domain: Optional[Union[str, "_models.LinkToDefaultDomain"]] = None, + https_redirect: Optional[Union[str, "_models.HttpsRedirect"]] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs ): """ @@ -10376,20 +10208,20 @@ def __init__( 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". + Known values are: "HttpOnly", "HttpsOnly", and "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". + domain. Known values are: "Enabled" and "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". + Known values are: "Enabled" and "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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :paramtype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ - super(RouteUpdatePropertiesParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.endpoint_name = None self.custom_domains = custom_domains self.origin_group = origin_group @@ -10404,11 +10236,19 @@ def __init__( self.enabled_state = enabled_state -class RouteProperties(AFDStateProperties, RouteUpdatePropertiesParameters): +class RouteProperties( + RouteUpdatePropertiesParameters, AFDStateProperties +): # pylint: disable=too-many-instance-attributes """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. + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and + "Failed". + :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar endpoint_name: The name of the endpoint which holds the route. :vartype endpoint_name: str :ivar custom_domains: Domains referenced by this endpoint. @@ -10428,63 +10268,57 @@ class RouteProperties(AFDStateProperties, RouteUpdatePropertiesParameters): 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". + Known values are: "HttpOnly", "HttpsOnly", and "MatchRequest". :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". + Known values are: "Enabled" and "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". + Known values are: "Enabled" and "Disabled". :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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :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", - "Failed". - :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus """ _validation = { - 'endpoint_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, + "provisioning_state": {"readonly": True}, + "deployment_status": {"readonly": True}, + "endpoint_name": {"readonly": True}, } _attribute_map = { - '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]'}, - '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'}, - 'enabled_state': {'key': 'enabledState', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_status": {"key": "deploymentStatus", "type": "str"}, + "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]"}, + "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"}, + "enabled_state": {"key": "enabledState", "type": "str"}, } def __init__( self, *, - custom_domains: Optional[List["ActivatedResourceReference"]] = None, - origin_group: Optional["ResourceReference"] = None, + custom_domains: Optional[List["_models.ActivatedResourceReference"]] = None, + origin_group: Optional["_models.ResourceReference"] = None, origin_path: Optional[str] = None, - rule_sets: Optional[List["ResourceReference"]] = None, - supported_protocols: Optional[List[Union[str, "AFDEndpointProtocols"]]] = None, + rule_sets: Optional[List["_models.ResourceReference"]] = None, + supported_protocols: Optional[List[Union[str, "_models.AFDEndpointProtocols"]]] = None, patterns_to_match: Optional[List[str]] = 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, + cache_configuration: Optional["_models.AfdRouteCacheConfiguration"] = None, + forwarding_protocol: Optional[Union[str, "_models.ForwardingProtocol"]] = None, + link_to_default_domain: Optional[Union[str, "_models.LinkToDefaultDomain"]] = None, + https_redirect: Optional[Union[str, "_models.HttpsRedirect"]] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs ): """ @@ -10505,20 +10339,35 @@ def __init__( 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". + Known values are: "HttpOnly", "HttpsOnly", and "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". + domain. Known values are: "Enabled" and "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". + Known values are: "Enabled" and "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". + 'Disabled'. Known values are: "Enabled" and "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) + super().__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.provisioning_state = None + self.deployment_status = None self.endpoint_name = None self.custom_domains = custom_domains self.origin_group = origin_group @@ -10531,11 +10380,9 @@ def __init__( self.link_to_default_domain = link_to_default_domain self.https_redirect = https_redirect self.enabled_state = enabled_state - self.provisioning_state = None - self.deployment_status = None -class RouteUpdateParameters(msrest.serialization.Model): +class RouteUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """The domain JSON object required for domain creation or update. Variables are only populated by the server, and will be ignored when sending a request. @@ -10559,53 +10406,53 @@ class RouteUpdateParameters(msrest.serialization.Model): 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". + Known values are: "HttpOnly", "HttpsOnly", and "MatchRequest". :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". + Known values are: "Enabled" and "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". + Known values are: "Enabled" and "Disabled". :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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :vartype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ _validation = { - 'endpoint_name': {'readonly': True}, + "endpoint_name": {"readonly": True}, } _attribute_map = { - '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]'}, - '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'}, - 'enabled_state': {'key': 'properties.enabledState', 'type': 'str'}, + "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]"}, + "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"}, + "enabled_state": {"key": "properties.enabledState", "type": "str"}, } def __init__( self, *, - custom_domains: Optional[List["ActivatedResourceReference"]] = None, - origin_group: Optional["ResourceReference"] = None, + custom_domains: Optional[List["_models.ActivatedResourceReference"]] = None, + origin_group: Optional["_models.ResourceReference"] = None, origin_path: Optional[str] = None, - rule_sets: Optional[List["ResourceReference"]] = None, - supported_protocols: Optional[List[Union[str, "AFDEndpointProtocols"]]] = None, + rule_sets: Optional[List["_models.ResourceReference"]] = None, + supported_protocols: Optional[List[Union[str, "_models.AFDEndpointProtocols"]]] = None, patterns_to_match: Optional[List[str]] = 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, + cache_configuration: Optional["_models.AfdRouteCacheConfiguration"] = None, + forwarding_protocol: Optional[Union[str, "_models.ForwardingProtocol"]] = None, + link_to_default_domain: Optional[Union[str, "_models.LinkToDefaultDomain"]] = None, + https_redirect: Optional[Union[str, "_models.HttpsRedirect"]] = None, + enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs ): """ @@ -10626,20 +10473,20 @@ def __init__( 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". + Known values are: "HttpOnly", "HttpsOnly", and "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". + domain. Known values are: "Enabled" and "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". + Known values are: "Enabled" and "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". + 'Disabled'. Known values are: "Enabled" and "Disabled". :paramtype enabled_state: str or ~azure.mgmt.cdn.models.EnabledState """ - super(RouteUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.endpoint_name = None self.custom_domains = custom_domains self.origin_group = origin_group @@ -10654,7 +10501,7 @@ def __init__( self.enabled_state = enabled_state -class Rule(ProxyResource): +class Rule(ProxyResource): # pylint: disable=too-many-instance-attributes """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. @@ -10680,48 +10527,48 @@ class Rule(ProxyResource): satisfied. :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". + running the remaining rules or stop. If not present, defaults to Continue. Known values are: + "Continue" and "Stop". :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior - :ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed", - "Updating", "Deleting", "Creating". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "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}, - 'rule_set_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "rule_set_name": {"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'}, - '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]'}, - 'match_processing_behavior': {'key': 'properties.matchProcessingBehavior', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "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]"}, + "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, *, order: Optional[int] = None, - conditions: Optional[List["DeliveryRuleCondition"]] = None, - actions: Optional[List["DeliveryRuleAction"]] = None, - match_processing_behavior: Optional[Union[str, "MatchProcessingBehavior"]] = None, + conditions: Optional[List["_models.DeliveryRuleCondition"]] = None, + actions: Optional[List["_models.DeliveryRuleAction"]] = None, + match_processing_behavior: Optional[Union[str, "_models.MatchProcessingBehavior"]] = None, **kwargs ): """ @@ -10736,11 +10583,11 @@ def __init__( 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". + running the remaining rules or stop. If not present, defaults to Continue. Known values are: + "Continue" and "Stop". :paramtype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ - super(Rule, self).__init__(**kwargs) + super().__init__(**kwargs) self.rule_set_name = None self.order = order self.conditions = conditions @@ -10750,7 +10597,7 @@ def __init__( self.deployment_status = None -class RuleListResult(msrest.serialization.Model): +class RuleListResult(_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. @@ -10762,30 +10609,25 @@ class RuleListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Rule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Rule]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link -class RuleUpdatePropertiesParameters(msrest.serialization.Model): +class RuleUpdatePropertiesParameters(_serialization.Model): """The JSON object that contains the properties of the rule to update. Variables are only populated by the server, and will be ignored when sending a request. @@ -10803,30 +10645,30 @@ class RuleUpdatePropertiesParameters(msrest.serialization.Model): satisfied. :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". + running the remaining rules or stop. If not present, defaults to Continue. Known values are: + "Continue" and "Stop". :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ _validation = { - 'rule_set_name': {'readonly': True}, + "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]'}, - 'match_processing_behavior': {'key': 'matchProcessingBehavior', 'type': 'str'}, + "rule_set_name": {"key": "ruleSetName", "type": "str"}, + "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, *, order: Optional[int] = None, - conditions: Optional[List["DeliveryRuleCondition"]] = None, - actions: Optional[List["DeliveryRuleAction"]] = None, - match_processing_behavior: Optional[Union[str, "MatchProcessingBehavior"]] = None, + conditions: Optional[List["_models.DeliveryRuleCondition"]] = None, + actions: Optional[List["_models.DeliveryRuleAction"]] = None, + match_processing_behavior: Optional[Union[str, "_models.MatchProcessingBehavior"]] = None, **kwargs ): """ @@ -10841,11 +10683,11 @@ def __init__( 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". + running the remaining rules or stop. If not present, defaults to Continue. Known values are: + "Continue" and "Stop". :paramtype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ - super(RuleUpdatePropertiesParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.rule_set_name = None self.order = order self.conditions = conditions @@ -10853,11 +10695,17 @@ def __init__( self.match_processing_behavior = match_processing_behavior -class RuleProperties(AFDStateProperties, RuleUpdatePropertiesParameters): +class RuleProperties(RuleUpdatePropertiesParameters, AFDStateProperties): """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. + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and + "Failed". + :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :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 @@ -10871,40 +10719,34 @@ class RuleProperties(AFDStateProperties, RuleUpdatePropertiesParameters): satisfied. :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". + running the remaining rules or stop. If not present, defaults to Continue. Known values are: + "Continue" and "Stop". :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", - "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}, + "provisioning_state": {"readonly": True}, + "deployment_status": {"readonly": True}, + "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]'}, - 'match_processing_behavior': {'key': 'matchProcessingBehavior', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'deploymentStatus', 'type': 'str'}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_status": {"key": "deploymentStatus", "type": "str"}, + "rule_set_name": {"key": "ruleSetName", "type": "str"}, + "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, *, order: Optional[int] = None, - conditions: Optional[List["DeliveryRuleCondition"]] = None, - actions: Optional[List["DeliveryRuleAction"]] = None, - match_processing_behavior: Optional[Union[str, "MatchProcessingBehavior"]] = None, + conditions: Optional[List["_models.DeliveryRuleCondition"]] = None, + actions: Optional[List["_models.DeliveryRuleAction"]] = None, + match_processing_behavior: Optional[Union[str, "_models.MatchProcessingBehavior"]] = None, **kwargs ): """ @@ -10919,18 +10761,24 @@ def __init__( 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". + running the remaining rules or stop. If not present, defaults to Continue. Known values are: + "Continue" and "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) + super().__init__( + order=order, + conditions=conditions, + actions=actions, + match_processing_behavior=match_processing_behavior, + **kwargs + ) + self.provisioning_state = None + self.deployment_status = None self.rule_set_name = None self.order = order self.conditions = conditions self.actions = actions self.match_processing_behavior = match_processing_behavior - self.provisioning_state = None - self.deployment_status = None class RuleSet(ProxyResource): @@ -10946,10 +10794,10 @@ class RuleSet(ProxyResource): :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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar profile_name: The name of the profile which holds the rule set. @@ -10957,38 +10805,34 @@ class RuleSet(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'profile_name': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "deployment_status": {"readonly": True}, + "profile_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'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'deployment_status': {'key': 'properties.deploymentStatus', 'type': 'str'}, - 'profile_name': {'key': 'properties.profileName', 'type': 'str'}, + "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"}, + "profile_name": {"key": "properties.profileName", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(RuleSet, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.provisioning_state = None self.deployment_status = None self.profile_name = None -class RuleSetListResult(msrest.serialization.Model): +class RuleSetListResult(_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. @@ -11000,25 +10844,20 @@ class RuleSetListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[RuleSet]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[RuleSet]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link @@ -11028,10 +10867,10 @@ class RuleSetProperties(AFDStateProperties): 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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar profile_name: The name of the profile which holds the rule set. @@ -11039,28 +10878,24 @@ class RuleSetProperties(AFDStateProperties): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'profile_name': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.profile_name = None -class RuleUpdateParameters(msrest.serialization.Model): +class RuleUpdateParameters(_serialization.Model): """The domain JSON object required for domain creation or update. Variables are only populated by the server, and will be ignored when sending a request. @@ -11078,30 +10913,30 @@ class RuleUpdateParameters(msrest.serialization.Model): satisfied. :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". + running the remaining rules or stop. If not present, defaults to Continue. Known values are: + "Continue" and "Stop". :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ _validation = { - 'rule_set_name': {'readonly': True}, + "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]'}, - 'match_processing_behavior': {'key': 'properties.matchProcessingBehavior', 'type': 'str'}, + "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]"}, + "match_processing_behavior": {"key": "properties.matchProcessingBehavior", "type": "str"}, } def __init__( self, *, order: Optional[int] = None, - conditions: Optional[List["DeliveryRuleCondition"]] = None, - actions: Optional[List["DeliveryRuleAction"]] = None, - match_processing_behavior: Optional[Union[str, "MatchProcessingBehavior"]] = None, + conditions: Optional[List["_models.DeliveryRuleCondition"]] = None, + actions: Optional[List["_models.DeliveryRuleAction"]] = None, + match_processing_behavior: Optional[Union[str, "_models.MatchProcessingBehavior"]] = None, **kwargs ): """ @@ -11116,11 +10951,11 @@ def __init__( 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". + running the remaining rules or stop. If not present, defaults to Continue. Known values are: + "Continue" and "Stop". :paramtype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ - super(RuleUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.rule_set_name = None self.order = order self.conditions = conditions @@ -11141,10 +10976,10 @@ class Secret(ProxyResource): :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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar profile_name: The name of the profile which holds the secret. @@ -11154,44 +10989,39 @@ class Secret(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'profile_name': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "deployment_status": {"readonly": True}, + "profile_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'}, - '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'}, + "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"}, + "profile_name": {"key": "properties.profileName", "type": "str"}, + "parameters": {"key": "properties.parameters", "type": "SecretParameters"}, } - def __init__( - self, - *, - parameters: Optional["SecretParameters"] = None, - **kwargs - ): + def __init__(self, *, parameters: Optional["_models.SecretParameters"] = None, **kwargs): """ :keyword parameters: object which contains secret parameters. :paramtype parameters: ~azure.mgmt.cdn.models.SecretParameters """ - super(Secret, self).__init__(**kwargs) + super().__init__(**kwargs) self.provisioning_state = None self.deployment_status = None self.profile_name = None self.parameters = parameters -class SecretListResult(msrest.serialization.Model): +class SecretListResult(_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. @@ -11203,25 +11033,20 @@ class SecretListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[Secret]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Secret]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link @@ -11231,10 +11056,10 @@ class SecretProperties(AFDStateProperties): 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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar profile_name: The name of the profile which holds the secret. @@ -11244,29 +11069,24 @@ class SecretProperties(AFDStateProperties): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'profile_name': {'readonly': True}, + "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'}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_status": {"key": "deploymentStatus", "type": "str"}, + "profile_name": {"key": "profileName", "type": "str"}, + "parameters": {"key": "parameters", "type": "SecretParameters"}, } - def __init__( - self, - *, - parameters: Optional["SecretParameters"] = None, - **kwargs - ): + def __init__(self, *, parameters: Optional["_models.SecretParameters"] = None, **kwargs): """ :keyword parameters: object which contains secret parameters. :paramtype parameters: ~azure.mgmt.cdn.models.SecretParameters """ - super(SecretProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.profile_name = None self.parameters = parameters @@ -11284,10 +11104,10 @@ class SecurityPolicy(ProxyResource): :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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar profile_name: The name of the profile which holds the security policy. @@ -11297,44 +11117,39 @@ class SecurityPolicy(ProxyResource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'profile_name': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "deployment_status": {"readonly": True}, + "profile_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'}, - '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': 'SecurityPolicyPropertiesParameters'}, + "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"}, + "profile_name": {"key": "properties.profileName", "type": "str"}, + "parameters": {"key": "properties.parameters", "type": "SecurityPolicyPropertiesParameters"}, } - def __init__( - self, - *, - parameters: Optional["SecurityPolicyPropertiesParameters"] = None, - **kwargs - ): + def __init__(self, *, parameters: Optional["_models.SecurityPolicyPropertiesParameters"] = None, **kwargs): """ :keyword parameters: object which contains security policy parameters. :paramtype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters """ - super(SecurityPolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.provisioning_state = None self.deployment_status = None self.profile_name = None self.parameters = parameters -class SecurityPolicyListResult(msrest.serialization.Model): +class SecurityPolicyListResult(_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. @@ -11346,25 +11161,20 @@ class SecurityPolicyListResult(msrest.serialization.Model): """ _validation = { - 'value': {'readonly': True}, + "value": {"readonly": True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[SecurityPolicy]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, 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) + super().__init__(**kwargs) self.value = None self.next_link = next_link @@ -11374,10 +11184,10 @@ class SecurityPolicyProperties(AFDStateProperties): 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". + :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", + "Updating", "Deleting", and "Creating". :vartype provisioning_state: str or ~azure.mgmt.cdn.models.AfdProvisioningState - :ivar deployment_status: Possible values include: "NotStarted", "InProgress", "Succeeded", + :ivar deployment_status: Known values are: "NotStarted", "InProgress", "Succeeded", and "Failed". :vartype deployment_status: str or ~azure.mgmt.cdn.models.DeploymentStatus :ivar profile_name: The name of the profile which holds the security policy. @@ -11387,69 +11197,57 @@ class SecurityPolicyProperties(AFDStateProperties): """ _validation = { - 'provisioning_state': {'readonly': True}, - 'deployment_status': {'readonly': True}, - 'profile_name': {'readonly': True}, + "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'}, + "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 - ): + def __init__(self, *, parameters: Optional["_models.SecurityPolicyPropertiesParameters"] = None, **kwargs): """ :keyword parameters: object which contains security policy parameters. :paramtype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters """ - super(SecurityPolicyProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.profile_name = None self.parameters = parameters -class SecurityPolicyPropertiesParameters(msrest.serialization.Model): +class SecurityPolicyPropertiesParameters(_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. + 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. - :ivar type: Required. The type of the Security policy to create.Constant filled by server. - Possible values include: "WebApplicationFirewall". + :ivar type: The type of the Security policy to create. Required. "WebApplicationFirewall" :vartype type: str or ~azure.mgmt.cdn.models.SecurityPolicyType """ _validation = { - 'type': {'required': True}, + "type": {"required": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, } - _subtype_map = { - 'type': {'WebApplicationFirewall': 'SecurityPolicyWebApplicationFirewallParameters'} - } + _subtype_map = {"type": {"WebApplicationFirewall": "SecurityPolicyWebApplicationFirewallParameters"}} - def __init__( - self, - **kwargs - ): - """ - """ - super(SecurityPolicyPropertiesParameters, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.type = None # type: Optional[str] -class SecurityPolicyUpdateParameters(msrest.serialization.Model): +class SecurityPolicyUpdateParameters(_serialization.Model): """The JSON object containing security policy update parameters. :ivar parameters: object which contains security policy parameters. @@ -11457,24 +11255,19 @@ class SecurityPolicyUpdateParameters(msrest.serialization.Model): """ _attribute_map = { - 'parameters': {'key': 'properties.parameters', 'type': 'SecurityPolicyPropertiesParameters'}, + "parameters": {"key": "properties.parameters", "type": "SecurityPolicyPropertiesParameters"}, } - def __init__( - self, - *, - parameters: Optional["SecurityPolicyPropertiesParameters"] = None, - **kwargs - ): + def __init__(self, *, parameters: Optional["_models.SecurityPolicyPropertiesParameters"] = None, **kwargs): """ :keyword parameters: object which contains security policy parameters. :paramtype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters """ - super(SecurityPolicyUpdateParameters, self).__init__(**kwargs) + super().__init__(**kwargs) self.parameters = parameters -class SecurityPolicyWebApplicationFirewallAssociation(msrest.serialization.Model): +class SecurityPolicyWebApplicationFirewallAssociation(_serialization.Model): """settings for security policy patterns to match. :ivar domains: List of domains. @@ -11484,14 +11277,14 @@ class SecurityPolicyWebApplicationFirewallAssociation(msrest.serialization.Model """ _attribute_map = { - 'domains': {'key': 'domains', 'type': '[ActivatedResourceReference]'}, - 'patterns_to_match': {'key': 'patternsToMatch', 'type': '[str]'}, + "domains": {"key": "domains", "type": "[ActivatedResourceReference]"}, + "patterns_to_match": {"key": "patternsToMatch", "type": "[str]"}, } def __init__( self, *, - domains: Optional[List["ActivatedResourceReference"]] = None, + domains: Optional[List["_models.ActivatedResourceReference"]] = None, patterns_to_match: Optional[List[str]] = None, **kwargs ): @@ -11501,7 +11294,7 @@ def __init__( :keyword patterns_to_match: List of paths. :paramtype patterns_to_match: list[str] """ - super(SecurityPolicyWebApplicationFirewallAssociation, self).__init__(**kwargs) + super().__init__(**kwargs) self.domains = domains self.patterns_to_match = patterns_to_match @@ -11511,8 +11304,7 @@ class SecurityPolicyWebApplicationFirewallParameters(SecurityPolicyPropertiesPar All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the Security policy to create.Constant filled by server. - Possible values include: "WebApplicationFirewall". + :ivar type: The type of the Security policy to create. Required. "WebApplicationFirewall" :vartype type: str or ~azure.mgmt.cdn.models.SecurityPolicyType :ivar waf_policy: Resource ID. :vartype waf_policy: ~azure.mgmt.cdn.models.ResourceReference @@ -11522,20 +11314,20 @@ class SecurityPolicyWebApplicationFirewallParameters(SecurityPolicyPropertiesPar """ _validation = { - 'type': {'required': True}, + "type": {"required": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'waf_policy': {'key': 'wafPolicy', 'type': 'ResourceReference'}, - 'associations': {'key': 'associations', 'type': '[SecurityPolicyWebApplicationFirewallAssociation]'}, + "type": {"key": "type", "type": "str"}, + "waf_policy": {"key": "wafPolicy", "type": "ResourceReference"}, + "associations": {"key": "associations", "type": "[SecurityPolicyWebApplicationFirewallAssociation]"}, } def __init__( self, *, - waf_policy: Optional["ResourceReference"] = None, - associations: Optional[List["SecurityPolicyWebApplicationFirewallAssociation"]] = None, + waf_policy: Optional["_models.ResourceReference"] = None, + associations: Optional[List["_models.SecurityPolicyWebApplicationFirewallAssociation"]] = None, **kwargs ): """ @@ -11545,24 +11337,22 @@ def __init__( :paramtype associations: list[~azure.mgmt.cdn.models.SecurityPolicyWebApplicationFirewallAssociation] """ - super(SecurityPolicyWebApplicationFirewallParameters, self).__init__(**kwargs) - self.type = 'WebApplicationFirewall' # type: str + super().__init__(**kwargs) + self.type = "WebApplicationFirewall" # type: str self.waf_policy = waf_policy self.associations = associations -class ServerPortMatchConditionParameters(msrest.serialization.Model): +class ServerPortMatchConditionParameters(_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". + :ivar type_name: Required. "DeliveryRuleServerPortConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.ServerPortMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "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 @@ -11573,33 +11363,34 @@ class ServerPortMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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"], + type_name: Union[str, "_models.ServerPortMatchConditionParametersTypeName"], + operator: Union[str, "_models.ServerPortOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword type_name: Required. "DeliveryRuleServerPortConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.ServerPortMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -11608,14 +11399,15 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(ServerPortMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class ServiceSpecification(msrest.serialization.Model): +class ServiceSpecification(_serialization.Model): """One property of operation, include log specifications. :ivar log_specifications: Log specifications of operation. @@ -11625,15 +11417,15 @@ class ServiceSpecification(msrest.serialization.Model): """ _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + "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, + log_specifications: Optional[List["_models.LogSpecification"]] = None, + metric_specifications: Optional[List["_models.MetricSpecification"]] = None, **kwargs ): """ @@ -11642,12 +11434,12 @@ def __init__( :keyword metric_specifications: Metric specifications of operation. :paramtype metric_specifications: list[~azure.mgmt.cdn.models.MetricSpecification] """ - super(ServiceSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications -class SharedPrivateLinkResourceProperties(msrest.serialization.Model): +class SharedPrivateLinkResourceProperties(_serialization.Model): """Describes the properties of an existing Shared Private Link Resource to use when connecting to a private origin. :ivar private_link: The resource id of the resource the shared private link resource is for. @@ -11661,27 +11453,27 @@ class SharedPrivateLinkResourceProperties(msrest.serialization.Model): resource. :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". + Disconnected, or Timeout. Known values are: "Pending", "Approved", "Rejected", "Disconnected", + and "Timeout". :vartype 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'}, + "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, *, - private_link: Optional["ResourceReference"] = None, + private_link: Optional["_models.ResourceReference"] = None, private_link_location: Optional[str] = None, group_id: Optional[str] = None, request_message: Optional[str] = None, - status: Optional[Union[str, "SharedPrivateLinkResourceStatus"]] = None, + status: Optional[Union[str, "_models.SharedPrivateLinkResourceStatus"]] = None, **kwargs ): """ @@ -11696,11 +11488,11 @@ def __init__( 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". + Rejected, Disconnected, or Timeout. Known values are: "Pending", "Approved", "Rejected", + "Disconnected", and "Timeout". :paramtype status: str or ~azure.mgmt.cdn.models.SharedPrivateLinkResourceStatus """ - super(SharedPrivateLinkResourceProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.private_link = private_link self.private_link_location = private_link_location self.group_id = group_id @@ -11708,61 +11500,54 @@ def __init__( self.status = status -class Sku(msrest.serialization.Model): +class Sku(_serialization.Model): """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. + 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", "Standard_AzureFrontDoor", "Premium_AzureFrontDoor", - "Standard_955BandWidth_ChinaCdn", "Standard_AvgBandWidth_ChinaCdn", "StandardPlus_ChinaCdn", - "StandardPlus_955BandWidth_ChinaCdn", "StandardPlus_AvgBandWidth_ChinaCdn". - :vartype name: str or ~azure.mgmt.cdn.models.SkuName + :ivar name: Name of the pricing tier. Known values are: "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", and "StandardPlus_AvgBandWidth_ChinaCdn". + :vartype name: str or ~azure.mgmt.cdn.models.SkuName """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - name: Optional[Union[str, "SkuName"]] = None, - **kwargs - ): + def __init__(self, *, name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs): """ - :keyword name: Name of the pricing tier. Possible values include: "Standard_Verizon", + :keyword name: Name of the pricing tier. Known values are: "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". + "StandardPlus_955BandWidth_ChinaCdn", and "StandardPlus_AvgBandWidth_ChinaCdn". :paramtype name: str or ~azure.mgmt.cdn.models.SkuName """ - super(Sku, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name -class SocketAddrMatchConditionParameters(msrest.serialization.Model): +class SocketAddrMatchConditionParameters(_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", + :ivar type_name: Required. "DeliveryRuleSocketAddrConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.SocketAddrMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any" and "IPMatch". :vartype operator: str or ~azure.mgmt.cdn.models.SocketAddrOperator :ivar negate_condition: Describes if this is negate condition or not. @@ -11774,31 +11559,32 @@ class SocketAddrMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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"], + type_name: Union[str, "_models.SocketAddrMatchConditionParametersTypeName"], + operator: Union[str, "_models.SocketAddrOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword type_name: Required. "DeliveryRuleSocketAddrConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.SocketAddrMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any" and "IPMatch". :paramtype operator: str or ~azure.mgmt.cdn.models.SocketAddrOperator :keyword negate_condition: Describes if this is negate condition or not. @@ -11808,23 +11594,22 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(SocketAddrMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class SslProtocolMatchConditionParameters(msrest.serialization.Model): +class SslProtocolMatchConditionParameters(_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". + :ivar type_name: Required. "DeliveryRuleSslProtocolConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.SslProtocolMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. "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 @@ -11835,32 +11620,32 @@ class SslProtocolMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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"], + type_name: Union[str, "_models.SslProtocolMatchConditionParametersTypeName"], + operator: Union[str, "_models.SslProtocolOperator"], negate_condition: Optional[bool] = None, - match_values: Optional[List[Union[str, "SslProtocol"]]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + match_values: Optional[List[Union[str, "_models.SslProtocol"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: - "Equal". + :keyword type_name: Required. "DeliveryRuleSslProtocolConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.SslProtocolMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. "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 @@ -11869,14 +11654,15 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(SslProtocolMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class SsoUri(msrest.serialization.Model): +class SsoUri(_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. @@ -11886,24 +11672,20 @@ class SsoUri(msrest.serialization.Model): """ _validation = { - 'sso_uri_value': {'readonly': True}, + "sso_uri_value": {"readonly": True}, } _attribute_map = { - 'sso_uri_value': {'key': 'ssoUriValue', 'type': 'str'}, + "sso_uri_value": {"key": "ssoUriValue", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SsoUri, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.sso_uri_value = None -class SupportedOptimizationTypesListResult(msrest.serialization.Model): +class SupportedOptimizationTypesListResult(_serialization.Model): """The result of the GetSupportedOptimizationTypes API. Variables are only populated by the server, and will be ignored when sending a request. @@ -11913,79 +11695,75 @@ class SupportedOptimizationTypesListResult(msrest.serialization.Model): """ _validation = { - 'supported_optimization_types': {'readonly': True}, + "supported_optimization_types": {"readonly": True}, } _attribute_map = { - 'supported_optimization_types': {'key': 'supportedOptimizationTypes', 'type': '[str]'}, + "supported_optimization_types": {"key": "supportedOptimizationTypes", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(SupportedOptimizationTypesListResult, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.supported_optimization_types = None -class SystemData(msrest.serialization.Model): +class SystemData(_serialization.Model): """Read only system data. :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". + :ivar created_by_type: The type of identity that created the resource. Known values are: + "user", "application", "managedIdentity", and "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". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "user", "application", "managedIdentity", and "key". :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 = { - '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'}, + "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, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "IdentityType"]] = None, + created_by_type: Optional[Union[str, "_models.IdentityType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "IdentityType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.IdentityType"]] = None, 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". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "user", "application", "managedIdentity", and "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". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "user", "application", "managedIdentity", and "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) + super().__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -11994,18 +11772,17 @@ def __init__( self.last_modified_at = last_modified_at -class UrlFileExtensionMatchConditionParameters(msrest.serialization.Model): +class UrlFileExtensionMatchConditionParameters(_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 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". + :ivar type_name: Required. "DeliveryRuleUrlFileExtensionMatchConditionParameters" + :vartype type_name: str or + ~azure.mgmt.cdn.models.UrlFileExtensionMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "RegEx". :vartype operator: str or ~azure.mgmt.cdn.models.UrlFileExtensionOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool @@ -12016,33 +11793,35 @@ class UrlFileExtensionMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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 = "DeliveryRuleUrlFileExtensionMatchConditionParameters" - def __init__( self, *, - operator: Union[str, "UrlFileExtensionOperator"], + type_name: Union[str, "_models.UrlFileExtensionMatchConditionParametersTypeName"], + operator: Union[str, "_models.UrlFileExtensionOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword type_name: Required. "DeliveryRuleUrlFileExtensionMatchConditionParameters" + :paramtype type_name: str or + ~azure.mgmt.cdn.models.UrlFileExtensionMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -12051,25 +11830,24 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(UrlFileExtensionMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class UrlFileNameMatchConditionParameters(msrest.serialization.Model): +class UrlFileNameMatchConditionParameters(_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 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". + :ivar type_name: Required. "DeliveryRuleUrlFilenameConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.UrlFileNameMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", and "RegEx". :vartype operator: str or ~azure.mgmt.cdn.models.UrlFileNameOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool @@ -12080,33 +11858,34 @@ class UrlFileNameMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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 = "DeliveryRuleUrlFilenameConditionParameters" - def __init__( self, *, - operator: Union[str, "UrlFileNameOperator"], + type_name: Union[str, "_models.UrlFileNameMatchConditionParametersTypeName"], + operator: Union[str, "_models.UrlFileNameOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword type_name: Required. "DeliveryRuleUrlFilenameConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.UrlFileNameMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "RegEx". + "GreaterThanOrEqual", and "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 @@ -12115,25 +11894,24 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(UrlFileNameMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values self.transforms = transforms -class UrlPathMatchConditionParameters(msrest.serialization.Model): +class UrlPathMatchConditionParameters(_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 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". + :ivar type_name: Required. "DeliveryRuleUrlPathMatchConditionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.UrlPathMatchConditionParametersTypeName + :ivar operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", + "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", + "GreaterThanOrEqual", "Wildcard", and "RegEx". :vartype operator: str or ~azure.mgmt.cdn.models.UrlPathOperator :ivar negate_condition: Describes if this is negate condition or not. :vartype negate_condition: bool @@ -12144,33 +11922,34 @@ class UrlPathMatchConditionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'operator': {'required': True}, + "type_name": {"required": 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": {"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 = "DeliveryRuleUrlPathMatchConditionParameters" - def __init__( self, *, - operator: Union[str, "UrlPathOperator"], + type_name: Union[str, "_models.UrlPathMatchConditionParametersTypeName"], + operator: Union[str, "_models.UrlPathOperator"], negate_condition: Optional[bool] = None, match_values: Optional[List[str]] = None, - transforms: Optional[List[Union[str, "Transform"]]] = None, + transforms: Optional[List[Union[str, "_models.Transform"]]] = None, **kwargs ): """ - :keyword operator: Required. Describes operator to be matched. Possible values include: "Any", + :keyword type_name: Required. "DeliveryRuleUrlPathMatchConditionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.UrlPathMatchConditionParametersTypeName + :keyword operator: Describes operator to be matched. Required. Known values are: "Any", "Equal", "Contains", "BeginsWith", "EndsWith", "LessThan", "LessThanOrEqual", "GreaterThan", - "GreaterThanOrEqual", "Wildcard", "RegEx". + "GreaterThanOrEqual", "Wildcard", and "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 @@ -12179,7 +11958,8 @@ def __init__( :keyword transforms: List of transforms. :paramtype transforms: list[str or ~azure.mgmt.cdn.models.Transform] """ - super(UrlPathMatchConditionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.operator = operator self.negate_condition = negate_condition self.match_values = match_values @@ -12191,54 +11971,47 @@ class UrlRedirectAction(DeliveryRuleAction): 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", + :ivar name: The name of the action for the delivery rule. Required. Known values are: + "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", "ModifyResponseHeader", + "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", and "RouteConfigurationOverride". :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :ivar parameters: Required. Defines the parameters for the action. + :ivar parameters: Defines the parameters for the action. Required. :vartype parameters: ~azure.mgmt.cdn.models.UrlRedirectActionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlRedirectActionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "UrlRedirectActionParameters"}, } - def __init__( - self, - *, - parameters: "UrlRedirectActionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.UrlRedirectActionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the action. + :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlRedirectActionParameters """ - super(UrlRedirectAction, self).__init__(**kwargs) - self.name = 'UrlRedirect' # type: str + super().__init__(**kwargs) + self.name = "UrlRedirect" # type: str self.parameters = parameters -class UrlRedirectActionParameters(msrest.serialization.Model): +class UrlRedirectActionParameters(_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 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". + :ivar type_name: Required. "DeliveryRuleUrlRedirectActionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.UrlRedirectActionParametersTypeName + :ivar redirect_type: The redirect type the rule will use when redirecting traffic. Required. + Known values are: "Moved", "Found", "TemporaryRedirect", and "PermanentRedirect". :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". + MatchRequest. Known values are: "MatchRequest", "Http", and "Https". :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. @@ -12257,27 +12030,26 @@ class UrlRedirectActionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'redirect_type': {'required': True}, + "type_name": {"required": True}, + "redirect_type": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', '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'}, + "type_name": {"key": "typeName", "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"}, } - type_name = "DeliveryRuleUrlRedirectActionParameters" - def __init__( self, *, - redirect_type: Union[str, "RedirectType"], - destination_protocol: Optional[Union[str, "DestinationProtocol"]] = None, + type_name: Union[str, "_models.UrlRedirectActionParametersTypeName"], + redirect_type: Union[str, "_models.RedirectType"], + destination_protocol: Optional[Union[str, "_models.DestinationProtocol"]] = None, custom_path: Optional[str] = None, custom_hostname: Optional[str] = None, custom_query_string: Optional[str] = None, @@ -12285,11 +12057,13 @@ def __init__( **kwargs ): """ - :keyword redirect_type: Required. The redirect type the rule will use when redirecting traffic. - Possible values include: "Moved", "Found", "TemporaryRedirect", "PermanentRedirect". + :keyword type_name: Required. "DeliveryRuleUrlRedirectActionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.UrlRedirectActionParametersTypeName + :keyword redirect_type: The redirect type the rule will use when redirecting traffic. Required. + Known values are: "Moved", "Found", "TemporaryRedirect", and "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". + MatchRequest. Known values are: "MatchRequest", "Http", and "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. @@ -12306,7 +12080,8 @@ def __init__( that comes after #. Do not include the #. :paramtype custom_fragment: str """ - super(UrlRedirectActionParameters, self).__init__(**kwargs) + super().__init__(**kwargs) + self.type_name = type_name self.redirect_type = redirect_type self.destination_protocol = destination_protocol self.custom_path = custom_path @@ -12320,93 +12095,88 @@ class UrlRewriteAction(DeliveryRuleAction): 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", + :ivar name: The name of the action for the delivery rule. Required. Known values are: + "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", "ModifyResponseHeader", + "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", and "RouteConfigurationOverride". :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :ivar parameters: Required. Defines the parameters for the action. + :ivar parameters: Defines the parameters for the action. Required. :vartype parameters: ~azure.mgmt.cdn.models.UrlRewriteActionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlRewriteActionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "UrlRewriteActionParameters"}, } - def __init__( - self, - *, - parameters: "UrlRewriteActionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.UrlRewriteActionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the action. + :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlRewriteActionParameters """ - super(UrlRewriteAction, self).__init__(**kwargs) - self.name = 'UrlRewrite' # type: str + super().__init__(**kwargs) + self.name = "UrlRewrite" # type: str self.parameters = parameters -class UrlRewriteActionParameters(msrest.serialization.Model): +class UrlRewriteActionParameters(_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 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. + :ivar type_name: Required. "DeliveryRuleUrlRewriteActionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.UrlRewriteActionParametersTypeName + :ivar source_pattern: define a request URI pattern that identifies the type of requests that + may be rewritten. If value is blank, all strings are matched. Required. :vartype source_pattern: str - :ivar destination: Required. Define the relative URL to which the above requests will be - rewritten by. + :ivar destination: Define the relative URL to which the above requests will be rewritten by. + Required. :vartype destination: str :ivar preserve_unmatched_path: Whether to preserve unmatched path. Default value is true. :vartype preserve_unmatched_path: bool """ _validation = { - 'type_name': {'required': True, 'constant': True}, - 'source_pattern': {'required': True}, - 'destination': {'required': True}, + "type_name": {"required": True}, + "source_pattern": {"required": True}, + "destination": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', 'type': 'str'}, - 'source_pattern': {'key': 'sourcePattern', 'type': 'str'}, - 'destination': {'key': 'destination', 'type': 'str'}, - 'preserve_unmatched_path': {'key': 'preserveUnmatchedPath', 'type': 'bool'}, + "type_name": {"key": "typeName", "type": "str"}, + "source_pattern": {"key": "sourcePattern", "type": "str"}, + "destination": {"key": "destination", "type": "str"}, + "preserve_unmatched_path": {"key": "preserveUnmatchedPath", "type": "bool"}, } - type_name = "DeliveryRuleUrlRewriteActionParameters" - def __init__( self, *, + type_name: Union[str, "_models.UrlRewriteActionParametersTypeName"], source_pattern: str, destination: str, 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. + :keyword type_name: Required. "DeliveryRuleUrlRewriteActionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.UrlRewriteActionParametersTypeName + :keyword source_pattern: define a request URI pattern that identifies the type of requests that + may be rewritten. If value is blank, all strings are matched. Required. :paramtype source_pattern: str - :keyword destination: Required. Define the relative URL to which the above requests will be - rewritten by. + :keyword destination: Define the relative URL to which the above requests will be rewritten by. + Required. :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) + super().__init__(**kwargs) + self.type_name = type_name self.source_pattern = source_pattern self.destination = destination self.preserve_unmatched_path = preserve_unmatched_path @@ -12417,50 +12187,43 @@ class UrlSigningAction(DeliveryRuleAction): 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", + :ivar name: The name of the action for the delivery rule. Required. Known values are: + "CacheExpiration", "CacheKeyQueryString", "ModifyRequestHeader", "ModifyResponseHeader", + "UrlRedirect", "UrlRewrite", "UrlSigning", "OriginGroupOverride", and "RouteConfigurationOverride". :vartype name: str or ~azure.mgmt.cdn.models.DeliveryRuleActionEnum - :ivar parameters: Required. Defines the parameters for the action. + :ivar parameters: Defines the parameters for the action. Required. :vartype parameters: ~azure.mgmt.cdn.models.UrlSigningActionParameters """ _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, + "name": {"required": True}, + "parameters": {"required": True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'UrlSigningActionParameters'}, + "name": {"key": "name", "type": "str"}, + "parameters": {"key": "parameters", "type": "UrlSigningActionParameters"}, } - def __init__( - self, - *, - parameters: "UrlSigningActionParameters", - **kwargs - ): + def __init__(self, *, parameters: "_models.UrlSigningActionParameters", **kwargs): """ - :keyword parameters: Required. Defines the parameters for the action. + :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlSigningActionParameters """ - super(UrlSigningAction, self).__init__(**kwargs) - self.name = 'UrlSigning' # type: str + super().__init__(**kwargs) + self.name = "UrlSigning" # type: str self.parameters = parameters -class UrlSigningActionParameters(msrest.serialization.Model): +class UrlSigningActionParameters(_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 type_name: Has constant value: "DeliveryRuleUrlSigningActionParameters". - :vartype type_name: str - :ivar algorithm: Algorithm to use for URL signing. Possible values include: "SHA256". + :ivar type_name: Required. "DeliveryRuleUrlSigningActionParameters" + :vartype type_name: str or ~azure.mgmt.cdn.models.UrlSigningActionParametersTypeName + :ivar algorithm: Algorithm to use for URL signing. "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. @@ -12468,75 +12231,71 @@ class UrlSigningActionParameters(msrest.serialization.Model): """ _validation = { - 'type_name': {'required': True, 'constant': True}, + "type_name": {"required": True}, } _attribute_map = { - 'type_name': {'key': 'typeName', 'type': 'str'}, - 'algorithm': {'key': 'algorithm', 'type': 'str'}, - 'parameter_name_override': {'key': 'parameterNameOverride', 'type': '[UrlSigningParamIdentifier]'}, + "type_name": {"key": "typeName", "type": "str"}, + "algorithm": {"key": "algorithm", "type": "str"}, + "parameter_name_override": {"key": "parameterNameOverride", "type": "[UrlSigningParamIdentifier]"}, } - type_name = "DeliveryRuleUrlSigningActionParameters" - def __init__( self, *, - algorithm: Optional[Union[str, "Algorithm"]] = None, - parameter_name_override: Optional[List["UrlSigningParamIdentifier"]] = None, + type_name: Union[str, "_models.UrlSigningActionParametersTypeName"], + algorithm: Optional[Union[str, "_models.Algorithm"]] = None, + parameter_name_override: Optional[List["_models.UrlSigningParamIdentifier"]] = None, **kwargs ): """ - :keyword algorithm: Algorithm to use for URL signing. Possible values include: "SHA256". + :keyword type_name: Required. "DeliveryRuleUrlSigningActionParameters" + :paramtype type_name: str or ~azure.mgmt.cdn.models.UrlSigningActionParametersTypeName + :keyword algorithm: Algorithm to use for URL signing. "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) + super().__init__(**kwargs) + self.type_name = type_name self.algorithm = algorithm self.parameter_name_override = parameter_name_override -class UrlSigningKey(msrest.serialization.Model): +class UrlSigningKey(_serialization.Model): """Url signing key. All required parameters must be populated in order to send to Azure. - :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. + :ivar key_id: Defines the customer defined key Id. This id will exist in the incoming request + to indicate the key used to form the hash. Required. :vartype key_id: str - :ivar key_source_parameters: Required. Defines the parameters for using customer key vault for - Url Signing Key. + :ivar key_source_parameters: Defines the parameters for using customer key vault for Url + Signing Key. Required. :vartype key_source_parameters: ~azure.mgmt.cdn.models.KeyVaultSigningKeyParameters """ _validation = { - 'key_id': {'required': True}, - 'key_source_parameters': {'required': True}, + "key_id": {"required": True}, + "key_source_parameters": {"required": True}, } _attribute_map = { - 'key_id': {'key': 'keyId', 'type': 'str'}, - 'key_source_parameters': {'key': 'keySourceParameters', 'type': 'KeyVaultSigningKeyParameters'}, + "key_id": {"key": "keyId", "type": "str"}, + "key_source_parameters": {"key": "keySourceParameters", "type": "KeyVaultSigningKeyParameters"}, } - def __init__( - self, - *, - key_id: str, - key_source_parameters: "KeyVaultSigningKeyParameters", - **kwargs - ): + def __init__(self, *, key_id: str, key_source_parameters: "_models.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. + :keyword key_id: Defines the customer defined key Id. This id will exist in the incoming + request to indicate the key used to form the hash. Required. :paramtype key_id: str - :keyword key_source_parameters: Required. Defines the parameters for using customer key vault - for Url Signing Key. + :keyword key_source_parameters: Defines the parameters for using customer key vault for Url + Signing Key. Required. :paramtype key_source_parameters: ~azure.mgmt.cdn.models.KeyVaultSigningKeyParameters """ - super(UrlSigningKey, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_id = key_id self.key_source_parameters = key_source_parameters @@ -12546,102 +12305,92 @@ class UrlSigningKeyParameters(SecretParameters): 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". + :ivar type: The type of the secret resource. Required. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "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. + :ivar key_id: Defines the customer defined key Id. This id will exist in the incoming request + to indicate the key used to form the hash. Required. :vartype key_id: str - :ivar secret_source: Required. Resource reference to the Azure Key Vault secret. Expected to be - in format of + :ivar secret_source: 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}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + Required. :vartype secret_source: ~azure.mgmt.cdn.models.ResourceReference :ivar secret_version: Version of the secret to be used. :vartype secret_version: str """ _validation = { - 'type': {'required': True}, - 'key_id': {'required': True}, - 'secret_source': {'required': True}, + "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'}, + "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, - *, - key_id: str, - secret_source: "ResourceReference", - secret_version: Optional[str] = None, - **kwargs + self, *, key_id: str, secret_source: "_models.ResourceReference", 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. + :keyword key_id: Defines the customer defined key Id. This id will exist in the incoming + request to indicate the key used to form the hash. Required. :paramtype key_id: str - :keyword secret_source: Required. Resource reference to the Azure Key Vault secret. Expected to - be in format of + :keyword secret_source: 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}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + Required. :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 + super().__init__(**kwargs) + self.type = "UrlSigningKey" # type: str self.key_id = key_id self.secret_source = secret_source self.secret_version = secret_version -class UrlSigningParamIdentifier(msrest.serialization.Model): +class UrlSigningParamIdentifier(_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. - :ivar param_indicator: Required. Indicates the purpose of the parameter. Possible values - include: "Expires", "KeyId", "Signature". + :ivar param_indicator: Indicates the purpose of the parameter. Required. Known values are: + "Expires", "KeyId", and "Signature". :vartype param_indicator: str or ~azure.mgmt.cdn.models.ParamIndicator - :ivar param_name: Required. Parameter name. + :ivar param_name: Parameter name. Required. :vartype param_name: str """ _validation = { - 'param_indicator': {'required': True}, - 'param_name': {'required': True}, + "param_indicator": {"required": True}, + "param_name": {"required": True}, } _attribute_map = { - 'param_indicator': {'key': 'paramIndicator', 'type': 'str'}, - 'param_name': {'key': 'paramName', 'type': 'str'}, + "param_indicator": {"key": "paramIndicator", "type": "str"}, + "param_name": {"key": "paramName", "type": "str"}, } - def __init__( - self, - *, - param_indicator: Union[str, "ParamIndicator"], - param_name: str, - **kwargs - ): + def __init__(self, *, param_indicator: Union[str, "_models.ParamIndicator"], param_name: str, **kwargs): """ - :keyword param_indicator: Required. Indicates the purpose of the parameter. Possible values - include: "Expires", "KeyId", "Signature". + :keyword param_indicator: Indicates the purpose of the parameter. Required. Known values are: + "Expires", "KeyId", and "Signature". :paramtype param_indicator: str or ~azure.mgmt.cdn.models.ParamIndicator - :keyword param_name: Required. Parameter name. + :keyword param_name: Parameter name. Required. :paramtype param_name: str """ - super(UrlSigningParamIdentifier, self).__init__(**kwargs) + super().__init__(**kwargs) self.param_indicator = param_indicator self.param_name = param_name -class Usage(msrest.serialization.Model): +class Usage(_serialization.Model): """Describes resource usage. Variables are only populated by the server, and will be ignored when sending a request. @@ -12650,54 +12399,52 @@ class Usage(msrest.serialization.Model): :ivar id: Resource identifier. :vartype id: str - :ivar unit: Required. An enum describing the unit of measurement. Possible values include: - "Count". + :ivar unit: An enum describing the unit of measurement. Required. "Count" :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. + :ivar current_value: The current value of the usage. Required. + :vartype current_value: int + :ivar limit: The limit of usage. Required. + :vartype limit: int + :ivar name: The name of the type of usage. Required. :vartype name: ~azure.mgmt.cdn.models.UsageName """ _validation = { - 'id': {'readonly': True}, - 'unit': {'required': True}, - 'current_value': {'required': True}, - 'limit': {'required': True}, - 'name': {'required': True}, + "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'}, + "id": {"key": "id", "type": "str"}, + "unit": {"key": "unit", "type": "str"}, + "current_value": {"key": "currentValue", "type": "int"}, + "limit": {"key": "limit", "type": "int"}, + "name": {"key": "name", "type": "UsageName"}, } def __init__( self, *, - unit: Union[str, "UsageUnit"], + unit: Union[str, "_models.UsageUnit"], current_value: int, limit: int, - name: "UsageName", + name: "_models.UsageName", **kwargs ): """ - :keyword unit: Required. An enum describing the unit of measurement. Possible values include: - "Count". + :keyword unit: An enum describing the unit of measurement. Required. "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. + :keyword current_value: The current value of the usage. Required. + :paramtype current_value: int + :keyword limit: The limit of usage. Required. + :paramtype limit: int + :keyword name: The name of the type of usage. Required. :paramtype name: ~azure.mgmt.cdn.models.UsageName """ - super(Usage, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.unit = unit self.current_value = current_value @@ -12705,7 +12452,7 @@ def __init__( self.name = name -class UsageName(msrest.serialization.Model): +class UsageName(_serialization.Model): """The usage names. :ivar value: A string describing the resource name. @@ -12715,29 +12462,23 @@ class UsageName(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__( - self, - *, - value: Optional[str] = None, - localized_value: Optional[str] = None, - **kwargs - ): + def __init__(self, *, value: Optional[str] = None, 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) + super().__init__(**kwargs) self.value = value self.localized_value = localized_value -class UsagesListResult(msrest.serialization.Model): +class UsagesListResult(_serialization.Model): """The list usages operation response. :ivar value: The list of resource usages. @@ -12747,24 +12488,18 @@ class UsagesListResult(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[Usage]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["Usage"]] = None, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Usage"]] = None, 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) + super().__init__(**kwargs) self.value = value self.next_link = next_link @@ -12774,91 +12509,89 @@ class UserManagedHttpsParameters(CustomDomainHttpsParameters): All required parameters must be populated in order to send to Azure. - :ivar certificate_source: Required. Defines the source of the SSL certificate.Constant filled - by server. Possible values include: "AzureKeyVault", "Cdn". + :ivar certificate_source: Defines the source of the SSL certificate. Required. Known values + are: "AzureKeyVault" and "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". + :ivar protocol_type: Defines the TLS extension protocol that is used for secure delivery. + Required. Known values are: "ServerNameIndication" and "IPBased". :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". + :ivar minimum_tls_version: TLS protocol version that will be used for Https. Known values are: + "None", "TLS10", and "TLS12". :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. + :ivar certificate_source_parameters: Defines the certificate source parameters using user's + keyvault certificate for enabling SSL. Required. :vartype certificate_source_parameters: ~azure.mgmt.cdn.models.KeyVaultCertificateSourceParameters """ _validation = { - 'certificate_source': {'required': True}, - 'protocol_type': {'required': True}, - 'certificate_source_parameters': {'required': True}, + "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'}, + "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, *, - protocol_type: Union[str, "ProtocolType"], - certificate_source_parameters: "KeyVaultCertificateSourceParameters", - minimum_tls_version: Optional[Union[str, "MinimumTlsVersion"]] = None, + protocol_type: Union[str, "_models.ProtocolType"], + certificate_source_parameters: "_models.KeyVaultCertificateSourceParameters", + minimum_tls_version: Optional[Union[str, "_models.MinimumTlsVersion"]] = None, **kwargs ): """ - :keyword protocol_type: Required. Defines the TLS extension protocol that is used for secure - delivery. Possible values include: "ServerNameIndication", "IPBased". + :keyword protocol_type: Defines the TLS extension protocol that is used for secure delivery. + Required. Known values are: "ServerNameIndication" and "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". + :keyword minimum_tls_version: TLS protocol version that will be used for Https. Known values + are: "None", "TLS10", and "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. + :keyword certificate_source_parameters: Defines the certificate source parameters using user's + keyvault certificate for enabling SSL. Required. :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 + super().__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 -class ValidateCustomDomainInput(msrest.serialization.Model): +class ValidateCustomDomainInput(_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. - :ivar host_name: Required. The host name of the custom domain. Must be a domain name. + :ivar host_name: The host name of the custom domain. Must be a domain name. Required. :vartype host_name: str """ _validation = { - 'host_name': {'required': True}, + "host_name": {"required": True}, } _attribute_map = { - 'host_name': {'key': 'hostName', 'type': 'str'}, + "host_name": {"key": "hostName", "type": "str"}, } - def __init__( - self, - *, - host_name: str, - **kwargs - ): + def __init__(self, *, host_name: str, **kwargs): """ - :keyword host_name: Required. The host name of the custom domain. Must be a domain name. + :keyword host_name: The host name of the custom domain. Must be a domain name. Required. :paramtype host_name: str """ - super(ValidateCustomDomainInput, self).__init__(**kwargs) + super().__init__(**kwargs) self.host_name = host_name -class ValidateCustomDomainOutput(msrest.serialization.Model): +class ValidateCustomDomainOutput(_serialization.Model): """Output of custom domain validation. Variables are only populated by the server, and will be ignored when sending a request. @@ -12872,61 +12605,52 @@ class ValidateCustomDomainOutput(msrest.serialization.Model): """ _validation = { - 'custom_domain_validated': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.custom_domain_validated = None self.reason = None self.message = None -class ValidateProbeInput(msrest.serialization.Model): +class ValidateProbeInput(_serialization.Model): """Input of the validate probe API. All required parameters must be populated in order to send to Azure. - :ivar probe_url: Required. The probe URL to validate. + :ivar probe_url: The probe URL to validate. Required. :vartype probe_url: str """ _validation = { - 'probe_url': {'required': True}, + "probe_url": {"required": True}, } _attribute_map = { - 'probe_url': {'key': 'probeURL', 'type': 'str'}, + "probe_url": {"key": "probeURL", "type": "str"}, } - def __init__( - self, - *, - probe_url: str, - **kwargs - ): + def __init__(self, *, probe_url: str, **kwargs): """ - :keyword probe_url: Required. The probe URL to validate. + :keyword probe_url: The probe URL to validate. Required. :paramtype probe_url: str """ - super(ValidateProbeInput, self).__init__(**kwargs) + super().__init__(**kwargs) self.probe_url = probe_url -class ValidateProbeOutput(msrest.serialization.Model): +class ValidateProbeOutput(_serialization.Model): """Output of the validate probe API. Variables are only populated by the server, and will be ignored when sending a request. @@ -12940,116 +12664,110 @@ class ValidateProbeOutput(msrest.serialization.Model): """ _validation = { - 'is_valid': {'readonly': True}, - 'error_code': {'readonly': True}, - 'message': {'readonly': True}, + "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'}, + "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) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.is_valid = None self.error_code = None self.message = None -class ValidateSecretInput(msrest.serialization.Model): +class ValidateSecretInput(_serialization.Model): """Input of the secret to be validated. All required parameters must be populated in order to send to Azure. - :ivar secret_type: Required. The secret type. Possible values include: "UrlSigningKey", - "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :ivar secret_type: The secret type. Required. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "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 + :ivar secret_source: 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}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + Required. :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_type': {'required': True}, - 'secret_source': {'required': True}, + "secret_type": {"required": True}, + "secret_source": {"required": True}, } _attribute_map = { - 'secret_type': {'key': 'secretType', 'type': 'str'}, - 'secret_source': {'key': 'secretSource', 'type': 'ResourceReference'}, - 'secret_version': {'key': 'secretVersion', 'type': 'str'}, + "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, "_models.SecretType"], + secret_source: "_models.ResourceReference", secret_version: Optional[str] = None, **kwargs ): """ - :keyword secret_type: Required. The secret type. Possible values include: "UrlSigningKey", - "CustomerCertificate", "ManagedCertificate", "AzureFirstPartyManagedCertificate". + :keyword secret_type: The secret type. Required. Known values are: "UrlSigningKey", + "CustomerCertificate", "ManagedCertificate", and "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 + :keyword secret_source: 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}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + Required. :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) + super().__init__(**kwargs) self.secret_type = secret_type self.secret_source = secret_source self.secret_version = secret_version -class ValidateSecretOutput(msrest.serialization.Model): +class ValidateSecretOutput(_serialization.Model): """Output of the validated secret. - :ivar status: The validation status. Possible values include: "Valid", "Invalid", - "AccessDenied", "CertificateExpired". + :ivar status: The validation status. Known values are: "Valid", "Invalid", "AccessDenied", and + "CertificateExpired". :vartype status: str or ~azure.mgmt.cdn.models.Status :ivar message: Detailed error message. :vartype message: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "message": {"key": "message", "type": "str"}, } def __init__( - self, - *, - status: Optional[Union[str, "Status"]] = None, - message: Optional[str] = None, - **kwargs + self, *, status: Optional[Union[str, "_models.Status"]] = None, message: Optional[str] = None, **kwargs ): """ - :keyword status: The validation status. Possible values include: "Valid", "Invalid", - "AccessDenied", "CertificateExpired". + :keyword status: The validation status. Known values are: "Valid", "Invalid", "AccessDenied", + and "CertificateExpired". :paramtype status: str or ~azure.mgmt.cdn.models.Status :keyword message: Detailed error message. :paramtype message: str """ - super(ValidateSecretOutput, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.message = message -class ValidationToken(msrest.serialization.Model): +class ValidationToken(_serialization.Model): """The validation token. Variables are only populated by the server, and will be ignored when sending a request. @@ -13059,41 +12777,37 @@ class ValidationToken(msrest.serialization.Model): """ _validation = { - 'token': {'readonly': True}, + "token": {"readonly": True}, } _attribute_map = { - 'token': {'key': 'token', 'type': 'str'}, + "token": {"key": "token", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ValidationToken, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.token = None -class WafMetricsResponse(msrest.serialization.Model): +class WafMetricsResponse(_serialization.Model): """Waf Metrics Response. :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". + :ivar granularity: Known values are: "PT5M", "PT1H", and "P1D". :vartype granularity: str or ~azure.mgmt.cdn.models.WafMetricsResponseGranularity :ivar series: :vartype 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]'}, + "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__( @@ -13101,8 +12815,8 @@ def __init__( *, date_time_begin: Optional[datetime.datetime] = None, date_time_end: Optional[datetime.datetime] = None, - granularity: Optional[Union[str, "WafMetricsResponseGranularity"]] = None, - series: Optional[List["WafMetricsResponseSeriesItem"]] = None, + granularity: Optional[Union[str, "_models.WafMetricsResponseGranularity"]] = None, + series: Optional[List["_models.WafMetricsResponseSeriesItem"]] = None, **kwargs ): """ @@ -13110,26 +12824,25 @@ def __init__( :paramtype date_time_begin: ~datetime.datetime :keyword date_time_end: :paramtype date_time_end: ~datetime.datetime - :keyword granularity: Possible values include: "PT5M", "PT1H", "P1D". + :keyword granularity: Known values are: "PT5M", "PT1H", and "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) + super().__init__(**kwargs) self.date_time_begin = date_time_begin self.date_time_end = date_time_end self.granularity = granularity self.series = series -class WafMetricsResponseSeriesItem(msrest.serialization.Model): +class WafMetricsResponseSeriesItem(_serialization.Model): """WafMetricsResponseSeriesItem. :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 + :ivar unit: "count" + :vartype unit: str or ~azure.mgmt.cdn.models.WafMetricsResponseSeriesItemUnit :ivar groups: :vartype groups: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesPropertiesItemsItem] :ivar data: @@ -13138,41 +12851,45 @@ class WafMetricsResponseSeriesItem(msrest.serialization.Model): """ _attribute_map = { - 'metric': {'key': 'metric', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[WafMetricsResponseSeriesPropertiesItemsItem]'}, - 'data': {'key': 'data', 'type': '[Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems]'}, + "metric": {"key": "metric", "type": "str"}, + "unit": {"key": "unit", "type": "str"}, + "groups": {"key": "groups", "type": "[WafMetricsResponseSeriesPropertiesItemsItem]"}, + "data": { + "key": "data", + "type": "[Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems]", + }, } def __init__( self, *, metric: Optional[str] = None, - unit: Optional[str] = None, - groups: Optional[List["WafMetricsResponseSeriesPropertiesItemsItem"]] = None, - data: Optional[List["Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems"]] = None, + unit: Optional[Union[str, "_models.WafMetricsResponseSeriesItemUnit"]] = None, + groups: Optional[List["_models.WafMetricsResponseSeriesPropertiesItemsItem"]] = None, + data: Optional[ + List["_models.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 unit: "count" + :paramtype unit: str or ~azure.mgmt.cdn.models.WafMetricsResponseSeriesItemUnit :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) + super().__init__(**kwargs) self.metric = metric self.unit = unit self.groups = groups self.data = data -class WafMetricsResponseSeriesPropertiesItemsItem(msrest.serialization.Model): +class WafMetricsResponseSeriesPropertiesItemsItem(_serialization.Model): """WafMetricsResponseSeriesPropertiesItemsItem. :ivar name: @@ -13182,29 +12899,23 @@ class WafMetricsResponseSeriesPropertiesItemsItem(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): """ :keyword name: :paramtype name: str :keyword value: :paramtype value: str """ - super(WafMetricsResponseSeriesPropertiesItemsItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.value = value -class WafRankingsResponse(msrest.serialization.Model): +class WafRankingsResponse(_serialization.Model): """Waf Rankings Response. :ivar date_time_begin: @@ -13218,10 +12929,10 @@ class WafRankingsResponse(msrest.serialization.Model): """ _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]'}, + "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__( @@ -13230,7 +12941,7 @@ def __init__( date_time_begin: Optional[datetime.datetime] = None, date_time_end: Optional[datetime.datetime] = None, groups: Optional[List[str]] = None, - data: Optional[List["WafRankingsResponseDataItem"]] = None, + data: Optional[List["_models.WafRankingsResponseDataItem"]] = None, **kwargs ): """ @@ -13243,14 +12954,14 @@ def __init__( :keyword data: :paramtype data: list[~azure.mgmt.cdn.models.WafRankingsResponseDataItem] """ - super(WafRankingsResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.date_time_begin = date_time_begin self.date_time_end = date_time_end self.groups = groups self.data = data -class WafRankingsResponseDataItem(msrest.serialization.Model): +class WafRankingsResponseDataItem(_serialization.Model): """WafRankingsResponseDataItem. :ivar group_values: @@ -13261,15 +12972,20 @@ class WafRankingsResponseDataItem(msrest.serialization.Model): """ _attribute_map = { - 'group_values': {'key': 'groupValues', 'type': '[str]'}, - 'metrics': {'key': 'metrics', 'type': '[ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems]'}, + "group_values": {"key": "groupValues", "type": "[str]"}, + "metrics": { + "key": "metrics", + "type": "[ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems]", + }, } def __init__( self, *, group_values: Optional[List[str]] = None, - metrics: Optional[List["ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems"]] = None, + metrics: Optional[ + List["_models.ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems"] + ] = None, **kwargs ): """ @@ -13279,6 +12995,6 @@ def __init__( :paramtype metrics: list[~azure.mgmt.cdn.models.ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems] """ - super(WafRankingsResponseDataItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.group_values = group_values self.metrics = metrics diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_patch.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 02659c9dab5c..558a501919e2 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 @@ -30,28 +30,34 @@ from ._policies_operations import PoliciesOperations from ._managed_rule_sets_operations import ManagedRuleSetsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'CdnManagementClientOperationsMixin', - 'AFDProfilesOperations', - 'AFDCustomDomainsOperations', - 'AFDEndpointsOperations', - 'AFDOriginGroupsOperations', - 'AFDOriginsOperations', - 'RoutesOperations', - 'RuleSetsOperations', - 'RulesOperations', - 'SecurityPoliciesOperations', - 'SecretsOperations', - 'ValidateOperations', - 'LogAnalyticsOperations', - 'ProfilesOperations', - 'EndpointsOperations', - 'OriginsOperations', - 'OriginGroupsOperations', - 'CustomDomainsOperations', - 'ResourceUsageOperations', - 'Operations', - 'EdgeNodesOperations', - 'PoliciesOperations', - 'ManagedRuleSetsOperations', + "CdnManagementClientOperationsMixin", + "AFDProfilesOperations", + "AFDCustomDomainsOperations", + "AFDEndpointsOperations", + "AFDOriginGroupsOperations", + "AFDOriginsOperations", + "RoutesOperations", + "RuleSetsOperations", + "RulesOperations", + "SecurityPoliciesOperations", + "SecretsOperations", + "ValidateOperations", + "LogAnalyticsOperations", + "ProfilesOperations", + "EndpointsOperations", + "OriginsOperations", + "OriginGroupsOperations", + "CustomDomainsOperations", + "ResourceUsageOperations", + "Operations", + "EdgeNodesOperations", + "PoliciesOperations", + "ManagedRuleSetsOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() 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 1c964bc0e7ec..4cdd06ee80f9 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,335 +6,326 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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 + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - profile_name: str, - custom_domain_name: str, - subscription_id: str, - **kwargs: Any + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, profile_name: str, custom_domain_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, profile_name: str, custom_domain_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_refresh_validation_token_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AFDCustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`afd_custom_domains` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> Iterable["_models.AFDDomainListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> Iterable["_models.AFDDomain"]: """Lists existing AzureFrontDoor domains. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + or CDN profile which is unique within the resource group. Required. :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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.AFDDomainListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AFDDomain or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.AFDDomain] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomainListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomainListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -347,7 +339,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -357,53 +351,61 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains'} # type: ignore + 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: str, - profile_name: str, - custom_domain_name: str, - **kwargs: Any - ) -> "_models.AFDDomain": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. :type custom_domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AFDDomain, or the result of cls(response) + :return: AFDDomain or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.AFDDomain - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomain"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomain] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -411,69 +413,166 @@ def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"} # type: ignore def _create_initial( self, resource_group_name: str, profile_name: str, custom_domain_name: str, - custom_domain: "_models.AFDDomain", + custom_domain: Union[_models.AFDDomain, IO], **kwargs: Any - ) -> "_models.AFDDomain": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomain"] + ) -> _models.AFDDomain: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomain] - _json = self._serialize.body(custom_domain, 'AFDDomain') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain, (IO, bytes)): + _content = custom_domain + else: + _json = self._serialize.body(custom_domain, "AFDDomain") - request = build_create_request_initial( + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"} # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain: _models.AFDDomain, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. + :type custom_domain_name: str + :param custom_domain: Domain properties. Required. + :type custom_domain: ~azure.mgmt.cdn.models.AFDDomain + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 AFDDomain or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. + :type custom_domain_name: str + :param custom_domain: Domain properties. Required. + :type custom_domain: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 AFDDomain or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -481,20 +580,24 @@ def begin_create( resource_group_name: str, profile_name: str, custom_domain_name: str, - custom_domain: "_models.AFDDomain", + custom_domain: Union[_models.AFDDomain, IO], **kwargs: Any - ) -> LROPoller["_models.AFDDomain"]: + ) -> LROPoller[_models.AFDDomain]: """Creates a new domain within the specified profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. :type custom_domain_name: str - :param custom_domain: Domain properties. - :type custom_domain: ~azure.mgmt.cdn.models.AFDDomain + :param custom_domain: Domain properties. Is either a model type or a IO type. Required. + :type custom_domain: ~azure.mgmt.cdn.models.AFDDomain or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -505,101 +608,205 @@ def begin_create( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomain] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, custom_domain=custom_domain, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"} # type: ignore def _update_initial( self, resource_group_name: str, profile_name: str, custom_domain_name: str, - custom_domain_update_properties: "_models.AFDDomainUpdateParameters", + custom_domain_update_properties: Union[_models.AFDDomainUpdateParameters, IO], **kwargs: Any - ) -> "_models.AFDDomain": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDDomain"] + ) -> _models.AFDDomain: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomain] - _json = self._serialize.body(custom_domain_update_properties, 'AFDDomainUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain_update_properties, (IO, bytes)): + _content = custom_domain_update_properties + else: + _json = self._serialize.body(custom_domain_update_properties, "AFDDomainUpdateParameters") - request = build_update_request_initial( + request = build_update_request( resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"} # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain_update_properties: _models.AFDDomainUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. + :type custom_domain_name: str + :param custom_domain_update_properties: Domain properties. Required. + :type custom_domain_update_properties: ~azure.mgmt.cdn.models.AFDDomainUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 AFDDomain or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + custom_domain_name: str, + custom_domain_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. + :type custom_domain_name: str + :param custom_domain_update_properties: Domain properties. Required. + :type custom_domain_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 AFDDomain or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_update( @@ -607,20 +814,25 @@ def begin_update( resource_group_name: str, profile_name: str, custom_domain_name: str, - custom_domain_update_properties: "_models.AFDDomainUpdateParameters", + custom_domain_update_properties: Union[_models.AFDDomainUpdateParameters, IO], **kwargs: Any - ) -> LROPoller["_models.AFDDomain"]: + ) -> LROPoller[_models.AFDDomain]: """Updates an existing domain within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. :type custom_domain_name: str - :param custom_domain_update_properties: Domain properties. - :type custom_domain_update_properties: ~azure.mgmt.cdn.models.AFDDomainUpdateParameters + :param custom_domain_update_properties: Domain properties. Is either a model type or a IO type. + Required. + :type custom_domain_update_properties: ~azure.mgmt.cdn.models.AFDDomainUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -631,105 +843,117 @@ def begin_update( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDDomain] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, custom_domain_update_properties=custom_domain_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDDomain', pipeline_response) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"} # type: ignore - def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - custom_domain_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: str, - profile_name: str, - custom_domain_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. :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. @@ -741,98 +965,111 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: str, - profile_name: str, - custom_domain_name: str, - **kwargs: Any + def _refresh_validation_token_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_refresh_validation_token_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_refresh_validation_token_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._refresh_validation_token_initial.metadata['url'], + api_version=api_version, + template_url=self._refresh_validation_token_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _refresh_validation_token_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}/refreshValidationToken'} # type: ignore - + _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: str, - profile_name: str, - custom_domain_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param custom_domain_name: Name of the domain under the profile which is unique globally. + Required. :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. @@ -844,41 +1081,48 @@ def begin_refresh_validation_token( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._refresh_validation_token_initial( + raw_result = self._refresh_validation_token_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 ff7325bb3711..69fae98d7abd 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,428 +6,400 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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 + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - profile_name: str, - endpoint_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_content_request( + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_resource_usage_request( - resource_group_name: str, - profile_name: str, - endpoint_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/usages') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/usages", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **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 + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/validateCustomDomain", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AFDEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`afd_endpoints` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> Iterable["_models.AFDEndpointListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> Iterable["_models.AFDEndpoint"]: """Lists existing AzureFrontDoor endpoints. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.AFDEndpointListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AFDEndpoint or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.AFDEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpointListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpointListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -440,7 +413,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -450,53 +425,61 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints'} # type: ignore + 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: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> "_models.AFDEndpoint": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AFDEndpoint, or the result of cls(response) + :return: AFDEndpoint or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.AFDEndpoint - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpoint"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpoint] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -504,69 +487,170 @@ def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore def _create_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint: "_models.AFDEndpoint", + endpoint: Union[_models.AFDEndpoint, IO], **kwargs: Any - ) -> "_models.AFDEndpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpoint"] + ) -> _models.AFDEndpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpoint] - _json = self._serialize.body(endpoint, 'AFDEndpoint') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(endpoint, (IO, bytes)): + _content = endpoint + else: + _json = self._serialize.body(endpoint, "AFDEndpoint") - request = build_create_request_initial( + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: _models.AFDEndpoint, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint: Endpoint properties. Required. + :type endpoint: ~azure.mgmt.cdn.models.AFDEndpoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint: Endpoint properties. Required. + :type endpoint: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -574,21 +658,25 @@ def begin_create( resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint: "_models.AFDEndpoint", + endpoint: Union[_models.AFDEndpoint, IO], **kwargs: Any - ) -> LROPoller["_models.AFDEndpoint"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param endpoint: Endpoint properties. - :type endpoint: ~azure.mgmt.cdn.models.AFDEndpoint + :param endpoint: Endpoint properties. Is either a model type or a IO type. Required. + :type endpoint: ~azure.mgmt.cdn.models.AFDEndpoint or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -600,101 +688,213 @@ def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, endpoint=endpoint, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore def _update_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint_update_properties: "_models.AFDEndpointUpdateParameters", + endpoint_update_properties: Union[_models.AFDEndpointUpdateParameters, IO], **kwargs: Any - ) -> "_models.AFDEndpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDEndpoint"] + ) -> _models.AFDEndpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(endpoint_update_properties, 'AFDEndpointUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpoint] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(endpoint_update_properties, (IO, bytes)): + _content = endpoint_update_properties + else: + _json = self._serialize.body(endpoint_update_properties, "AFDEndpointUpdateParameters") + + request = build_update_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: _models.AFDEndpointUpdateParameters, + *, + content_type: str = "application/json", + **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 + Update Origin group operation. To update domains, use the Update Custom Domain operation. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint_update_properties: Endpoint update properties. Required. + :type endpoint_update_properties: ~azure.mgmt.cdn.models.AFDEndpointUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: IO, + *, + content_type: str = "application/json", + **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 + Update Origin group operation. To update domains, use the Update Custom Domain operation. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint_update_properties: Endpoint update properties. Required. + :type endpoint_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_update( @@ -702,23 +902,28 @@ def begin_update( resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint_update_properties: "_models.AFDEndpointUpdateParameters", + endpoint_update_properties: Union[_models.AFDEndpointUpdateParameters, IO], **kwargs: Any - ) -> LROPoller["_models.AFDEndpoint"]: + ) -> 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 Update Origin group operation. To update domains, use the Update Custom Domain operation. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param endpoint_update_properties: Endpoint update properties. - :type endpoint_update_properties: ~azure.mgmt.cdn.models.AFDEndpointUpdateParameters + :param endpoint_update_properties: Endpoint update properties. Is either a model type or a IO + type. Required. + :type endpoint_update_properties: ~azure.mgmt.cdn.models.AFDEndpointUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -730,105 +935,117 @@ def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDEndpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, endpoint_update_properties=endpoint_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDEndpoint', pipeline_response) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore - def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( 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'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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. @@ -840,110 +1057,144 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"} # type: ignore - def _purge_content_initial( + def _purge_content_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, - contents: "_models.AfdPurgeParameters", + contents: Union[_models.AfdPurgeParameters, IO], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(contents, 'AfdPurgeParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(contents, (IO, bytes)): + _content = contents + else: + _json = self._serialize.body(contents, "AfdPurgeParameters") - request = build_purge_content_request_initial( + request = build_purge_content_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._purge_content_initial.metadata['url'], + content=_content, + template_url=self._purge_content_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _purge_content_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/purge"} # type: ignore - @distributed_trace + @overload def begin_purge_content( self, resource_group_name: str, profile_name: str, endpoint_name: str, - contents: "_models.AfdPurgeParameters", + contents: _models.AfdPurgeParameters, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Removes a content from AzureFrontDoor. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param contents: The list of paths to the content and the list of linked domains to be purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. '/pictures/*' which removes all folders and files in the directory. + Required. :type contents: ~azure.mgmt.cdn.models.AfdPurgeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -954,99 +1205,202 @@ def begin_purge_content( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_purge_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + contents: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Removes a content from AzureFrontDoor. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param contents: The list of paths to the content and the list of linked domains to be purged. + Path can be a full URL, e.g. '/pictures/city.png' which removes a single file, or a directory + with a wildcard, e.g. '/pictures/*' which removes all folders and files in the directory. + Required. + :type contents: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ + + @distributed_trace + def begin_purge_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + contents: Union[_models.AfdPurgeParameters, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Removes a content from AzureFrontDoor. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param contents: The list of paths to the content and the list of linked domains to be purged. + Path can be a full URL, e.g. '/pictures/city.png' which removes a single file, or a directory + with a wildcard, e.g. '/pictures/*' which removes all folders and files in the directory. Is + either a model type or a IO type. Required. + :type contents: ~azure.mgmt.cdn.models.AfdPurgeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: 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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._purge_content_initial( + raw_result = self._purge_content_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, contents=contents, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: Any - ) -> Iterable["_models.UsagesListResult"]: - """Checks the quota and actual usage of endpoints under the given CDN profile. + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> Iterable["_models.Usage"]: + """Checks the quota and actual usage of the given AzureFrontDoor endpoint under the given CDN + profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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 UsagesListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.UsagesListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1060,7 +1414,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1070,60 +1426,150 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - 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 + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/usages"} # type: ignore - @distributed_trace + @overload def validate_custom_domain( self, resource_group_name: str, profile_name: str, endpoint_name: str, - custom_domain_properties: "_models.ValidateCustomDomainInput", + custom_domain_properties: _models.ValidateCustomDomainInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.ValidateCustomDomainOutput": - """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. + ) -> _models.ValidateCustomDomainOutput: + """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.This + api isn't work for apex domain. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_properties: Custom domain to be validated. + :param custom_domain_properties: Custom domain to be validated. Required. :type custom_domain_properties: ~azure.mgmt.cdn.models.ValidateCustomDomainInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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 + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_custom_domain( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_properties: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidateCustomDomainOutput: + """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.This + api isn't work for apex domain. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_properties: Custom domain to be validated. Required. + :type custom_domain_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_custom_domain( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_properties: Union[_models.ValidateCustomDomainInput, IO], + **kwargs: Any + ) -> _models.ValidateCustomDomainOutput: + """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.This + api isn't work for apex domain. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_properties: Custom domain to be validated. Is either a model type or a IO + type. Required. + :type custom_domain_properties: ~azure.mgmt.cdn.models.ValidateCustomDomainInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateCustomDomainOutput, or the result of cls(response) + :return: ValidateCustomDomainOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ValidateCustomDomainOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateCustomDomainOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateCustomDomainOutput] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain_properties, (IO, bytes)): + _content = custom_domain_properties + else: + _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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate_custom_domain.metadata['url'], + content=_content, + template_url=self.validate_custom_domain.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1131,12 +1577,11 @@ def validate_custom_domain( 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("ValidateCustomDomainOutput", pipeline_response) if cls: 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 - + 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 2858d62d4ed3..3e48ba219706 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,336 +6,326 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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 + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - profile_name: str, - origin_group_name: str, - subscription_id: str, - **kwargs: Any + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, profile_name: str, origin_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, profile_name: str, origin_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_list_resource_usage_request( - resource_group_name: str, - profile_name: str, - origin_group_name: str, - subscription_id: str, - **kwargs: Any + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/usages') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/usages", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AFDOriginGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`afd_origin_groups` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> Iterable["_models.AFDOriginGroupListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> Iterable["_models.AFDOriginGroup"]: """Lists all of the existing origin groups within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :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.paging.ItemPaged[~azure.mgmt.cdn.models.AFDOriginGroupListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AFDOriginGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.AFDOriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroupListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroupListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -348,7 +339,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -358,52 +351,60 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups'} # type: ignore + 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: str, - profile_name: str, - origin_group_name: str, - **kwargs: Any - ) -> "_models.AFDOriginGroup": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AFDOriginGroup, or the result of cls(response) + :return: AFDOriginGroup or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.AFDOriginGroup - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroup"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroup] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -411,69 +412,168 @@ def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}"} # type: ignore def _create_initial( self, resource_group_name: str, profile_name: str, origin_group_name: str, - origin_group: "_models.AFDOriginGroup", + origin_group: Union[_models.AFDOriginGroup, IO], **kwargs: Any - ) -> "_models.AFDOriginGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroup"] + ) -> _models.AFDOriginGroup: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroup] - _json = self._serialize.body(origin_group, 'AFDOriginGroup') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_group, (IO, bytes)): + _content = origin_group + else: + _json = self._serialize.body(origin_group, "AFDOriginGroup") - request = build_create_request_initial( + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}"} # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group: _models.AFDOriginGroup, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group: Origin group properties. Required. + :type origin_group: ~azure.mgmt.cdn.models.AFDOriginGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group: Origin group properties. Required. + :type origin_group: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -481,20 +581,24 @@ def begin_create( resource_group_name: str, profile_name: str, origin_group_name: str, - origin_group: "_models.AFDOriginGroup", + origin_group: Union[_models.AFDOriginGroup, IO], **kwargs: Any - ) -> LROPoller["_models.AFDOriginGroup"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_group_name: str - :param origin_group: Origin group properties. - :type origin_group: ~azure.mgmt.cdn.models.AFDOriginGroup + :param origin_group: Origin group properties. Is either a model type or a IO type. Required. + :type origin_group: ~azure.mgmt.cdn.models.AFDOriginGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -506,101 +610,207 @@ def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroup] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, origin_group=origin_group, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}"} # type: ignore def _update_initial( self, resource_group_name: str, profile_name: str, origin_group_name: str, - origin_group_update_properties: "_models.AFDOriginGroupUpdateParameters", + origin_group_update_properties: Union[_models.AFDOriginGroupUpdateParameters, IO], **kwargs: Any - ) -> "_models.AFDOriginGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginGroup"] + ) -> _models.AFDOriginGroup: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(origin_group_update_properties, 'AFDOriginGroupUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroup] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_group_update_properties, (IO, bytes)): + _content = origin_group_update_properties + else: + _json = self._serialize.body(origin_group_update_properties, "AFDOriginGroupUpdateParameters") + + request = build_update_request( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}"} # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group_update_properties: _models.AFDOriginGroupUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_group_update_properties: Origin group properties. Required. + :type origin_group_update_properties: ~azure.mgmt.cdn.models.AFDOriginGroupUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_group_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_group_update_properties: Origin group properties. Required. + :type origin_group_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_update( @@ -608,20 +818,26 @@ def begin_update( resource_group_name: str, profile_name: str, origin_group_name: str, - origin_group_update_properties: "_models.AFDOriginGroupUpdateParameters", + origin_group_update_properties: Union[_models.AFDOriginGroupUpdateParameters, IO], **kwargs: Any - ) -> LROPoller["_models.AFDOriginGroup"]: + ) -> LROPoller[_models.AFDOriginGroup]: """Updates an existing origin group within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_group_name: str - :param origin_group_update_properties: Origin group properties. - :type origin_group_update_properties: ~azure.mgmt.cdn.models.AFDOriginGroupUpdateParameters + :param origin_group_update_properties: Origin group properties. Is either a model type or a IO + type. Required. + :type origin_group_update_properties: ~azure.mgmt.cdn.models.AFDOriginGroupUpdateParameters or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -633,104 +849,116 @@ def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginGroup] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, origin_group_update_properties=origin_group_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDOriginGroup', pipeline_response) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}"} # type: ignore - def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - origin_group_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - - request = build_delete_request_initial( + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: str, - profile_name: str, - origin_group_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :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. @@ -742,96 +970,117 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: Any - ) -> Iterable["_models.UsagesListResult"]: - """Checks the quota and actual usage of endpoints under the given CDN profile. + self, resource_group_name: str, profile_name: str, origin_group_name: str, **kwargs: Any + ) -> Iterable["_models.Usage"]: + """Checks the quota and actual usage of the given AzureFrontDoor origin group under the given CDN + profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_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 UsagesListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.UsagesListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -845,7 +1094,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -855,8 +1106,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/usages'} # type: ignore + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/usages"} # type: ignore 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 d3c579d3fccf..6e8b75d6a6e5 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,65 +6,70 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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_origin_group_request( - resource_group_name: str, - profile_name: str, - origin_group_name: str, - subscription_id: str, - **kwargs: Any + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -74,134 +80,125 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request_initial( +def build_create_request( 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] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request_initial( +def build_update_request( 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] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( resource_group_name: str, profile_name: str, origin_group_name: str, @@ -209,109 +206,121 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class AFDOriginsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`afd_origins` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_origin_group( - self, - resource_group_name: str, - profile_name: str, - origin_group_name: str, - **kwargs: Any - ) -> Iterable["_models.AFDOriginListResult"]: + self, resource_group_name: str, profile_name: str, origin_group_name: str, **kwargs: Any + ) -> Iterable["_models.AFDOrigin"]: """Lists all of the existing origins within an origin group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_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 AFDOriginListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.AFDOriginListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either AFDOrigin or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.AFDOrigin] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOriginListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOriginListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_origin_group.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -325,7 +334,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -335,56 +346,63 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - 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 + 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: str, - profile_name: str, - origin_group_name: str, - origin_name: str, - **kwargs: Any - ) -> "_models.AFDOrigin": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_group_name: str - :param origin_name: Name of the origin which is unique within the profile. + :param origin_name: Name of the origin which is unique within the profile. Required. :type origin_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AFDOrigin, or the result of cls(response) + :return: AFDOrigin or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.AFDOrigin - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOrigin"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOrigin] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -392,15 +410,14 @@ def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}"} # type: ignore def _create_initial( self, @@ -408,55 +425,159 @@ def _create_initial( profile_name: str, origin_group_name: str, origin_name: str, - origin: "_models.AFDOrigin", + origin: Union[_models.AFDOrigin, IO], **kwargs: Any - ) -> "_models.AFDOrigin": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOrigin"] + ) -> _models.AFDOrigin: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(origin, 'AFDOrigin') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOrigin] - request = build_create_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin, (IO, bytes)): + _content = origin + else: + _json = self._serialize.body(origin, "AFDOrigin") + + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: 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 + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}"} # type: ignore + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin: _models.AFDOrigin, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_name: Name of the origin that is unique within the profile. Required. + :type origin_name: str + :param origin: Origin properties. Required. + :type origin: ~azure.mgmt.cdn.models.AFDOrigin + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 AFDOrigin or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOrigin] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_name: Name of the origin that is unique within the profile. Required. + :type origin_name: str + :param origin: Origin properties. Required. + :type origin: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 AFDOrigin or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOrigin] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -465,22 +586,26 @@ def begin_create( profile_name: str, origin_group_name: str, origin_name: str, - origin: "_models.AFDOrigin", + origin: Union[_models.AFDOrigin, IO], **kwargs: Any - ) -> LROPoller["_models.AFDOrigin"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_group_name: str - :param origin_name: Name of the origin that is unique within the profile. + :param origin_name: Name of the origin that is unique within the profile. Required. :type origin_name: str - :param origin: Origin properties. - :type origin: ~azure.mgmt.cdn.models.AFDOrigin + :param origin: Origin properties. Is either a model type or a IO type. Required. + :type origin: ~azure.mgmt.cdn.models.AFDOrigin or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -491,51 +616,57 @@ def begin_create( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOrigin] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, origin_name=origin_name, origin=origin, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}"} # type: ignore def _update_initial( self, @@ -543,52 +674,156 @@ def _update_initial( profile_name: str, origin_group_name: str, origin_name: str, - origin_update_properties: "_models.AFDOriginUpdateParameters", + origin_update_properties: Union[_models.AFDOriginUpdateParameters, IO], **kwargs: Any - ) -> "_models.AFDOrigin": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AFDOrigin"] + ) -> _models.AFDOrigin: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOrigin] - _json = self._serialize.body(origin_update_properties, 'AFDOriginUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_update_properties, (IO, bytes)): + _content = origin_update_properties + else: + _json = self._serialize.body(origin_update_properties, "AFDOriginUpdateParameters") - request = build_update_request_initial( + request = build_update_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: 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 + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}"} # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin_update_properties: _models.AFDOriginUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_name: Name of the origin which is unique within the profile. Required. + :type origin_name: str + :param origin_update_properties: Origin properties. Required. + :type origin_update_properties: ~azure.mgmt.cdn.models.AFDOriginUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 AFDOrigin or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOrigin] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + origin_group_name: str, + origin_name: str, + origin_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param origin_group_name: Name of the origin group which is unique within the profile. + Required. + :type origin_group_name: str + :param origin_name: Name of the origin which is unique within the profile. Required. + :type origin_name: str + :param origin_update_properties: Origin properties. Required. + :type origin_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 AFDOrigin or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.AFDOrigin] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_update( @@ -597,22 +832,27 @@ def begin_update( profile_name: str, origin_group_name: str, origin_name: str, - origin_update_properties: "_models.AFDOriginUpdateParameters", + origin_update_properties: Union[_models.AFDOriginUpdateParameters, IO], **kwargs: Any - ) -> LROPoller["_models.AFDOrigin"]: + ) -> LROPoller[_models.AFDOrigin]: """Updates an existing origin within an origin group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_group_name: str - :param origin_name: Name of the origin which is unique within the profile. + :param origin_name: Name of the origin which is unique within the profile. Required. :type origin_name: str - :param origin_update_properties: Origin properties. - :type origin_update_properties: ~azure.mgmt.cdn.models.AFDOriginUpdateParameters + :param origin_update_properties: Origin properties. Is either a model type or a IO type. + Required. + :type origin_update_properties: ~azure.mgmt.cdn.models.AFDOriginUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -623,110 +863,120 @@ def begin_update( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AFDOrigin] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, origin_name=origin_name, origin_update_properties=origin_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AFDOrigin', pipeline_response) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: str, - profile_name: str, - origin_group_name: str, - origin_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - - request = build_delete_request_initial( + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: str, - profile_name: str, - origin_group_name: str, - origin_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param origin_group_name: Name of the origin group which is unique within the profile. + Required. :type origin_group_name: str - :param origin_name: Name of the origin which is unique within the profile. + :param origin_name: Name of the origin which is unique within the profile. Required. :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. @@ -738,42 +988,49 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, origin_name=origin_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 30db4130f59b..c35bd65022b5 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,174 +6,184 @@ # 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, Iterable, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict 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 +from .._serialization import Serializer +from .._vendor import MixinABC, _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_resource_usage_request( - resource_group_name: str, - profile_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **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 + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkHostNameAvailability", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AFDProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`afd_profiles` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_resource_usage( - self, - 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. + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> Iterable["_models.Usage"]: + """Checks the quota and actual usage of AzureFrontDoor endpoints under the given CDN profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.UsagesListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -186,7 +197,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -196,56 +209,135 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages'} # type: ignore + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages"} # type: ignore + + @overload + def check_host_name_availability( + self, + resource_group_name: str, + profile_name: str, + check_host_name_availability_input: _models.CheckHostNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Check the name availability of a host name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param check_host_name_availability_input: Custom domain to be validated. Required. + :type check_host_name_availability_input: ~azure.mgmt.cdn.models.CheckHostNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_host_name_availability( + self, + resource_group_name: str, + profile_name: str, + check_host_name_availability_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Check the name availability of a host name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param check_host_name_availability_input: Custom domain to be validated. Required. + :type check_host_name_availability_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def check_host_name_availability( self, resource_group_name: str, profile_name: str, - check_host_name_availability_input: "_models.CheckHostNameAvailabilityInput", + check_host_name_availability_input: Union[_models.CheckHostNameAvailabilityInput, IO], **kwargs: Any - ) -> "_models.CheckNameAvailabilityOutput": - """Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. + ) -> _models.CheckNameAvailabilityOutput: + """Check the name availability of a host name. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :type profile_name: str - :param check_host_name_availability_input: Custom domain to be validated. + :param check_host_name_availability_input: Custom domain to be validated. Is either a model + type or a IO type. Required. :type check_host_name_availability_input: ~azure.mgmt.cdn.models.CheckHostNameAvailabilityInput + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityOutput, or the result of cls(response) + :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityOutput] - _json = self._serialize.body(check_host_name_availability_input, 'CheckHostNameAvailabilityInput') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_host_name_availability_input, (IO, bytes)): + _content = check_host_name_availability_input + else: + _json = self._serialize.body(check_host_name_availability_input, "CheckHostNameAvailabilityInput") request = build_check_host_name_availability_request( resource_group_name=resource_group_name, profile_name=profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_host_name_availability.metadata['url'], + content=_content, + template_url=self.check_host_name_availability.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -253,12 +345,11 @@ def check_host_name_availability( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityOutput', 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 - + 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 f15357a8c218..3da143430d57 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,225 +6,262 @@ # 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 typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict 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 +from .._serialization import Serializer +from .._vendor import MixinABC, _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_check_endpoint_name_availability_request( - subscription_id: str, - resource_group_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - api_version = "2021-06-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability", + ) # pylint: disable=line-too-long 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\._\(\)]+$'), + "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) + _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') + _params["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] + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_check_name_availability_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - api_version = "2021-06-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Cdn/checkNameAvailability') + _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') + _params["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] + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_check_name_availability_with_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - api_version = "2021-06-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - url = _format_url_section(url, **path_format_arguments) + _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') + _params["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] + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_validate_probe_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - api_version = "2021-06-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - url = _format_url_section(url, **path_format_arguments) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class CdnManagementClientOperationsMixin(object): - @distributed_trace +class CdnManagementClientOperationsMixin(MixinABC): + @overload def check_endpoint_name_availability( self, resource_group_name: str, - check_endpoint_name_availability_input: "_models.CheckEndpointNameAvailabilityInput", + check_endpoint_name_availability_input: _models.CheckEndpointNameAvailabilityInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CheckEndpointNameAvailabilityOutput": + ) -> _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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param check_endpoint_name_availability_input: Input to check. + :param check_endpoint_name_availability_input: Input to check. Required. :type check_endpoint_name_availability_input: ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def check_endpoint_name_availability( + self, + resource_group_name: str, + check_endpoint_name_availability_input: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param check_endpoint_name_availability_input: Input to check. Required. + :type check_endpoint_name_availability_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def check_endpoint_name_availability( + self, + resource_group_name: str, + check_endpoint_name_availability_input: Union[_models.CheckEndpointNameAvailabilityInput, IO], + **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. Required. + :type resource_group_name: str + :param check_endpoint_name_availability_input: Input to check. Is either a model type or a IO + type. Required. + :type check_endpoint_name_availability_input: + ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckEndpointNameAvailabilityOutput, or the result of cls(response) + :return: CheckEndpointNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CheckEndpointNameAvailabilityOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckEndpointNameAvailabilityOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckEndpointNameAvailabilityOutput] - _json = self._serialize.body(check_endpoint_name_availability_input, 'CheckEndpointNameAvailabilityInput') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_endpoint_name_availability_input, (IO, bytes)): + _content = check_endpoint_name_availability_input + else: + _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, + subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_endpoint_name_availability.metadata['url'], + content=_content, + template_url=self.check_endpoint_name_availability.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -231,51 +269,112 @@ def check_endpoint_name_availability( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckEndpointNameAvailabilityOutput', pipeline_response) + 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 + check_endpoint_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability"} # type: ignore - - @distributed_trace + @overload def check_name_availability( self, - check_name_availability_input: "_models.CheckNameAvailabilityInput", + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CheckNameAvailabilityOutput": + ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. - :param check_name_availability_input: Input to check. + :param check_name_availability_input: Input to check. Required. :type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, check_name_availability_input: IO, *, content_type: str = "application/json", **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. + + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityOutput, or the result of cls(response) + :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], **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. + + :param check_name_availability_input: Input to check. Is either a model type or a IO type. + Required. + :type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(check_name_availability_input, 'CheckNameAvailabilityInput') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityOutput] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_input, (IO, bytes)): + _content = check_name_availability_input + else: + _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") request = build_check_name_availability_request( + api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata['url'], + content=_content, + template_url=self.check_name_availability.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -283,52 +382,113 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/providers/Microsoft.Cdn/checkNameAvailability'} # type: ignore - + check_name_availability.metadata = {"url": "/providers/Microsoft.Cdn/checkNameAvailability"} # type: ignore - @distributed_trace + @overload def check_name_availability_with_subscription( self, - check_name_availability_input: "_models.CheckNameAvailabilityInput", + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.CheckNameAvailabilityOutput": + ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. - :param check_name_availability_input: Input to check. + :param check_name_availability_input: Input to check. Required. :type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability_with_subscription( + self, check_name_availability_input: IO, *, content_type: str = "application/json", **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. + + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability_with_subscription( + self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], **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. + + :param check_name_availability_input: Input to check. Is either a model type or a IO type. + Required. + :type check_name_availability_input: ~azure.mgmt.cdn.models.CheckNameAvailabilityInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityOutput, or the result of cls(response) + :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CheckNameAvailabilityOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(check_name_availability_input, 'CheckNameAvailabilityInput') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityOutput] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_name_availability_input, (IO, bytes)): + _content = check_name_availability_input + else: + _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") request = build_check_name_availability_with_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability_with_subscription.metadata['url'], + content=_content, + template_url=self.check_name_availability_with_subscription.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -336,53 +496,111 @@ def check_name_availability_with_subscription( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckNameAvailabilityOutput', pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability_with_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability'} # type: ignore + check_name_availability_with_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability"} # type: ignore + + @overload + def validate_probe( + self, validate_probe_input: _models.ValidateProbeInput, *, content_type: str = "application/json", **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. + + :param validate_probe_input: Input to check. Required. + :type validate_probe_input: ~azure.mgmt.cdn.models.ValidateProbeInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateProbeOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.ValidateProbeOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_probe( + self, validate_probe_input: IO, *, content_type: str = "application/json", **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. + :param validate_probe_input: Input to check. Required. + :type validate_probe_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateProbeOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.ValidateProbeOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def validate_probe( - self, - validate_probe_input: "_models.ValidateProbeInput", - **kwargs: Any - ) -> "_models.ValidateProbeOutput": + self, validate_probe_input: Union[_models.ValidateProbeInput, IO], **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. - :param validate_probe_input: Input to check. - :type validate_probe_input: ~azure.mgmt.cdn.models.ValidateProbeInput + :param validate_probe_input: Input to check. Is either a model type or a IO type. Required. + :type validate_probe_input: ~azure.mgmt.cdn.models.ValidateProbeInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateProbeOutput, or the result of cls(response) + :return: ValidateProbeOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ValidateProbeOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateProbeOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateProbeOutput] - _json = self._serialize.body(validate_probe_input, 'ValidateProbeInput') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_probe_input, (IO, bytes)): + _content = validate_probe_input + else: + _json = self._serialize.body(validate_probe_input, "ValidateProbeInput") request = build_validate_probe_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate_probe.metadata['url'], + content=_content, + template_url=self.validate_probe.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -390,12 +608,11 @@ def validate_probe( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ValidateProbeOutput', pipeline_response) + deserialized = self._deserialize("ValidateProbeOutput", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validate_probe.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe'} # type: ignore - + 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 f64b2588afb5..13d96386c276 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,65 +6,70 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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_endpoint_request( - resource_group_name: str, - profile_name: str, - endpoint_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -74,86 +80,82 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request_initial( +def build_create_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] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( resource_group_name: str, profile_name: str, endpoint_name: str, @@ -161,35 +163,36 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_disable_custom_https_request( @@ -200,35 +203,36 @@ def build_disable_custom_https_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_enable_custom_https_request( @@ -237,120 +241,126 @@ def build_enable_custom_https_request( 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] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class CustomDomainsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`custom_domains` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_endpoint( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> Iterable["_models.CustomDomainListResult"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> Iterable["_models.CustomDomain"]: """Lists all of the existing custom domains within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.CustomDomainListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CustomDomain or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomainListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_endpoint.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -364,7 +374,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -374,55 +386,63 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - 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 + 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: str, - profile_name: str, - endpoint_name: str, - custom_domain_name: str, - **kwargs: Any - ) -> "_models.CustomDomain": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_name: Name of the custom domain within an endpoint. + :param custom_domain_name: Name of the custom domain within an endpoint. Required. :type custom_domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomain, or the result of cls(response) + :return: CustomDomain or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CustomDomain - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomain"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -430,15 +450,14 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}"} # type: ignore def _create_initial( self, @@ -446,55 +465,161 @@ def _create_initial( profile_name: str, endpoint_name: str, custom_domain_name: str, - custom_domain_properties: "_models.CustomDomainParameters", + custom_domain_properties: Union[_models.CustomDomainParameters, IO], **kwargs: Any - ) -> "_models.CustomDomain": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomain"] + ) -> _models.CustomDomain: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(custom_domain_properties, 'CustomDomainParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] - request = build_create_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain_properties, (IO, bytes)): + _content = custom_domain_properties + else: + _json = self._serialize.body(custom_domain_properties, "CustomDomainParameters") + + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: 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 + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}"} # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_properties: _models.CustomDomainParameters, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_name: Name of the custom domain within an endpoint. Required. + :type custom_domain_name: str + :param custom_domain_properties: Properties required to create a new custom domain. Required. + :type custom_domain_properties: ~azure.mgmt.cdn.models.CustomDomainParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_name: Name of the custom domain within an endpoint. Required. + :type custom_domain_name: str + :param custom_domain_properties: Properties required to create a new custom domain. Required. + :type custom_domain_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -503,21 +628,27 @@ def begin_create( profile_name: str, endpoint_name: str, custom_domain_name: str, - custom_domain_properties: "_models.CustomDomainParameters", + custom_domain_properties: Union[_models.CustomDomainParameters, IO], **kwargs: Any - ) -> LROPoller["_models.CustomDomain"]: + ) -> LROPoller[_models.CustomDomain]: """Creates a new custom domain within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_name: Name of the custom domain within an endpoint. + :param custom_domain_name: Name of the custom domain within an endpoint. Required. :type custom_domain_name: str - :param custom_domain_properties: Properties required to create a new custom domain. - :type custom_domain_properties: ~azure.mgmt.cdn.models.CustomDomainParameters + :param custom_domain_properties: Properties required to create a new custom domain. Is either a + model type or a IO type. Required. + :type custom_domain_properties: ~azure.mgmt.cdn.models.CustomDomainParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -529,115 +660,124 @@ def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, custom_domain_name=custom_domain_name, custom_domain_properties=custom_domain_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: 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"]] + self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any + ) -> Optional[_models.CustomDomain]: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - - request = build_delete_request_initial( + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CustomDomain]] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - 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) deserialized = None if response.status_code == 202: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: 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 - + _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: str, - profile_name: str, - endpoint_name: str, - custom_domain_name: str, - **kwargs: Any - ) -> LROPoller["_models.CustomDomain"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any + ) -> LROPoller[None]: """Deletes an existing custom domain within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_name: Name of the custom domain within an endpoint. + :param custom_domain_name: Name of the custom domain within an endpoint. Required. :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. @@ -650,92 +790,88 @@ def begin_delete( :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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomain"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, custom_domain_name=custom_domain_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - 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 + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - @distributed_trace - def disable_custom_https( - self, - 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. + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}"} # 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 endpoint_name: Name of the endpoint under the profile which is unique globally. - :type endpoint_name: str - :param custom_domain_name: Name of the custom domain within an endpoint. - :type custom_domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomain, or the result of cls(response) - :rtype: ~azure.mgmt.cdn.models.CustomDomain or None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CustomDomain"]] + def _disable_custom_https_initial( + self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any + ) -> _models.CustomDomain: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] - 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'], + api_version=api_version, + template_url=self._disable_custom_https_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -743,59 +879,127 @@ def disable_custom_https( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("CustomDomain", pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: 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 - + _disable_custom_https_initial.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: 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. + def begin_disable_custom_https( + self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any + ) -> LROPoller[_models.CustomDomain]: + """Disable https delivery of the custom domain. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_name: Name of the custom domain within an endpoint. + :param custom_domain_name: Name of the custom domain within an endpoint. Required. :type custom_domain_name: str - :param custom_domain_https_parameters: The configuration specifying how to enable HTTPS for the - custom domain - using CDN managed certificate or user's own certificate. If not specified, - enabling ssl uses CDN managed certificate by default. - :type custom_domain_https_parameters: ~azure.mgmt.cdn.models.CustomDomainHttpsParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomain, or the result of cls(response) - :rtype: ~azure.mgmt.cdn.models.CustomDomain or None - :raises: ~azure.core.exceptions.HttpResponseError + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CustomDomain"]] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._disable_custom_https_initial( # type: ignore + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_disable_custom_https.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps"} # type: ignore + + def _enable_custom_https_initial( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_https_parameters: Optional[Union[_models.CustomDomainHttpsParameters, IO]] = None, + **kwargs: Any + ) -> _models.CustomDomain: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] - if custom_domain_https_parameters is not None: - _json = self._serialize.body(custom_domain_https_parameters, 'CustomDomainHttpsParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain_https_parameters, (IO, bytes)): + _content = custom_domain_https_parameters else: - _json = None + if custom_domain_https_parameters is not None: + _json = self._serialize.body(custom_domain_https_parameters, "CustomDomainHttpsParameters") + else: + _json = None request = build_enable_custom_https_request( resource_group_name=resource_group_name, @@ -803,14 +1007,21 @@ def enable_custom_https( endpoint_name=endpoint_name, custom_domain_name=custom_domain_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.enable_custom_https.metadata['url'], + content=_content, + template_url=self._enable_custom_https_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -818,14 +1029,196 @@ def enable_custom_https( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("CustomDomain", pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CustomDomain', pipeline_response) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: 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 + _enable_custom_https_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps"} # type: ignore + + @overload + def begin_enable_custom_https( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_https_parameters: Optional[_models.CustomDomainHttpsParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomDomain]: + """Enable https delivery of the custom domain. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_name: Name of the custom domain within an endpoint. Required. + :type custom_domain_name: str + :param custom_domain_https_parameters: The configuration specifying how to enable HTTPS for the + custom domain - using CDN managed certificate or user's own certificate. If not specified, + enabling ssl uses CDN managed certificate by default. Default value is None. + :type custom_domain_https_parameters: ~azure.mgmt.cdn.models.CustomDomainHttpsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_enable_custom_https( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_https_parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomDomain]: + """Enable https delivery of the custom domain. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_name: Name of the custom domain within an endpoint. Required. + :type custom_domain_name: str + :param custom_domain_https_parameters: The configuration specifying how to enable HTTPS for the + custom domain - using CDN managed certificate or user's own certificate. If not specified, + enabling ssl uses CDN managed certificate by default. Default value is None. + :type custom_domain_https_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_enable_custom_https( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_name: str, + custom_domain_https_parameters: Optional[Union[_models.CustomDomainHttpsParameters, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.CustomDomain]: + """Enable https delivery of the custom domain. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_name: Name of the custom domain within an endpoint. Required. + :type custom_domain_name: str + :param custom_domain_https_parameters: The configuration specifying how to enable HTTPS for the + custom domain - using CDN managed certificate or user's own certificate. If not specified, + enabling ssl uses CDN managed certificate by default. Is either a model type or a IO type. + Default value is None. + :type custom_domain_https_parameters: ~azure.mgmt.cdn.models.CustomDomainHttpsParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CustomDomain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomDomain] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._enable_custom_https_initial( # type: ignore + resource_group_name=resource_group_name, + profile_name=profile_name, + endpoint_name=endpoint_name, + custom_domain_name=custom_domain_name, + custom_domain_https_parameters=custom_domain_https_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomDomain", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 37b8049cba12..d1f9c24f5991 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,107 +6,125 @@ # 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, Iterable, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _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" + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Cdn/edgenodes') + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class EdgeNodesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`edge_nodes` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.EdgenodeResult"]: + def list(self, **kwargs: Any) -> Iterable["_models.EdgeNode"]: """Edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EdgenodeResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.EdgenodeResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either EdgeNode or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.EdgeNode] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgenodeResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.EdgenodeResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -119,7 +138,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -129,8 +150,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.Cdn/edgenodes'} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Cdn/edgenodes"} # type: ignore 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 e79b66eb215a..b933271e1570 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,546 +6,505 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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 + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - profile_name: str, - endpoint_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_start_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_content_request( + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_load_content_request( + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **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 + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_resource_usage_request( - resource_group_name: str, - profile_name: str, - endpoint_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class EndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`endpoints` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> Iterable["_models.EndpointListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> Iterable["_models.Endpoint"]: """Lists existing CDN endpoints. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :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 EndpointListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.EndpointListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Endpoint or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Endpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.EndpointListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -558,7 +518,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -568,52 +530,59 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints'} # type: ignore + 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: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> "_models.Endpoint": + def get(self, 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. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Endpoint, or the result of cls(response) + :return: Endpoint or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Endpoint - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -621,69 +590,168 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore def _create_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint: "_models.Endpoint", + endpoint: Union[_models.Endpoint, IO], **kwargs: Any - ) -> "_models.Endpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + ) -> _models.Endpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] - _json = self._serialize.body(endpoint, 'Endpoint') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(endpoint, (IO, bytes)): + _content = endpoint + else: + _json = self._serialize.body(endpoint, "Endpoint") - request = build_create_request_initial( + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: _models.Endpoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Endpoint]: + """Creates a new CDN 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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint: Endpoint properties. Required. + :type endpoint: ~azure.mgmt.cdn.models.Endpoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Endpoint or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Endpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Endpoint]: + """Creates a new CDN 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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint: Endpoint properties. Required. + :type endpoint: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Endpoint or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Endpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -691,20 +759,25 @@ def begin_create( resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint: "_models.Endpoint", + endpoint: Union[_models.Endpoint, IO], **kwargs: Any - ) -> LROPoller["_models.Endpoint"]: + ) -> LROPoller[_models.Endpoint]: """Creates a new CDN 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param endpoint: Endpoint properties. - :type endpoint: ~azure.mgmt.cdn.models.Endpoint + :param endpoint: Endpoint properties. Is either a model type or a IO type. Required. + :type endpoint: ~azure.mgmt.cdn.models.Endpoint or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -715,101 +788,209 @@ def begin_create( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, endpoint=endpoint, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore def _update_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint_update_properties: "_models.EndpointUpdateParameters", + endpoint_update_properties: Union[_models.EndpointUpdateParameters, IO], **kwargs: Any - ) -> "_models.Endpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + ) -> _models.Endpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(endpoint_update_properties, 'EndpointUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(endpoint_update_properties, (IO, bytes)): + _content = endpoint_update_properties + else: + _json = self._serialize.body(endpoint_update_properties, "EndpointUpdateParameters") + + request = build_update_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: _models.EndpointUpdateParameters, + *, + content_type: str = "application/json", + **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 + Origin group operation. To update custom domains, use the Update Custom Domain operation. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint_update_properties: Endpoint update properties. Required. + :type endpoint_update_properties: ~azure.mgmt.cdn.models.EndpointUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Endpoint or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Endpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + endpoint_update_properties: IO, + *, + content_type: str = "application/json", + **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 + Origin group operation. To update custom domains, use the Update Custom Domain operation. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param endpoint_update_properties: Endpoint update properties. Required. + :type endpoint_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Endpoint or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Endpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_update( @@ -817,22 +998,28 @@ def begin_update( resource_group_name: str, profile_name: str, endpoint_name: str, - endpoint_update_properties: "_models.EndpointUpdateParameters", + endpoint_update_properties: Union[_models.EndpointUpdateParameters, IO], **kwargs: Any - ) -> LROPoller["_models.Endpoint"]: + ) -> 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 Origin group operation. To update custom domains, use the Update Custom Domain operation. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param endpoint_update_properties: Endpoint update properties. - :type endpoint_update_properties: ~azure.mgmt.cdn.models.EndpointUpdateParameters + :param endpoint_update_properties: Endpoint update properties. Is either a model type or a IO + type. Required. + :type endpoint_update_properties: ~azure.mgmt.cdn.models.EndpointUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -843,104 +1030,115 @@ def begin_update( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, endpoint_update_properties=endpoint_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore - def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_request( 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'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'} # type: ignore - + _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: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any + self, 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. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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. @@ -952,105 +1150,117 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"} # type: ignore def _start_initial( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> "_models.Endpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> _models.Endpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_start_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + + request = build_start_request( 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'], + api_version=api_version, + template_url=self._start_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: 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 - + _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: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> LROPoller["_models.Endpoint"]: + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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. @@ -1062,108 +1272,119 @@ def begin_start( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._start_initial( + raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> "_models.Endpoint": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> _models.Endpoint: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_stop_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + + request = build_stop_request( 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'], + api_version=api_version, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: 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 - + _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: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> LROPoller["_models.Endpoint"]: + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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. @@ -1175,90 +1396,196 @@ def begin_stop( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Endpoint"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Endpoint] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._stop_initial( + raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Endpoint', pipeline_response) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop"} # type: ignore - def _purge_content_initial( + def _purge_content_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, - content_file_paths: "_models.PurgeParameters", + content_file_paths: Union[_models.PurgeParameters, IO], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(content_file_paths, 'PurgeParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(content_file_paths, (IO, bytes)): + _content = content_file_paths + else: + _json = self._serialize.body(content_file_paths, "PurgeParameters") - request = build_purge_content_request_initial( + request = build_purge_content_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._purge_content_initial.metadata['url'], + content=_content, + template_url=self._purge_content_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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, {}) - _purge_content_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'} # type: ignore + _purge_content_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge"} # type: ignore + @overload + def begin_purge_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: _models.PurgeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Removes a content from CDN. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param content_file_paths: The path to the content to be purged. Path can be a full URL, e.g. + '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. + '/pictures/*' which removes all folders and files in the directory. Required. + :type content_file_paths: ~azure.mgmt.cdn.models.PurgeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ + + @overload + def begin_purge_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Removes a content from CDN. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param content_file_paths: The path to the content to be purged. Path can be a full URL, e.g. + '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. + '/pictures/*' which removes all folders and files in the directory. Required. + :type content_file_paths: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ @distributed_trace def begin_purge_content( @@ -1266,21 +1593,27 @@ def begin_purge_content( resource_group_name: str, profile_name: str, endpoint_name: str, - content_file_paths: "_models.PurgeParameters", + content_file_paths: Union[_models.PurgeParameters, IO], **kwargs: Any ) -> LROPoller[None]: """Removes a content from CDN. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param content_file_paths: The path to the content to be purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. - '/pictures/*' which removes all folders and files in the directory. - :type content_file_paths: ~azure.mgmt.cdn.models.PurgeParameters + '/pictures/*' which removes all folders and files in the directory. Is either a model type or a + IO type. Required. + :type content_file_paths: ~azure.mgmt.cdn.models.PurgeParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -1291,90 +1624,195 @@ def begin_purge_content( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._purge_content_initial( + raw_result = self._purge_content_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, content_file_paths=content_file_paths, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_purge_content.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge"} # type: ignore - def _load_content_initial( + def _load_content_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, - content_file_paths: "_models.LoadParameters", + content_file_paths: Union[_models.LoadParameters, IO], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(content_file_paths, 'LoadParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(content_file_paths, (IO, bytes)): + _content = content_file_paths + else: + _json = self._serialize.body(content_file_paths, "LoadParameters") - request = build_load_content_request_initial( + request = build_load_content_request( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._load_content_initial.metadata['url'], + content=_content, + template_url=self._load_content_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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, {}) - _load_content_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load'} # type: ignore + _load_content_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load"} # type: ignore + + @overload + def begin_load_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: _models.LoadParameters, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param content_file_paths: The path to the content to be loaded. Path should be a full URL, + e.g. ‘/pictures/city.png' which loads a single file. Required. + :type content_file_paths: ~azure.mgmt.cdn.models.LoadParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ + + @overload + def begin_load_content( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + content_file_paths: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param content_file_paths: The path to the content to be loaded. Path should be a full URL, + e.g. ‘/pictures/city.png' which loads a single file. Required. + :type content_file_paths: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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: + """ @distributed_trace def begin_load_content( @@ -1382,20 +1820,26 @@ def begin_load_content( resource_group_name: str, profile_name: str, endpoint_name: str, - content_file_paths: "_models.LoadParameters", + content_file_paths: Union[_models.LoadParameters, IO], **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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param content_file_paths: The path to the content to be loaded. Path should be a full URL, - e.g. ‘/pictures/city.png' which loads a single file. - :type content_file_paths: ~azure.mgmt.cdn.models.LoadParameters + e.g. ‘/pictures/city.png' which loads a single file. Is either a model type or a IO type. + Required. + :type content_file_paths: ~azure.mgmt.cdn.models.LoadParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -1406,95 +1850,190 @@ def begin_load_content( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._load_content_initial( + raw_result = self._load_content_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, content_file_paths=content_file_paths, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_load_content.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load"} # type: ignore - @distributed_trace + @overload def validate_custom_domain( self, resource_group_name: str, profile_name: str, endpoint_name: str, - custom_domain_properties: "_models.ValidateCustomDomainInput", + custom_domain_properties: _models.ValidateCustomDomainInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.ValidateCustomDomainOutput": + ) -> _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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param custom_domain_properties: Custom domain to be validated. + :param custom_domain_properties: Custom domain to be validated. Required. :type custom_domain_properties: ~azure.mgmt.cdn.models.ValidateCustomDomainInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateCustomDomainOutput, or the result of cls(response) + :return: ValidateCustomDomainOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ValidateCustomDomainOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate_custom_domain( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_properties: Custom domain to be validated. Required. + :type custom_domain_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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 + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_custom_domain( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + custom_domain_properties: Union[_models.ValidateCustomDomainInput, IO], + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param custom_domain_properties: Custom domain to be validated. Is either a model type or a IO + type. Required. + :type custom_domain_properties: ~azure.mgmt.cdn.models.ValidateCustomDomainInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :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 + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateCustomDomainOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateCustomDomainOutput] - _json = self._serialize.body(custom_domain_properties, 'ValidateCustomDomainInput') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_domain_properties, (IO, bytes)): + _content = custom_domain_properties + else: + _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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate_custom_domain.metadata['url'], + content=_content, + template_url=self.validate_custom_domain.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1502,67 +2041,79 @@ def validate_custom_domain( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ValidateCustomDomainOutput', pipeline_response) + deserialized = self._deserialize("ValidateCustomDomainOutput", pipeline_response) if cls: 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 - + 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: Any - ) -> Iterable["_models.ResourceUsageListResult"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> Iterable["_models.ResourceUsage"]: """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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ResourceUsage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ResourceUsage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUsageListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceUsageListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1576,7 +2127,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1586,8 +2139,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage'} # type: ignore + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage"} # type: ignore 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 f4f992245272..0c81764d0d77 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,385 +7,404 @@ # 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 typing import Any, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict 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') +from .._serialization import Serializer +from .._vendor import MixinABC, _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, + subscription_id: str, *, - metrics: List[Union[str, "_models.LogMetric"]], + metrics: List[Union[str, _models.LogMetric]], date_time_begin: datetime.datetime, date_time_end: datetime.datetime, - granularity: Union[str, "_models.LogMetricsGranularity"], + granularity: Union[str, _models.LogMetricsGranularity], custom_domains: List[str], protocols: List[str], - group_by: Optional[List[Union[str, "_models.LogMetricsGroupBy"]]] = None, + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsMetrics') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsMetrics", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["metrics"] = [_SERIALIZER.query("metrics", q, "str") if q is not None else "" for q in metrics] + _params["dateTimeBegin"] = _SERIALIZER.query("date_time_begin", date_time_begin, "iso-8601") + _params["dateTimeEnd"] = _SERIALIZER.query("date_time_end", date_time_end, "iso-8601") + _params["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] + _params["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] + _params["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] + _params["countryOrRegions"] = [ + _SERIALIZER.query("country_or_regions", q, "str") if q is not None else "" for q in country_or_regions + ] + _params["customDomains"] = [ + _SERIALIZER.query("custom_domains", q, "str") if q is not None else "" for q in custom_domains + ] + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_log_analytics_rankings_request( - subscription_id: str, resource_group_name: str, profile_name: str, + subscription_id: str, *, - rankings: List[Union[str, "_models.LogRanking"]], - metrics: List[Union[str, "_models.LogRankingMetric"]], + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsRankings') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsRankings", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["rankings"] = [_SERIALIZER.query("rankings", q, "str") if q is not None else "" for q in rankings] + _params["metrics"] = [_SERIALIZER.query("metrics", q, "str") if q is not None else "" for q in metrics] + _params["maxRanking"] = _SERIALIZER.query("max_ranking", max_ranking, "int") + _params["dateTimeBegin"] = _SERIALIZER.query("date_time_begin", date_time_begin, "iso-8601") + _params["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] + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_log_analytics_locations_request( - subscription_id: str, - resource_group_name: str, - profile_name: str, - **kwargs: Any + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsLocations') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsLocations", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_log_analytics_resources_request( - subscription_id: str, - resource_group_name: str, - profile_name: str, - **kwargs: Any + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsResources') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getLogAnalyticsResources", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_waf_log_analytics_metrics_request( - subscription_id: str, resource_group_name: str, profile_name: str, + subscription_id: str, *, - metrics: List[Union[str, "_models.WafMetric"]], + 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, + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsMetrics') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsMetrics", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["metrics"] = [_SERIALIZER.query("metrics", q, "str") if q is not None else "" for q in metrics] + _params["dateTimeBegin"] = _SERIALIZER.query("date_time_begin", date_time_begin, "iso-8601") + _params["dateTimeEnd"] = _SERIALIZER.query("date_time_end", date_time_end, "iso-8601") + _params["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] + _params["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] + _params["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] + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_waf_log_analytics_rankings_request( - subscription_id: str, resource_group_name: str, profile_name: str, + subscription_id: str, *, - metrics: List[Union[str, "_models.WafMetric"]], + 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, + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsRankings') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getWafLogAnalyticsRankings", + ) # pylint: disable=line-too-long 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'), + "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) + _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] + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["metrics"] = [_SERIALIZER.query("metrics", q, "str") if q is not None else "" for q in metrics] + _params["dateTimeBegin"] = _SERIALIZER.query("date_time_begin", date_time_begin, "iso-8601") + _params["dateTimeEnd"] = _SERIALIZER.query("date_time_end", date_time_end, "iso-8601") + _params["maxRanking"] = _SERIALIZER.query("max_ranking", max_ranking, "int") + _params["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] + _params["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] + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class LogAnalyticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`log_analytics` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get_log_analytics_metrics( self, resource_group_name: str, profile_name: str, - metrics: List[Union[str, "_models.LogMetric"]], + metrics: List[Union[str, _models.LogMetric]], date_time_begin: datetime.datetime, date_time_end: datetime.datetime, - granularity: Union[str, "_models.LogMetricsGranularity"], + granularity: Union[str, _models.LogMetricsGranularity], custom_domains: List[str], protocols: List[str], - group_by: Optional[List[Union[str, "_models.LogMetricsGroupBy"]]] = None, + 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": + ) -> _models.MetricsResponse: """Get log report for AFD profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :type profile_name: str - :param metrics: + :param metrics: Required. :type metrics: list[str or ~azure.mgmt.cdn.models.LogMetric] - :param date_time_begin: + :param date_time_begin: Required. :type date_time_begin: ~datetime.datetime - :param date_time_end: + :param date_time_end: Required. :type date_time_end: ~datetime.datetime - :param granularity: + :param granularity: Known values are: "PT5M", "PT1H", and "P1D". Required. :type granularity: str or ~azure.mgmt.cdn.models.LogMetricsGranularity - :param custom_domains: + :param custom_domains: Required. :type custom_domains: list[str] - :param protocols: + :param protocols: Required. :type protocols: list[str] - :param group_by: + :param group_by: Default value is None. :type group_by: list[str or ~azure.mgmt.cdn.models.LogMetricsGroupBy] - :param continents: + :param continents: Default value is None. :type continents: list[str] - :param country_or_regions: + :param country_or_regions: Default value is None. :type country_or_regions: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: MetricsResponse, or the result of cls(response) + :return: MetricsResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.MetricsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricsResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.MetricsResponse] - request = build_get_log_analytics_metrics_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, profile_name=profile_name, + subscription_id=self._config.subscription_id, metrics=metrics, date_time_begin=date_time_begin, date_time_end=date_time_end, @@ -394,12 +414,18 @@ def get_log_analytics_metrics( group_by=group_by, continents=continents, country_or_regions=country_or_regions, - template_url=self.get_log_analytics_metrics.metadata['url'], + api_version=api_version, + template_url=self.get_log_analytics_metrics.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -407,76 +433,88 @@ def get_log_analytics_metrics( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('MetricsResponse', pipeline_response) + deserialized = self._deserialize("MetricsResponse", pipeline_response) if cls: 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 - + 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: str, profile_name: str, - rankings: List[Union[str, "_models.LogRanking"]], - metrics: List[Union[str, "_models.LogRankingMetric"]], + 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": + ) -> _models.RankingsResponse: """Get log analytics ranking report for AFD profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :type profile_name: str - :param rankings: + :param rankings: Required. :type rankings: list[str or ~azure.mgmt.cdn.models.LogRanking] - :param metrics: + :param metrics: Required. :type metrics: list[str or ~azure.mgmt.cdn.models.LogRankingMetric] - :param max_ranking: + :param max_ranking: Required. :type max_ranking: int - :param date_time_begin: + :param date_time_begin: Required. :type date_time_begin: ~datetime.datetime - :param date_time_end: + :param date_time_end: Required. :type date_time_end: ~datetime.datetime - :param custom_domains: + :param custom_domains: Default value is None. :type custom_domains: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: RankingsResponse, or the result of cls(response) + :return: RankingsResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.RankingsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RankingsResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RankingsResponse] - request = build_get_log_analytics_rankings_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, profile_name=profile_name, + subscription_id=self._config.subscription_id, 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'], + api_version=api_version, + template_url=self.get_log_analytics_rankings.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -484,52 +522,61 @@ def get_log_analytics_rankings( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('RankingsResponse', pipeline_response) + deserialized = self._deserialize("RankingsResponse", pipeline_response) if cls: 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 - + 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: str, - profile_name: str, - **kwargs: Any - ) -> "_models.ContinentsResponse": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :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) + :return: ContinentsResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ContinentsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContinentsResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ContinentsResponse] - 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'], + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_log_analytics_locations.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -537,52 +584,61 @@ def get_log_analytics_locations( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ContinentsResponse', pipeline_response) + deserialized = self._deserialize("ContinentsResponse", pipeline_response) if cls: 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 - + 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: str, - profile_name: str, - **kwargs: Any - ) -> "_models.ResourcesResponse": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :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) + :return: ResourcesResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ResourcesResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourcesResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourcesResponse] - 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'], + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_log_analytics_resources.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -590,67 +646,73 @@ def get_log_analytics_resources( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourcesResponse', pipeline_response) + deserialized = self._deserialize("ResourcesResponse", pipeline_response) if cls: 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 - + 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: str, profile_name: str, - metrics: List[Union[str, "_models.WafMetric"]], + 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, + 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": + ) -> _models.WafMetricsResponse: """Get Waf related log analytics report for AFD profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :type profile_name: str - :param metrics: + :param metrics: Required. :type metrics: list[str or ~azure.mgmt.cdn.models.WafMetric] - :param date_time_begin: + :param date_time_begin: Required. :type date_time_begin: ~datetime.datetime - :param date_time_end: + :param date_time_end: Required. :type date_time_end: ~datetime.datetime - :param granularity: + :param granularity: Known values are: "PT5M", "PT1H", and "P1D". Required. :type granularity: str or ~azure.mgmt.cdn.models.WafGranularity - :param actions: + :param actions: Default value is None. :type actions: list[str or ~azure.mgmt.cdn.models.WafAction] - :param group_by: + :param group_by: Default value is None. :type group_by: list[str or ~azure.mgmt.cdn.models.WafRankingGroupBy] - :param rule_types: + :param rule_types: Default value is None. :type rule_types: list[str or ~azure.mgmt.cdn.models.WafRuleType] :keyword callable cls: A custom type or function that will be passed the direct response - :return: WafMetricsResponse, or the result of cls(response) + :return: WafMetricsResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.WafMetricsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WafMetricsResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.WafMetricsResponse] - request = build_get_waf_log_analytics_metrics_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, profile_name=profile_name, + subscription_id=self._config.subscription_id, metrics=metrics, date_time_begin=date_time_begin, date_time_end=date_time_end, @@ -658,12 +720,18 @@ def get_waf_log_analytics_metrics( actions=actions, group_by=group_by, rule_types=rule_types, - template_url=self.get_waf_log_analytics_metrics.metadata['url'], + api_version=api_version, + template_url=self.get_waf_log_analytics_metrics.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -671,67 +739,73 @@ def get_waf_log_analytics_metrics( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('WafMetricsResponse', pipeline_response) + deserialized = self._deserialize("WafMetricsResponse", pipeline_response) if cls: 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 - + 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: str, profile_name: str, - metrics: List[Union[str, "_models.WafMetric"]], + 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, + 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": + ) -> _models.WafRankingsResponse: """Get WAF log analytics charts for AFD profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. which is unique within the resource group. + which is unique within the resource group. which is unique within the resource group. Required. :type profile_name: str - :param metrics: + :param metrics: Required. :type metrics: list[str or ~azure.mgmt.cdn.models.WafMetric] - :param date_time_begin: + :param date_time_begin: Required. :type date_time_begin: ~datetime.datetime - :param date_time_end: + :param date_time_end: Required. :type date_time_end: ~datetime.datetime - :param max_ranking: + :param max_ranking: Required. :type max_ranking: int - :param rankings: + :param rankings: Required. :type rankings: list[str or ~azure.mgmt.cdn.models.WafRankingType] - :param actions: + :param actions: Default value is None. :type actions: list[str or ~azure.mgmt.cdn.models.WafAction] - :param rule_types: + :param rule_types: Default value is None. :type rule_types: list[str or ~azure.mgmt.cdn.models.WafRuleType] :keyword callable cls: A custom type or function that will be passed the direct response - :return: WafRankingsResponse, or the result of cls(response) + :return: WafRankingsResponse or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.WafRankingsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WafRankingsResponse"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.WafRankingsResponse] - request = build_get_waf_log_analytics_rankings_request( - subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, profile_name=profile_name, + subscription_id=self._config.subscription_id, metrics=metrics, date_time_begin=date_time_begin, date_time_end=date_time_end, @@ -739,12 +813,18 @@ def get_waf_log_analytics_rankings( rankings=rankings, actions=actions, rule_types=rule_types, - template_url=self.get_waf_log_analytics_rankings.metadata['url'], + api_version=api_version, + template_url=self.get_waf_log_analytics_rankings.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -752,12 +832,11 @@ def get_waf_log_analytics_rankings( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('WafRankingsResponse', pipeline_response) + deserialized = self._deserialize("WafRankingsResponse", pipeline_response) if cls: 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 - + 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 1a96daead9b4..434a8795e9ed 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,115 +6,134 @@ # 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, Iterable, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict 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') +from .._serialization import Serializer +from .._vendor import MixinABC, _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" + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets", + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - url = _format_url_section(url, **path_format_arguments) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedRuleSetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`managed_rule_sets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.ManagedRuleSetDefinitionList"]: + def list(self, **kwargs: Any) -> Iterable["_models.ManagedRuleSetDefinition"]: """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 + :return: An iterator like instance of either ManagedRuleSetDefinition or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ManagedRuleSetDefinitionList] - :raises: ~azure.core.exceptions.HttpResponseError + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ManagedRuleSetDefinition] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedRuleSetDefinitionList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ManagedRuleSetDefinitionList] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -127,7 +147,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -137,8 +159,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - 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 da808a7a8533..111260154289 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,107 +6,124 @@ # 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, Iterable, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _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" + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Cdn/operations') + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.OperationsListResult"]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.OperationsListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationsListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -119,7 +137,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -129,8 +149,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.Cdn/operations'} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Cdn/operations"} # type: ignore 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 a9be8268caa5..1d24b3553efd 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,65 +6,70 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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_endpoint_request( - resource_group_name: str, - profile_name: str, - endpoint_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -74,134 +80,125 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request_initial( +def build_create_request( 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] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request_initial( +def build_update_request( 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] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( resource_group_name: str, profile_name: str, endpoint_name: str, @@ -209,109 +206,121 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class OriginGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`origin_groups` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_endpoint( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> Iterable["_models.OriginGroupListResult"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> Iterable["_models.OriginGroup"]: """Lists all of the existing origin groups within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.OriginGroupListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either OriginGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.OriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroupListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroupListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_endpoint.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -325,7 +334,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -335,55 +346,64 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - 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 + 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: str, - profile_name: str, - endpoint_name: str, - origin_group_name: str, - **kwargs: Any - ) -> "_models.OriginGroup": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OriginGroup, or the result of cls(response) + :return: OriginGroup or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.OriginGroup - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroup"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroup] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -391,15 +411,14 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}"} # type: ignore def _create_initial( self, @@ -407,55 +426,163 @@ def _create_initial( profile_name: str, endpoint_name: str, origin_group_name: str, - origin_group: "_models.OriginGroup", + origin_group: Union[_models.OriginGroup, IO], **kwargs: Any - ) -> "_models.OriginGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroup"] + ) -> _models.OriginGroup: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroup] - _json = self._serialize.body(origin_group, 'OriginGroup') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_group, (IO, bytes)): + _content = origin_group + else: + _json = self._serialize.body(origin_group, "OriginGroup") - request = build_create_request_initial( + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: 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 + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}"} # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group: _models.OriginGroup, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group: Origin group properties. Required. + :type origin_group: ~azure.mgmt.cdn.models.OriginGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.OriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group: Origin group properties. Required. + :type origin_group: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.OriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -464,21 +591,27 @@ def begin_create( profile_name: str, endpoint_name: str, origin_group_name: str, - origin_group: "_models.OriginGroup", + origin_group: Union[_models.OriginGroup, IO], **kwargs: Any - ) -> LROPoller["_models.OriginGroup"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_group_name: str - :param origin_group: Origin group properties. - :type origin_group: ~azure.mgmt.cdn.models.OriginGroup + :param origin_group: Origin group properties. Is either a model type or a IO type. Required. + :type origin_group: ~azure.mgmt.cdn.models.OriginGroup or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -490,51 +623,55 @@ def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroup] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_group_name=origin_group_name, origin_group=origin_group, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}"} # type: ignore def _update_initial( self, @@ -542,52 +679,160 @@ def _update_initial( profile_name: str, endpoint_name: str, origin_group_name: str, - origin_group_update_properties: "_models.OriginGroupUpdateParameters", + origin_group_update_properties: Union[_models.OriginGroupUpdateParameters, IO], **kwargs: Any - ) -> "_models.OriginGroup": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginGroup"] + ) -> _models.OriginGroup: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(origin_group_update_properties, 'OriginGroupUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroup] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_group_update_properties, (IO, bytes)): + _content = origin_group_update_properties + else: + _json = self._serialize.body(origin_group_update_properties, "OriginGroupUpdateParameters") + + request = build_update_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: 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 + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}"} # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group_update_properties: _models.OriginGroupUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group_update_properties: Origin group properties. Required. + :type origin_group_update_properties: ~azure.mgmt.cdn.models.OriginGroupUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.OriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_group_name: str, + origin_group_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. + :type origin_group_name: str + :param origin_group_update_properties: Origin group properties. Required. + :type origin_group_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.OriginGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_update( @@ -596,21 +841,28 @@ def begin_update( profile_name: str, endpoint_name: str, origin_group_name: str, - origin_group_update_properties: "_models.OriginGroupUpdateParameters", + origin_group_update_properties: Union[_models.OriginGroupUpdateParameters, IO], **kwargs: Any - ) -> LROPoller["_models.OriginGroup"]: + ) -> LROPoller[_models.OriginGroup]: """Updates an existing origin group within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :type origin_group_name: str - :param origin_group_update_properties: Origin group properties. - :type origin_group_update_properties: ~azure.mgmt.cdn.models.OriginGroupUpdateParameters + :param origin_group_update_properties: Origin group properties. Is either a model type or a IO + type. Required. + :type origin_group_update_properties: ~azure.mgmt.cdn.models.OriginGroupUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -622,109 +874,119 @@ def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginGroup] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_group_name=origin_group_name, origin_group_update_properties=origin_group_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('OriginGroup', pipeline_response) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: str, - profile_name: str, - endpoint_name: str, - origin_group_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}'} # type: ignore - + _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: str, - profile_name: str, - endpoint_name: str, - origin_group_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str :param origin_group_name: Name of the origin group which is unique within the endpoint. + Required. :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. @@ -736,42 +998,47 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_group_name=origin_group_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 b7456e5edd38..e73e1b6245f4 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,65 +6,70 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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_endpoint_request( - resource_group_name: str, - profile_name: str, - endpoint_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -74,134 +80,125 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request_initial( +def build_create_request( 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] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request_initial( +def build_update_request( 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] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( resource_group_name: str, profile_name: str, endpoint_name: str, @@ -209,108 +206,121 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class OriginsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`origins` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_endpoint( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> Iterable["_models.OriginListResult"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> Iterable["_models.Origin"]: """Lists all of the existing origins within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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 OriginListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.OriginListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Origin or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Origin] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OriginListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OriginListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_endpoint.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -324,7 +334,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -334,55 +346,63 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - 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 + 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: str, - profile_name: str, - endpoint_name: str, - origin_name: str, - **kwargs: Any - ) -> "_models.Origin": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param origin_name: Name of the origin which is unique within the endpoint. + :param origin_name: Name of the origin which is unique within the endpoint. Required. :type origin_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Origin, or the result of cls(response) + :return: Origin or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Origin - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Origin"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Origin] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -390,15 +410,14 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}"} # type: ignore def _create_initial( self, @@ -406,55 +425,159 @@ def _create_initial( profile_name: str, endpoint_name: str, origin_name: str, - origin: "_models.Origin", + origin: Union[_models.Origin, IO], **kwargs: Any - ) -> "_models.Origin": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Origin"] + ) -> _models.Origin: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(origin, 'Origin') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Origin] - request = build_create_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin, (IO, bytes)): + _content = origin + else: + _json = self._serialize.body(origin, "Origin") + + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if cls: 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 + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}"} # type: ignore + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin: _models.Origin, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_name: Name of the origin that is unique within the endpoint. Required. + :type origin_name: str + :param origin: Origin properties. Required. + :type origin: ~azure.mgmt.cdn.models.Origin + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Origin or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Origin] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_name: Name of the origin that is unique within the endpoint. Required. + :type origin_name: str + :param origin: Origin properties. Required. + :type origin: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Origin or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Origin] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -463,21 +586,26 @@ def begin_create( profile_name: str, endpoint_name: str, origin_name: str, - origin: "_models.Origin", + origin: Union[_models.Origin, IO], **kwargs: Any - ) -> LROPoller["_models.Origin"]: + ) -> LROPoller[_models.Origin]: """Creates a new origin within the specified endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param origin_name: Name of the origin that is unique within the endpoint. + :param origin_name: Name of the origin that is unique within the endpoint. Required. :type origin_name: str - :param origin: Origin properties. - :type origin: ~azure.mgmt.cdn.models.Origin + :param origin: Origin properties. Is either a model type or a IO type. Required. + :type origin: ~azure.mgmt.cdn.models.Origin or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -488,51 +616,55 @@ def begin_create( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Origin] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_name=origin_name, origin=origin, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}"} # type: ignore def _update_initial( self, @@ -540,52 +672,156 @@ def _update_initial( profile_name: str, endpoint_name: str, origin_name: str, - origin_update_properties: "_models.OriginUpdateParameters", + origin_update_properties: Union[_models.OriginUpdateParameters, IO], **kwargs: Any - ) -> "_models.Origin": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Origin"] + ) -> _models.Origin: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Origin] - _json = self._serialize.body(origin_update_properties, 'OriginUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(origin_update_properties, (IO, bytes)): + _content = origin_update_properties + else: + _json = self._serialize.body(origin_update_properties, "OriginUpdateParameters") - request = build_update_request_initial( + request = build_update_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if cls: 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 + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}"} # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin_update_properties: _models.OriginUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_name: Name of the origin which is unique within the endpoint. Required. + :type origin_name: str + :param origin_update_properties: Origin properties. Required. + :type origin_update_properties: ~azure.mgmt.cdn.models.OriginUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Origin or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Origin] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + origin_name: str, + origin_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param origin_name: Name of the origin which is unique within the endpoint. Required. + :type origin_name: str + :param origin_update_properties: Origin properties. Required. + :type origin_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Origin or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Origin] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_update( @@ -594,21 +830,27 @@ def begin_update( profile_name: str, endpoint_name: str, origin_name: str, - origin_update_properties: "_models.OriginUpdateParameters", + origin_update_properties: Union[_models.OriginUpdateParameters, IO], **kwargs: Any - ) -> LROPoller["_models.Origin"]: + ) -> LROPoller[_models.Origin]: """Updates an existing origin within an endpoint. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param origin_name: Name of the origin which is unique within the endpoint. + :param origin_name: Name of the origin which is unique within the endpoint. Required. :type origin_name: str - :param origin_update_properties: Origin properties. - :type origin_update_properties: ~azure.mgmt.cdn.models.OriginUpdateParameters + :param origin_update_properties: Origin properties. Is either a model type or a IO type. + Required. + :type origin_update_properties: ~azure.mgmt.cdn.models.OriginUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -619,109 +861,118 @@ def begin_update( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Origin] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_name=origin_name, origin_update_properties=origin_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Origin', pipeline_response) + deserialized = self._deserialize("Origin", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: str, - profile_name: str, - endpoint_name: str, - origin_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - - request = build_delete_request_initial( + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'} # type: ignore - + _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: str, - profile_name: str, - endpoint_name: str, - origin_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param origin_name: Name of the origin which is unique within the endpoint. + :param origin_name: Name of the origin which is unique within the endpoint. Required. :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. @@ -733,42 +984,47 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, origin_name=origin_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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/_patch.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 455394382442..05b9850a9ffd 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,284 +6,303 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + +def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, policy_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", + ) # pylint: disable=line-too-long 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'), + "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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - url = _format_url_section(url, **path_format_arguments) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, policy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - api_version = "2021-06-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", + ) # pylint: disable=line-too-long 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'), + "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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - url = _format_url_section(url, **path_format_arguments) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, policy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - api_version = "2021-06-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", + ) # pylint: disable=line-too-long 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'), + "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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - url = _format_url_section(url, **path_format_arguments) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, - policy_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, policy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}", + ) # pylint: disable=line-too-long 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'), + "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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - url = _format_url_section(url, **path_format_arguments) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class PoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`policies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.CdnWebApplicationFirewallPolicyList"]: + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.CdnWebApplicationFirewallPolicy"]: """Lists all of the protection policies within a resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either CdnWebApplicationFirewallPolicy or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicyList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicyList] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -296,7 +316,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -306,47 +328,53 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - 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: str, - policy_name: str, - **kwargs: Any - ) -> "_models.CdnWebApplicationFirewallPolicy": + def get(self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CdnWebApplicationFirewallPolicy, or the result of cls(response) + :return: CdnWebApplicationFirewallPolicy or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicy] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -354,85 +382,179 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: 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: str, policy_name: str, - cdn_web_application_firewall_policy: "_models.CdnWebApplicationFirewallPolicy", + cdn_web_application_firewall_policy: Union[_models.CdnWebApplicationFirewallPolicy, IO], **kwargs: Any - ) -> "_models.CdnWebApplicationFirewallPolicy": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicy"] + ) -> _models.CdnWebApplicationFirewallPolicy: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicy] - _json = self._serialize.body(cdn_web_application_firewall_policy, 'CdnWebApplicationFirewallPolicy') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cdn_web_application_firewall_policy, (IO, bytes)): + _content = cdn_web_application_firewall_policy + else: + _json = self._serialize.body(cdn_web_application_firewall_policy, "CdnWebApplicationFirewallPolicy") - request = build_create_or_update_request_initial( + request = build_create_or_update_request( resource_group_name=resource_group_name, policy_name=policy_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_or_update_initial.metadata['url'], + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: 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 + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy: _models.CdnWebApplicationFirewallPolicy, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. + :type policy_name: str + :param cdn_web_application_firewall_policy: Policy to be created. Required. + :type cdn_web_application_firewall_policy: + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def begin_create_or_update( + self, + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. + :type policy_name: str + :param cdn_web_application_firewall_policy: Policy to be created. Required. + :type cdn_web_application_firewall_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create_or_update( self, resource_group_name: str, policy_name: str, - cdn_web_application_firewall_policy: "_models.CdnWebApplicationFirewallPolicy", + cdn_web_application_firewall_policy: Union[_models.CdnWebApplicationFirewallPolicy, IO], **kwargs: Any - ) -> LROPoller["_models.CdnWebApplicationFirewallPolicy"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. :type policy_name: str - :param cdn_web_application_firewall_policy: Policy to be created. + :param cdn_web_application_firewall_policy: Policy to be created. Is either a model type or a + IO type. Required. :type cdn_web_application_firewall_policy: - ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -444,118 +566,226 @@ def begin_create_or_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicy] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy=cdn_web_application_firewall_policy, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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: str, policy_name: str, - cdn_web_application_firewall_policy_patch_parameters: "_models.CdnWebApplicationFirewallPolicyPatchParameters", + cdn_web_application_firewall_policy_patch_parameters: Union[ + _models.CdnWebApplicationFirewallPolicyPatchParameters, IO + ], **kwargs: Any - ) -> "_models.CdnWebApplicationFirewallPolicy": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CdnWebApplicationFirewallPolicy"] + ) -> _models.CdnWebApplicationFirewallPolicy: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(cdn_web_application_firewall_policy_patch_parameters, 'CdnWebApplicationFirewallPolicyPatchParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicy] - request = build_update_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(cdn_web_application_firewall_policy_patch_parameters, (IO, bytes)): + _content = cdn_web_application_firewall_policy_patch_parameters + else: + _json = self._serialize.body( + cdn_web_application_firewall_policy_patch_parameters, "CdnWebApplicationFirewallPolicyPatchParameters" + ) + + request = build_update_request( resource_group_name=resource_group_name, policy_name=policy_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: 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 + + @overload + def begin_update( + self, + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy_patch_parameters: _models.CdnWebApplicationFirewallPolicyPatchParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CdnWebApplicationFirewallPolicy]: + """Update an existing CdnWebApplicationFirewallPolicy with the specified policy name under the + specified subscription and resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. + :type policy_name: str + :param cdn_web_application_firewall_policy_patch_parameters: CdnWebApplicationFirewallPolicy + parameters to be patched. Required. + :type cdn_web_application_firewall_policy_patch_parameters: + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + policy_name: str, + cdn_web_application_firewall_policy_patch_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CdnWebApplicationFirewallPolicy]: + """Update an existing CdnWebApplicationFirewallPolicy with the specified policy name under the + specified subscription and resource group. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. + :type policy_name: str + :param cdn_web_application_firewall_policy_patch_parameters: CdnWebApplicationFirewallPolicy + parameters to be patched. Required. + :type cdn_web_application_firewall_policy_patch_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_update( self, resource_group_name: str, policy_name: str, - cdn_web_application_firewall_policy_patch_parameters: "_models.CdnWebApplicationFirewallPolicyPatchParameters", + cdn_web_application_firewall_policy_patch_parameters: Union[ + _models.CdnWebApplicationFirewallPolicyPatchParameters, IO + ], **kwargs: Any - ) -> LROPoller["_models.CdnWebApplicationFirewallPolicy"]: + ) -> LROPoller[_models.CdnWebApplicationFirewallPolicy]: """Update an existing CdnWebApplicationFirewallPolicy with the specified policy name under the specified subscription and resource group. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. :type policy_name: str :param cdn_web_application_firewall_policy_patch_parameters: CdnWebApplicationFirewallPolicy - parameters to be patched. + parameters to be patched. Is either a model type or a IO type. Required. :type cdn_web_application_firewall_policy_patch_parameters: - ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters + ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -567,85 +797,99 @@ def begin_update( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CdnWebApplicationFirewallPolicy] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy_patch_parameters=cdn_web_application_firewall_policy_patch_parameters, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CdnWebApplicationFirewallPolicy', pipeline_response) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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: str, - policy_name: str, - **kwargs: Any + def delete( # pylint: disable=inconsistent-return-statements + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str - :param policy_name: The name of the CdnWebApplicationFirewallPolicy. + :param policy_name: The name of the CdnWebApplicationFirewallPolicy. Required. :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - 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'], + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -656,5 +900,4 @@ def delete( 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 eec9c81f9c34..5c360c7bd7c4 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,414 +6,398 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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" + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - url = _format_url_section(url, **path_format_arguments) + _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') + _params["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" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - api_version = "2021-06-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - api_version = "2021-06-01" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_generate_sso_uri_request( - resource_group_name: str, - profile_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_supported_optimization_types_request( - resource_group_name: str, - profile_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getSupportedOptimizationTypes') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/getSupportedOptimizationTypes", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_resource_usage_request( - resource_group_name: str, - profile_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`profiles` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.ProfileListResult"]: + def list(self, **kwargs: Any) -> Iterable["_models.Profile"]: """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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ProfileListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Profile or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProfileListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProfileListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -426,7 +411,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -436,53 +423,65 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles'} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles"} # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.ProfileListResult"]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Profile"]: """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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProfileListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ProfileListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Profile or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProfileListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProfileListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -496,7 +495,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -506,49 +507,55 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles'} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles"} # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> "_models.Profile": + def get(self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :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) + :return: Profile or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Profile - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Profile] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -556,86 +563,106 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore def _create_initial( - self, - resource_group_name: str, - profile_name: str, - profile: "_models.Profile", - **kwargs: Any - ) -> "_models.Profile": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] + self, resource_group_name: str, profile_name: str, profile: Union[_models.Profile, IO], **kwargs: Any + ) -> _models.Profile: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(profile, 'Profile') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Profile] - request = build_create_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(profile, (IO, bytes)): + _content = profile + else: + _json = self._serialize.body(profile, "Profile") + + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore - - @distributed_trace + @overload def begin_create( self, resource_group_name: str, profile_name: str, - profile: "_models.Profile", + profile: _models.Profile, + *, + content_type: str = "application/json", **kwargs: Any - ) -> LROPoller["_models.Profile"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :type profile_name: str - :param profile: Profile properties needed to create a new profile. + :param profile: Profile properties needed to create a new profile. Required. :type profile: ~azure.mgmt.cdn.models.Profile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -646,117 +673,214 @@ def begin_create( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + profile: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param profile: Profile properties needed to create a new profile. Required. + :type profile: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Profile or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, resource_group_name: str, profile_name: str, profile: Union[_models.Profile, IO], **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. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param profile: Profile properties needed to create a new profile. Is either a model type or a + IO type. Required. + :type profile: ~azure.mgmt.cdn.models.Profile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: 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 Profile or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Profile] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, profile=profile, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore def _update_initial( self, resource_group_name: str, profile_name: str, - profile_update_parameters: "_models.ProfileUpdateParameters", + profile_update_parameters: Union[_models.ProfileUpdateParameters, IO], **kwargs: Any - ) -> "_models.Profile": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Profile"] + ) -> _models.Profile: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(profile_update_parameters, 'ProfileUpdateParameters') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Profile] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(profile_update_parameters, (IO, bytes)): + _content = profile_update_parameters + else: + _json = self._serialize.body(profile_update_parameters, "ProfileUpdateParameters") - request = build_update_request_initial( + request = build_update_request( resource_group_name=resource_group_name, profile_name=profile_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - 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 response.status_code == 200: - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore - - @distributed_trace + @overload def begin_update( self, resource_group_name: str, profile_name: str, - profile_update_parameters: "_models.ProfileUpdateParameters", + profile_update_parameters: _models.ProfileUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> LROPoller["_models.Profile"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :type profile_name: str :param profile_update_parameters: Profile properties needed to update an existing profile. + Required. :type profile_update_parameters: ~azure.mgmt.cdn.models.ProfileUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -767,100 +891,181 @@ def begin_update( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + profile_update_parameters: IO, + *, + content_type: str = "application/json", + **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. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param profile_update_parameters: Profile properties needed to update an existing profile. + Required. + :type profile_update_parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Profile or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + profile_name: str, + profile_update_parameters: Union[_models.ProfileUpdateParameters, IO], + **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. Required. + :type resource_group_name: str + :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. Required. + :type profile_name: str + :param profile_update_parameters: Profile properties needed to update an existing profile. Is + either a model type or a IO type. Required. + :type profile_update_parameters: ~azure.mgmt.cdn.models.ProfileUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: 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 Profile or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Profile] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, profile_update_parameters=profile_update_parameters, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Profile', pipeline_response) + deserialized = self._deserialize("Profile", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore - def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( resource_group_name=resource_group_name, profile_name=profile_name, subscription_id=self._config.subscription_id, - template_url=self._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - 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_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore @distributed_trace - def begin_delete( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :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. @@ -872,83 +1077,97 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: str, - profile_name: str, - **kwargs: Any - ) -> "_models.SsoUri": + def generate_sso_uri(self, 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 real-time stats and alerts in a premium profile. The SSO URI changes approximately every 10 minutes. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :param profile_name: Name of the CDN profile which is unique within the resource group. + Required. :type profile_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SsoUri, or the result of cls(response) + :return: SsoUri or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.SsoUri - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SsoUri"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SsoUri] - 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'], + api_version=api_version, + template_url=self.generate_sso_uri.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -956,53 +1175,62 @@ def generate_sso_uri( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SsoUri', pipeline_response) + deserialized = self._deserialize("SsoUri", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - generate_sso_uri.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri'} # type: ignore - + 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: str, - profile_name: str, - **kwargs: Any - ) -> "_models.SupportedOptimizationTypesListResult": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :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) + :return: SupportedOptimizationTypesListResult or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.SupportedOptimizationTypesListResult - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedOptimizationTypesListResult"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SupportedOptimizationTypesListResult] - 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'], + api_version=api_version, + template_url=self.list_supported_optimization_types.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1010,64 +1238,76 @@ def list_supported_optimization_types( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SupportedOptimizationTypesListResult', pipeline_response) + deserialized = self._deserialize("SupportedOptimizationTypesListResult", pipeline_response) if cls: 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 - + 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: Any - ) -> Iterable["_models.ResourceUsageListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> Iterable["_models.ResourceUsage"]: """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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str :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. + profile which is unique within the resource group. Required. :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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ResourceUsage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ResourceUsage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUsageListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceUsageListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1081,7 +1321,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1091,8 +1333,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage'} # type: ignore + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage"} # type: ignore 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 85dacfa4007c..c2152fab9773 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,115 +6,130 @@ # 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, Iterable, Optional, TypeVar -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict 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') +from .._serialization import Serializer +from .._vendor import MixinABC, _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" + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - url = _format_url_section(url, **path_format_arguments) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ResourceUsageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`resource_usage` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.ResourceUsageListResult"]: + def list(self, **kwargs: Any) -> Iterable["_models.ResourceUsage"]: """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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ResourceUsageListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either ResourceUsage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.ResourceUsage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUsageListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceUsageListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - template_url=next_link, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -127,7 +143,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -137,8 +155,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage'} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage"} # type: ignore 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 cd7701c0ead6..53d8bb1341e8 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,65 +6,70 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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_endpoint_request( - resource_group_name: str, - profile_name: str, - endpoint_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, endpoint_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -74,134 +80,125 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_request_initial( +def build_create_request( 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] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request_initial( +def build_update_request( 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] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( resource_group_name: str, profile_name: str, endpoint_name: str, @@ -209,109 +206,121 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class RoutesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`routes` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_endpoint( - self, - resource_group_name: str, - profile_name: str, - endpoint_name: str, - **kwargs: Any - ) -> Iterable["_models.RouteListResult"]: + self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any + ) -> Iterable["_models.Route"]: """Lists all of the existing origins within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :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 RouteListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.RouteListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Route or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RouteListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_endpoint.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -325,7 +334,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -335,57 +346,64 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - 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 + 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: str, - profile_name: str, - endpoint_name: str, - route_name: str, - **kwargs: Any - ) -> "_models.Route": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param route_name: Name of the routing rule. + :param route_name: Name of the routing rule. Required. :type route_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Route, or the result of cls(response) + :return: Route or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Route - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Route"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Route] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -393,15 +411,14 @@ def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}"} # type: ignore def _create_initial( self, @@ -409,55 +426,161 @@ def _create_initial( profile_name: str, endpoint_name: str, route_name: str, - route: "_models.Route", + route: Union[_models.Route, IO], **kwargs: Any - ) -> "_models.Route": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Route"] + ) -> _models.Route: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Route] - _json = self._serialize.body(route, 'Route') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route, (IO, bytes)): + _content = route + else: + _json = self._serialize.body(route, "Route") - request = build_create_request_initial( + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if cls: 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 + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}"} # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route: _models.Route, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param route_name: Name of the routing rule. Required. + :type route_name: str + :param route: Route properties. Required. + :type route: ~azure.mgmt.cdn.models.Route + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Route or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param route_name: Name of the routing rule. Required. + :type route_name: str + :param route: Route properties. Required. + :type route: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Route or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -466,23 +589,27 @@ def begin_create( profile_name: str, endpoint_name: str, route_name: str, - route: "_models.Route", + route: Union[_models.Route, IO], **kwargs: Any - ) -> LROPoller["_models.Route"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param route_name: Name of the routing rule. + :param route_name: Name of the routing rule. Required. :type route_name: str - :param route: Route properties. - :type route: ~azure.mgmt.cdn.models.Route + :param route: Route properties. Is either a model type or a IO type. Required. + :type route: ~azure.mgmt.cdn.models.Route or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -493,51 +620,57 @@ def begin_create( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Route] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, route_name=route_name, route=route, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}"} # type: ignore def _update_initial( self, @@ -545,52 +678,158 @@ def _update_initial( profile_name: str, endpoint_name: str, route_name: str, - route_update_properties: "_models.RouteUpdateParameters", + route_update_properties: Union[_models.RouteUpdateParameters, IO], **kwargs: Any - ) -> "_models.Route": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Route"] + ) -> _models.Route: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Route] - _json = self._serialize.body(route_update_properties, 'RouteUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(route_update_properties, (IO, bytes)): + _content = route_update_properties + else: + _json = self._serialize.body(route_update_properties, "RouteUpdateParameters") - request = build_update_request_initial( + request = build_update_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if cls: 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 + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}"} # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route_update_properties: _models.RouteUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param route_name: Name of the routing rule. Required. + :type route_name: str + :param route_update_properties: Route update properties. Required. + :type route_update_properties: ~azure.mgmt.cdn.models.RouteUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Route or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + endpoint_name: str, + route_name: str, + route_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. + :type endpoint_name: str + :param route_name: Name of the routing rule. Required. + :type route_name: str + :param route_update_properties: Route update properties. Required. + :type route_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Route or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Route] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_update( @@ -599,23 +838,28 @@ def begin_update( profile_name: str, endpoint_name: str, route_name: str, - route_update_properties: "_models.RouteUpdateParameters", + route_update_properties: Union[_models.RouteUpdateParameters, IO], **kwargs: Any - ) -> LROPoller["_models.Route"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param route_name: Name of the routing rule. + :param route_name: Name of the routing rule. Required. :type route_name: str - :param route_update_properties: Route update properties. - :type route_update_properties: ~azure.mgmt.cdn.models.RouteUpdateParameters + :param route_update_properties: Route update properties. Is either a model type or a IO type. + Required. + :type route_update_properties: ~azure.mgmt.cdn.models.RouteUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -626,111 +870,121 @@ def begin_update( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Route] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, route_name=route_name, route_update_properties=route_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Route', pipeline_response) + deserialized = self._deserialize("Route", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: str, - profile_name: str, - endpoint_name: str, - route_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: str, - profile_name: str, - endpoint_name: str, - route_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param endpoint_name: Name of the endpoint under the profile which is unique globally. + Required. :type endpoint_name: str - :param route_name: Name of the routing rule. + :param route_name: Name of the routing rule. Required. :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. @@ -742,42 +996,49 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, route_name=route_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 dbba2ace4a1f..21031ade600c 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,279 +6,286 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _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 + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - profile_name: str, - rule_set_name: str, - subscription_id: str, - **kwargs: Any + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_request( - resource_group_name: str, - profile_name: str, - rule_set_name: str, - subscription_id: str, - **kwargs: Any + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_list_resource_usage_request( - resource_group_name: str, - profile_name: str, - rule_set_name: str, - subscription_id: str, - **kwargs: Any + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/usages') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/usages", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class RuleSetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`rule_sets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> Iterable["_models.RuleSetListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> Iterable["_models.RuleSet"]: """Lists existing AzureFrontDoor rule sets within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.RuleSetListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either RuleSet or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.RuleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleSetListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleSetListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -291,7 +299,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -301,53 +311,59 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets'} # type: ignore + 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: str, - profile_name: str, - rule_set_name: str, - **kwargs: Any - ) -> "_models.RuleSet": + def get(self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. + Required. :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) + :return: RuleSet or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.RuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleSet"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleSet] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -355,56 +371,63 @@ def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('RuleSet', pipeline_response) + deserialized = self._deserialize("RuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}"} # type: ignore @distributed_trace - def create( - self, - resource_group_name: str, - profile_name: str, - rule_set_name: str, - **kwargs: Any - ) -> "_models.RuleSet": + def create(self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. + Required. :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) + :return: RuleSet or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.RuleSet - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleSet"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleSet] - 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'], + api_version=api_version, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -413,73 +436,78 @@ def create( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('RuleSet', pipeline_response) + deserialized = self._deserialize("RuleSet", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('RuleSet', pipeline_response) + deserialized = self._deserialize("RuleSet", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}'} # type: ignore - + create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}"} # type: ignore - def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - rule_set_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - - request = build_delete_request_initial( + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: str, - profile_name: str, - rule_set_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. + Required. :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. @@ -491,96 +519,117 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: 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. + self, resource_group_name: str, profile_name: str, rule_set_name: str, **kwargs: Any + ) -> Iterable["_models.Usage"]: + """Checks the quota and actual usage of the given AzureFrontDoor rule set under the given CDN + profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str :param rule_set_name: Name of the rule set under the profile which is unique globally. + Required. :type rule_set_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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.UsagesListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.UsagesListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_resource_usage.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -594,7 +643,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -604,8 +655,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_resource_usage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/usages'} # type: ignore + list_resource_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/usages"} # type: ignore 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 26bc9c7d4739..3c0bf344e70d 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,313 +6,300 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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_rule_set_request( - resource_group_name: str, - profile_name: str, - rule_set_name: str, - subscription_id: str, - **kwargs: Any + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - profile_name: str, - rule_set_name: str, - rule_name: str, - subscription_id: str, - **kwargs: Any + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, profile_name: str, rule_set_name: str, rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, profile_name: str, rule_set_name: str, rule_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class RulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_rule_set( - self, - resource_group_name: str, - profile_name: str, - rule_set_name: str, - **kwargs: Any - ) -> Iterable["_models.RuleListResult"]: + self, resource_group_name: str, profile_name: str, rule_set_name: str, **kwargs: Any + ) -> Iterable["_models.Rule"]: """Lists all of the existing delivery rules within a rule set. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param rule_set_name: Name of the rule set under the profile. + :param rule_set_name: Name of the rule set under the profile. Required. :type rule_set_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.RuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Rule or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_rule_set.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -325,7 +313,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -335,56 +325,62 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - 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 + 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: str, - profile_name: str, - rule_set_name: str, - rule_name: str, - **kwargs: Any - ) -> "_models.Rule": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param rule_set_name: Name of the rule set under the profile. + :param rule_set_name: Name of the rule set under the profile. Required. :type rule_set_name: str - :param rule_name: Name of the delivery rule which is unique within the endpoint. + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Rule, or the result of cls(response) + :return: Rule or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Rule - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Rule] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -392,15 +388,14 @@ def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: 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 - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}"} # type: ignore def _create_initial( self, @@ -408,55 +403,157 @@ def _create_initial( profile_name: str, rule_set_name: str, rule_name: str, - rule: "_models.Rule", + rule: Union[_models.Rule, IO], **kwargs: Any - ) -> "_models.Rule": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + ) -> _models.Rule: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Rule] - _json = self._serialize.body(rule, 'Rule') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rule, (IO, bytes)): + _content = rule + else: + _json = self._serialize.body(rule, "Rule") - request = build_create_request_initial( + request = build_create_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", 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}/rules/{ruleName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}"} # type: ignore + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule: _models.Rule, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param rule_set_name: Name of the rule set under the profile. Required. + :type rule_set_name: str + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. + :type rule_name: str + :param rule: The delivery rule properties. Required. + :type rule: ~azure.mgmt.cdn.models.Rule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Rule or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param rule_set_name: Name of the rule set under the profile. Required. + :type rule_set_name: str + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. + :type rule_name: str + :param rule: The delivery rule properties. Required. + :type rule: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Rule or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -465,22 +562,25 @@ def begin_create( profile_name: str, rule_set_name: str, rule_name: str, - rule: "_models.Rule", + rule: Union[_models.Rule, IO], **kwargs: Any - ) -> LROPoller["_models.Rule"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param rule_set_name: Name of the rule set under the profile. + :param rule_set_name: Name of the rule set under the profile. Required. :type rule_set_name: str - :param rule_name: Name of the delivery rule which is unique within the endpoint. + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. :type rule_name: str - :param rule: The delivery rule properties. - :type rule: ~azure.mgmt.cdn.models.Rule + :param rule: The delivery rule properties. Is either a model type or a IO type. Required. + :type rule: ~azure.mgmt.cdn.models.Rule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -491,51 +591,57 @@ def begin_create( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Rule] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, rule_name=rule_name, rule=rule, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}"} # type: ignore def _update_initial( self, @@ -543,52 +649,154 @@ def _update_initial( profile_name: str, rule_set_name: str, rule_name: str, - rule_update_properties: "_models.RuleUpdateParameters", + rule_update_properties: Union[_models.RuleUpdateParameters, IO], **kwargs: Any - ) -> "_models.Rule": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + ) -> _models.Rule: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Rule] - _json = self._serialize.body(rule_update_properties, 'RuleUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(rule_update_properties, (IO, bytes)): + _content = rule_update_properties + else: + _json = self._serialize.body(rule_update_properties, "RuleUpdateParameters") - request = build_update_request_initial( + request = build_update_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, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: 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 + _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}"} # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule_update_properties: _models.RuleUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param rule_set_name: Name of the rule set under the profile. Required. + :type rule_set_name: str + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. + :type rule_name: str + :param rule_update_properties: Delivery rule properties. Required. + :type rule_update_properties: ~azure.mgmt.cdn.models.RuleUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Rule or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + profile_name: str, + rule_set_name: str, + rule_name: str, + rule_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param rule_set_name: Name of the rule set under the profile. Required. + :type rule_set_name: str + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. + :type rule_name: str + :param rule_update_properties: Delivery rule properties. Required. + :type rule_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Rule or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Rule] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_update( @@ -597,22 +805,26 @@ def begin_update( profile_name: str, rule_set_name: str, rule_name: str, - rule_update_properties: "_models.RuleUpdateParameters", + rule_update_properties: Union[_models.RuleUpdateParameters, IO], **kwargs: Any - ) -> LROPoller["_models.Rule"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param rule_set_name: Name of the rule set under the profile. + :param rule_set_name: Name of the rule set under the profile. Required. :type rule_set_name: str - :param rule_name: Name of the delivery rule which is unique within the endpoint. + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. :type rule_name: str - :param rule_update_properties: Delivery rule properties. - :type rule_update_properties: ~azure.mgmt.cdn.models.RuleUpdateParameters + :param rule_update_properties: Delivery rule properties. Is either a model type or a IO type. + Required. + :type rule_update_properties: ~azure.mgmt.cdn.models.RuleUpdateParameters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -623,110 +835,119 @@ def begin_update( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Rule] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, rule_name=rule_name, rule_update_properties=rule_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Rule', pipeline_response) + deserialized = self._deserialize("Rule", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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: str, - profile_name: str, - rule_set_name: str, - rule_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - - request = build_delete_request_initial( + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: str, - profile_name: str, - rule_set_name: str, - rule_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param rule_set_name: Name of the rule set under the profile. + :param rule_set_name: Name of the rule set under the profile. Required. :type rule_set_name: str - :param rule_name: Name of the delivery rule which is unique within the endpoint. + :param rule_name: Name of the delivery rule which is unique within the endpoint. Required. :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. @@ -738,42 +959,49 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, rule_name=rule_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 5fd499861184..37955db73548 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,252 +6,253 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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 + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - profile_name: str, - secret_name: str, - subscription_id: str, - **kwargs: Any + resource_group_name: str, profile_name: str, secret_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, profile_name: str, secret_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class SecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`secrets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> Iterable["_models.SecretListResult"]: + def list_by_profile(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> Iterable["_models.Secret"]: """Lists existing AzureFrontDoor secrets. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.SecretListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either Secret or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.Secret] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecretListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -264,7 +266,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -274,52 +278,57 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets'} # type: ignore + 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: str, - profile_name: str, - secret_name: str, - **kwargs: Any - ) -> "_models.Secret": + def get(self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param secret_name: Name of the Secret under the profile. + :param secret_name: Name of the Secret under the profile. Required. :type secret_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Secret, or the result of cls(response) + :return: Secret or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.Secret - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,69 +336,164 @@ def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('Secret', pipeline_response) + deserialized = self._deserialize("Secret", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}"} # type: ignore def _create_initial( self, resource_group_name: str, profile_name: str, secret_name: str, - secret: "_models.Secret", + secret: Union[_models.Secret, IO], **kwargs: Any - ) -> "_models.Secret": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + ) -> _models.Secret: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(secret, 'Secret') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(secret, (IO, bytes)): + _content = secret + else: + _json = self._serialize.body(secret, "Secret") - request = build_create_request_initial( + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, secret_name=secret_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Secret', pipeline_response) + deserialized = self._deserialize("Secret", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('Secret', pipeline_response) + deserialized = self._deserialize("Secret", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('Secret', pipeline_response) + deserialized = self._deserialize("Secret", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}"} # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + secret_name: str, + secret: _models.Secret, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param secret_name: Name of the Secret under the profile. Required. + :type secret_name: str + :param secret: The Secret properties. Required. + :type secret: ~azure.mgmt.cdn.models.Secret + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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 Secret or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Secret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + secret_name: str, + secret: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param secret_name: Name of the Secret under the profile. Required. + :type secret_name: str + :param secret: The Secret properties. Required. + :type secret: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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 Secret or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Secret] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -397,20 +501,23 @@ def begin_create( resource_group_name: str, profile_name: str, secret_name: str, - secret: "_models.Secret", + secret: Union[_models.Secret, IO], **kwargs: Any - ) -> LROPoller["_models.Secret"]: + ) -> LROPoller[_models.Secret]: """Creates a new Secret within the specified profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param secret_name: Name of the Secret under the profile. + :param secret_name: Name of the Secret under the profile. Required. :type secret_name: str - :param secret: The Secret properties. - :type secret: ~azure.mgmt.cdn.models.Secret + :param secret: The Secret properties. Is either a model type or a IO type. Required. + :type secret: ~azure.mgmt.cdn.models.Secret or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -421,104 +528,115 @@ def begin_create( 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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Secret] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, secret_name=secret_name, secret=secret, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Secret', pipeline_response) + deserialized = self._deserialize("Secret", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}"} # type: ignore - def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - secret_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( 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'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: str, - profile_name: str, - secret_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param secret_name: Name of the Secret under the profile. + :param secret_name: Name of the Secret under the profile. Required. :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. @@ -530,41 +648,48 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, secret_name=secret_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 88d7b6716d5e..f18b20d0a579 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,299 +6,292 @@ # 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, Iterable, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse 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.core.utils import case_insensitive_dict 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 -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _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 + resource_group_name: str, profile_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-06-01" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, - profile_name: str, - security_policy_name: str, - subscription_id: str, - **kwargs: Any + 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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, profile_name: str, security_policy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_patch_request( + resource_group_name: str, profile_name: str, security_policy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - 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}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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 + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_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" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}') + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}", + ) # pylint: disable=line-too-long 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'), + "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) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class SecurityPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`security_policies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_profile( - self, - resource_group_name: str, - profile_name: str, - **kwargs: Any - ) -> Iterable["_models.SecurityPolicyListResult"]: + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> Iterable["_models.SecurityPolicy"]: """Lists security policies associated with the profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :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.paging.ItemPaged[~azure.mgmt.cdn.models.SecurityPolicyListResult] - :raises: ~azure.core.exceptions.HttpResponseError + :return: An iterator like instance of either SecurityPolicy or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cdn.models.SecurityPolicy] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicyListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicyListResult] + error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + 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'], + api_version=api_version, + template_url=self.list_by_profile.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - 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, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -311,7 +305,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -321,52 +317,59 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list_by_profile.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies'} # type: ignore + 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: str, - profile_name: str, - security_policy_name: str, - **kwargs: Any - ) -> "_models.SecurityPolicy": + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param security_policy_name: Name of the security policy under the profile. + :param security_policy_name: Name of the security policy under the profile. Required. :type security_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityPolicy, or the result of cls(response) + :return: SecurityPolicy or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.SecurityPolicy - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicy"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicy] - 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'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -374,69 +377,166 @@ def get( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}"} # type: ignore def _create_initial( self, resource_group_name: str, profile_name: str, security_policy_name: str, - security_policy: "_models.SecurityPolicy", + security_policy: Union[_models.SecurityPolicy, IO], **kwargs: Any - ) -> "_models.SecurityPolicy": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicy"] + ) -> _models.SecurityPolicy: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(security_policy, 'SecurityPolicy') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicy] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_policy, (IO, bytes)): + _content = security_policy + else: + _json = self._serialize.body(security_policy, "SecurityPolicy") - request = build_create_request_initial( + request = build_create_request( resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata['url'], + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}"} # type: ignore + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy: _models.SecurityPolicy, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param security_policy_name: Name of the security policy under the profile. Required. + :type security_policy_name: str + :param security_policy: The security policy properties. Required. + :type security_policy: ~azure.mgmt.cdn.models.SecurityPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.SecurityPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param security_policy_name: Name of the security policy under the profile. Required. + :type security_policy_name: str + :param security_policy: The security policy properties. Required. + :type security_policy: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.SecurityPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_create( @@ -444,20 +544,24 @@ def begin_create( resource_group_name: str, profile_name: str, security_policy_name: str, - security_policy: "_models.SecurityPolicy", + security_policy: Union[_models.SecurityPolicy, IO], **kwargs: Any - ) -> LROPoller["_models.SecurityPolicy"]: + ) -> 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param security_policy_name: Name of the security policy under the profile. + :param security_policy_name: Name of the security policy under the profile. Required. :type security_policy_name: str - :param security_policy: The security policy properties. - :type security_policy: ~azure.mgmt.cdn.models.SecurityPolicy + :param security_policy: The security policy properties. Is either a model type or a IO type. + Required. + :type security_policy: ~azure.mgmt.cdn.models.SecurityPolicy or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -469,101 +573,205 @@ def begin_create( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicy] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, security_policy=security_policy, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}"} # type: ignore def _patch_initial( self, resource_group_name: str, profile_name: str, security_policy_name: str, - security_policy_update_properties: "_models.SecurityPolicyUpdateParameters", + security_policy_update_properties: Union[_models.SecurityPolicyUpdateParameters, IO], **kwargs: Any - ) -> "_models.SecurityPolicy": - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityPolicy"] + ) -> _models.SecurityPolicy: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicy] - _json = self._serialize.body(security_policy_update_properties, 'SecurityPolicyUpdateParameters') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_policy_update_properties, (IO, bytes)): + _content = security_policy_update_properties + else: + _json = self._serialize.body(security_policy_update_properties, "SecurityPolicyUpdateParameters") - request = build_patch_request_initial( + request = build_patch_request( resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self._patch_initial.metadata['url'], + content=_content, + template_url=self._patch_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}'} # type: ignore + _patch_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}"} # type: ignore + + @overload + def begin_patch( + self, + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy_update_properties: _models.SecurityPolicyUpdateParameters, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param security_policy_name: Name of the security policy under the profile. Required. + :type security_policy_name: str + :param security_policy_update_properties: Security policy update properties. Required. + :type security_policy_update_properties: ~azure.mgmt.cdn.models.SecurityPolicyUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.SecurityPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_patch( + self, + resource_group_name: str, + profile_name: str, + security_policy_name: str, + security_policy_update_properties: IO, + *, + content_type: str = "application/json", + **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. Required. + :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. Required. + :type profile_name: str + :param security_policy_name: Name of the security policy under the profile. Required. + :type security_policy_name: str + :param security_policy_update_properties: Security policy update properties. Required. + :type security_policy_update_properties: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.SecurityPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_patch( @@ -571,20 +779,25 @@ def begin_patch( resource_group_name: str, profile_name: str, security_policy_name: str, - security_policy_update_properties: "_models.SecurityPolicyUpdateParameters", + security_policy_update_properties: Union[_models.SecurityPolicyUpdateParameters, IO], **kwargs: Any - ) -> LROPoller["_models.SecurityPolicy"]: + ) -> LROPoller[_models.SecurityPolicy]: """Updates an existing security policy within a profile. - :param resource_group_name: Name of the Resource group within the Azure subscription. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param security_policy_name: Name of the security policy under the profile. + :param security_policy_name: Name of the security policy under the profile. Required. :type security_policy_name: str - :param security_policy_update_properties: Security policy update properties. + :param security_policy_update_properties: Security policy update properties. Is either a model + type or a IO type. Required. :type security_policy_update_properties: ~azure.mgmt.cdn.models.SecurityPolicyUpdateParameters + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this @@ -596,104 +809,115 @@ def begin_patch( :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: """ - 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', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityPolicy] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._patch_initial( + raw_result = self._patch_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, security_policy_update_properties=security_policy_update_properties, + api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('SecurityPolicy', pipeline_response) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_patch.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}"} # type: ignore - def _delete_initial( - self, - resource_group_name: str, - profile_name: str, - security_policy_name: str, - **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_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._delete_initial.metadata['url'], + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, 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 - + _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: str, - profile_name: str, - security_policy_name: str, - **kwargs: Any + self, 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. + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :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. + which is unique within the resource group. Required. :type profile_name: str - :param security_policy_name: Name of the security policy under the profile. + :param security_policy_name: Name of the security policy under the profile. Required. :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. @@ -705,41 +929,48 @@ def begin_delete( 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, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, - cls=lambda x,y,z: x, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - 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 polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, 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 + deserialization_callback=get_long_running_output, ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + 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 085a97de37cd..e7924848f6b8 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,123 +6,174 @@ # 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 typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict 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 +from .._serialization import Serializer +from .._vendor import MixinABC, _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_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" + +def build_secret_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - url = _format_url_section(url, **path_format_arguments) + _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') + _params["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. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.cdn.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ValidateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cdn.CdnManagementClient`'s + :attr:`validate` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace + @overload def secret( self, - validate_secret_input: "_models.ValidateSecretInput", + validate_secret_input: _models.ValidateSecretInput, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.ValidateSecretOutput": + ) -> _models.ValidateSecretOutput: """Validate a Secret in the profile. - :param validate_secret_input: The Secret source. + :param validate_secret_input: The Secret source. Required. :type validate_secret_input: ~azure.mgmt.cdn.models.ValidateSecretInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateSecretOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.ValidateSecretOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def secret( + self, validate_secret_input: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ValidateSecretOutput: + """Validate a Secret in the profile. + + :param validate_secret_input: The Secret source. Required. + :type validate_secret_input: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateSecretOutput, or the result of cls(response) + :return: ValidateSecretOutput or the result of cls(response) :rtype: ~azure.mgmt.cdn.models.ValidateSecretOutput - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def secret( + self, validate_secret_input: Union[_models.ValidateSecretInput, IO], **kwargs: Any + ) -> _models.ValidateSecretOutput: + """Validate a Secret in the profile. + + :param validate_secret_input: The Secret source. Is either a model type or a IO type. Required. + :type validate_secret_input: ~azure.mgmt.cdn.models.ValidateSecretInput or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateSecretOutput or the result of cls(response) + :rtype: ~azure.mgmt.cdn.models.ValidateSecretOutput + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateSecretOutput"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateSecretOutput] - _json = self._serialize.body(validate_secret_input, 'ValidateSecretInput') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_secret_input, (IO, bytes)): + _content = validate_secret_input + else: + _json = self._serialize.body(validate_secret_input, "ValidateSecretInput") request = build_secret_request( subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, - template_url=self.secret.metadata['url'], + content=_content, + template_url=self.secret.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -129,12 +181,11 @@ def secret( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ValidateSecretOutput', pipeline_response) + deserialized = self._deserialize("ValidateSecretOutput", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - secret.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret'} # type: ignore - + secret.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret"} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_create.py new file mode 100644 index 000000000000..023cd3b72c4b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_create.py @@ -0,0 +1,49 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_custom_domains_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_custom_domains.begin_create( + resource_group_name="RG", + profile_name="profile1", + custom_domain_name="domain1", + custom_domain={ + "properties": { + "azureDnsZone": {"id": ""}, + "hostName": "www.someDomain.net", + "tlsSettings": {"certificateType": "ManagedCertificate", "minimumTlsVersion": "TLS12"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDCustomDomains_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_delete.py new file mode 100644 index 000000000000..da4c86be5311 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_delete.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_custom_domains_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_custom_domains.begin_delete( + resource_group_name="RG", + profile_name="profile1", + custom_domain_name="domain1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDCustomDomains_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_get.py new file mode 100644 index 000000000000..0977c4c90a6b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_get.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_custom_domains_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_custom_domains.get( + resource_group_name="RG", + profile_name="profile1", + custom_domain_name="domain1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDCustomDomains_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_list_by_profile.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_list_by_profile.py new file mode 100644 index 000000000000..3a2059281ef1 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_list_by_profile.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_custom_domains_list_by_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_custom_domains.list_by_profile( + resource_group_name="RG", + profile_name="profile1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDCustomDomains_ListByProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_update.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_update.py new file mode 100644 index 000000000000..19e869599c05 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_update.py @@ -0,0 +1,48 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_custom_domains_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_custom_domains.begin_update( + resource_group_name="RG", + profile_name="profile1", + custom_domain_name="domain1", + custom_domain_update_properties={ + "properties": { + "azureDnsZone": {"id": ""}, + "tlsSettings": {"certificateType": "CustomerCertificate", "minimumTlsVersion": "TLS12"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDCustomDomains_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_create.py new file mode 100644 index 000000000000..178dc9965f2e --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_create.py @@ -0,0 +1,47 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_endpoints_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_endpoints.begin_create( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + endpoint={ + "location": "global", + "properties": {"autoGeneratedDomainNameLabelScope": "TenantReuse", "enabledState": "Enabled"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_delete.py new file mode 100644 index 000000000000..68da13cbb465 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_delete.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_endpoints_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_endpoints.begin_delete( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_get.py new file mode 100644 index 000000000000..5655f10e5e46 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_get.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_endpoints_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_endpoints.get( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_list_by_profile.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_list_by_profile.py new file mode 100644 index 000000000000..adc75199bb69 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_list_by_profile.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_endpoints_list_by_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_endpoints.list_by_profile( + resource_group_name="RG", + profile_name="profile1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_ListByProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_list_resource_usage.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_list_resource_usage.py new file mode 100644 index 000000000000..116b7f09d1f8 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_list_resource_usage.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_endpoints_list_resource_usage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_endpoints.list_resource_usage( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_ListResourceUsage.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_purge_content.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_purge_content.py new file mode 100644 index 000000000000..b7d47510b0c8 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_purge_content.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_endpoints_purge_content.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_endpoints.begin_purge_content( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + contents={"contentPaths": ["/folder1"], "domains": ["endpoint1-abcdefghijklmnop.z01.azurefd.net"]}, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_PurgeContent.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_update.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_update.py new file mode 100644 index 000000000000..de2a2d5fb9ef --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_update.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_endpoints_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_endpoints.begin_update( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + endpoint_update_properties={"properties": {"enabledState": "Enabled"}, "tags": {}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_create.py new file mode 100644 index 000000000000..af2745031c48 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_create.py @@ -0,0 +1,58 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origin_groups_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origin_groups.begin_create( + resource_group_name="RG", + profile_name="profile1", + origin_group_name="origingroup1", + origin_group={ + "properties": { + "healthProbeSettings": { + "probeIntervalInSeconds": 10, + "probePath": "/path2", + "probeProtocol": "NotSet", + "probeRequestType": "NotSet", + }, + "loadBalancingSettings": { + "additionalLatencyInMilliseconds": 1000, + "sampleSize": 3, + "successfulSamplesRequired": 3, + }, + "trafficRestorationTimeToHealedOrNewEndpointsInMinutes": 5, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_delete.py new file mode 100644 index 000000000000..b57642208832 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_delete.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origin_groups_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origin_groups.begin_delete( + resource_group_name="RG", + profile_name="profile1", + origin_group_name="origingroup1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_get.py new file mode 100644 index 000000000000..61c8a1ed11c6 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_get.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origin_groups_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origin_groups.get( + resource_group_name="RG", + profile_name="profile1", + origin_group_name="origingroup1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_list_by_profile.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_list_by_profile.py new file mode 100644 index 000000000000..06acb34bf8ae --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_list_by_profile.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origin_groups_list_by_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origin_groups.list_by_profile( + resource_group_name="RG", + profile_name="profile1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_ListByProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_list_resource_usage.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_list_resource_usage.py new file mode 100644 index 000000000000..9bd18407efc3 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_list_resource_usage.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origin_groups_list_resource_usage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origin_groups.list_resource_usage( + resource_group_name="RG", + profile_name="profile1", + origin_group_name="origingroup1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_ListResourceUsage.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_update.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_update.py new file mode 100644 index 000000000000..ec85dc7ecf3d --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origin_groups_update.py @@ -0,0 +1,58 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origin_groups_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origin_groups.begin_update( + resource_group_name="RG", + profile_name="profile1", + origin_group_name="origingroup1", + origin_group_update_properties={ + "properties": { + "healthProbeSettings": { + "probeIntervalInSeconds": 10, + "probePath": "/path2", + "probeProtocol": "NotSet", + "probeRequestType": "NotSet", + }, + "loadBalancingSettings": { + "additionalLatencyInMilliseconds": 1000, + "sampleSize": 3, + "successfulSamplesRequired": 3, + }, + "trafficRestorationTimeToHealedOrNewEndpointsInMinutes": 5, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_create.py new file mode 100644 index 000000000000..c0d1d0b1cc3e --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_create.py @@ -0,0 +1,52 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origins_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origins.begin_create( + resource_group_name="RG", + profile_name="profile1", + origin_group_name="origingroup1", + origin_name="origin1", + origin={ + "properties": { + "enabledState": "Enabled", + "hostName": "host1.blob.core.windows.net", + "httpPort": 80, + "httpsPort": 443, + "originHostHeader": "host1.foo.com", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOrigins_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_delete.py new file mode 100644 index 000000000000..def5310a1e92 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_delete.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origins_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origins.begin_delete( + resource_group_name="RG", + profile_name="profile1", + origin_group_name="origingroup1", + origin_name="origin1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOrigins_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_get.py new file mode 100644 index 000000000000..effe0479e809 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_get.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origins_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origins.get( + resource_group_name="RG", + profile_name="profile1", + origin_group_name="origingroup1", + origin_name="origin1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOrigins_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_list_by_origin_group.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_list_by_origin_group.py new file mode 100644 index 000000000000..d07d8c9b6d79 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_list_by_origin_group.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origins_list_by_origin_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origins.list_by_origin_group( + resource_group_name="RG", + profile_name="profile1", + origin_group_name="origingroup1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOrigins_ListByOriginGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_update.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_update.py new file mode 100644 index 000000000000..5d9d55075840 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_update.py @@ -0,0 +1,51 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_origins_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_origins.begin_update( + resource_group_name="RG", + profile_name="profile1", + origin_group_name="origingroup1", + origin_name="origin1", + origin_update_properties={ + "properties": { + "enabledState": "Enabled", + "hostName": "host1.blob.core.windows.net", + "httpPort": 80, + "httpsPort": 443, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOrigins_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_check_host_name_availability.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_check_host_name_availability.py new file mode 100644 index 000000000000..04553b0a14ee --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_check_host_name_availability.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_profiles_check_host_name_availability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_profiles.check_host_name_availability( + resource_group_name="RG", + profile_name="profile1", + check_host_name_availability_input={"hostName": "www.someDomain.net"}, + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDProfiles_CheckHostNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_list_resource_usage.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_list_resource_usage.py new file mode 100644 index 000000000000..39bcea08247b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_list_resource_usage.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python afd_profiles_list_resource_usage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_profiles.list_resource_usage( + resource_group_name="RG", + profile_name="profile1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDProfiles_ListResourceUsage.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/check_endpoint_name_availability.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/check_endpoint_name_availability.py new file mode 100644 index 000000000000..f62a3e337d2d --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/check_endpoint_name_availability.py @@ -0,0 +1,45 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python check_endpoint_name_availability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.check_endpoint_name_availability( + resource_group_name="myResourceGroup", + check_endpoint_name_availability_input={ + "autoGeneratedDomainNameLabelScope": "TenantReuse", + "name": "sampleName", + "type": "Microsoft.Cdn/Profiles/AfdEndpoints", + }, + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CheckEndpointNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/check_name_availability.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/check_name_availability.py new file mode 100644 index 000000000000..52eb072e398b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/check_name_availability.py @@ -0,0 +1,40 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python check_name_availability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.check_name_availability( + check_name_availability_input={"name": "sampleName", "type": "Microsoft.Cdn/Profiles/Endpoints"}, + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CheckNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/check_name_availability_with_subscription.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/check_name_availability_with_subscription.py new file mode 100644 index 000000000000..73024f935714 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/check_name_availability_with_subscription.py @@ -0,0 +1,40 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python check_name_availability_with_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.check_name_availability_with_subscription( + check_name_availability_input={"name": "sampleName", "type": "Microsoft.Cdn/Profiles/Endpoints"}, + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CheckNameAvailabilityWithSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/creates_specific_policy.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/creates_specific_policy.py new file mode 100644 index 000000000000..ac3ff54f4b2c --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/creates_specific_policy.py @@ -0,0 +1,127 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python creates_specific_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.policies.begin_create_or_update( + resource_group_name="rg1", + policy_name="MicrosoftCdnWafPolicy", + cdn_web_application_firewall_policy={ + "location": "WestUs", + "properties": { + "customRules": { + "rules": [ + { + "action": "Block", + "enabledState": "Enabled", + "matchConditions": [ + { + "matchValue": ["CH"], + "matchVariable": "RemoteAddr", + "negateCondition": False, + "operator": "GeoMatch", + "selector": None, + "transforms": [], + }, + { + "matchValue": ["windows"], + "matchVariable": "RequestHeader", + "negateCondition": False, + "operator": "Contains", + "selector": "UserAgent", + "transforms": [], + }, + { + "matchValue": [""], + "matchVariable": "QueryString", + "negateCondition": False, + "operator": "Contains", + "selector": "search", + "transforms": ["UrlDecode", "Lowercase"], + }, + ], + "name": "CustomRule1", + "priority": 2, + } + ] + }, + "managedRules": { + "managedRuleSets": [ + { + "ruleGroupOverrides": [ + { + "ruleGroupName": "Group1", + "rules": [ + {"action": "Redirect", "enabledState": "Enabled", "ruleId": "GROUP1-0001"}, + {"enabledState": "Disabled", "ruleId": "GROUP1-0002"}, + ], + } + ], + "ruleSetType": "DefaultRuleSet", + "ruleSetVersion": "preview-1.0", + } + ] + }, + "policySettings": { + "defaultCustomBlockResponseBody": "PGh0bWw+CjxoZWFkZXI+PHRpdGxlPkhlbGxvPC90aXRsZT48L2hlYWRlcj4KPGJvZHk+CkhlbGxvIHdvcmxkCjwvYm9keT4KPC9odG1sPg==", + "defaultCustomBlockResponseStatusCode": 200, + "defaultRedirectUrl": "http://www.bing.com", + }, + "rateLimitRules": { + "rules": [ + { + "action": "Block", + "enabledState": "Enabled", + "matchConditions": [ + { + "matchValue": ["192.168.1.0/24", "10.0.0.0/24"], + "matchVariable": "RemoteAddr", + "negateCondition": False, + "operator": "IPMatch", + "selector": None, + "transforms": [], + } + ], + "name": "RateLimitRule1", + "priority": 1, + "rateLimitDurationInMinutes": 0, + "rateLimitThreshold": 1000, + } + ] + }, + }, + "sku": {"name": "Standard_Microsoft"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/WafPolicyCreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_create.py new file mode 100644 index 000000000000..69b1b2ceca59 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_create.py @@ -0,0 +1,44 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python custom_domains_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.custom_domains.begin_create( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + custom_domain_name="www-someDomain-net", + custom_domain_properties={"properties": {"hostName": "www.someDomain.net"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_delete.py new file mode 100644 index 000000000000..a6329d05e663 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_delete.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python custom_domains_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.custom_domains.begin_delete( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + custom_domain_name="www-someDomain-net", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_disable_custom_https.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_disable_custom_https.py new file mode 100644 index 000000000000..d3195e38a25c --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_disable_custom_https.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python custom_domains_disable_custom_https.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.custom_domains.begin_disable_custom_https( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + custom_domain_name="www-someDomain-net", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_DisableCustomHttps.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_enable_custom_https_using_cdn_managed_certificate.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_enable_custom_https_using_cdn_managed_certificate.py new file mode 100644 index 000000000000..19d4bf970b62 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_enable_custom_https_using_cdn_managed_certificate.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python custom_domains_enable_custom_https_using_cdn_managed_certificate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.custom_domains.begin_enable_custom_https( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + custom_domain_name="www-someDomain-net", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_EnableCustomHttpsUsingCDNManagedCertificate.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_enable_custom_https_using_your_own_certificate.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_enable_custom_https_using_your_own_certificate.py new file mode 100644 index 000000000000..1b936658e1d9 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_enable_custom_https_using_your_own_certificate.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python custom_domains_enable_custom_https_using_your_own_certificate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.custom_domains.begin_enable_custom_https( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + custom_domain_name="www-someDomain-net", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_EnableCustomHttpsUsingBYOC.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_get.py new file mode 100644 index 000000000000..5abe71bb343a --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_get.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python custom_domains_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.custom_domains.get( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + custom_domain_name="www-someDomain-net", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_list_by_endpoint.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_list_by_endpoint.py new file mode 100644 index 000000000000..eccfbe2719b5 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_list_by_endpoint.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python custom_domains_list_by_endpoint.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.custom_domains.list_by_endpoint( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_ListByEndpoint.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/delete_protection_policy.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/delete_protection_policy.py new file mode 100644 index 000000000000..12689bfa9c44 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/delete_protection_policy.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python delete_protection_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.policies.delete( + resource_group_name="rg1", + policy_name="Policy1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/WafPolicyDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/edge_nodes_list.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/edge_nodes_list.py new file mode 100644 index 000000000000..f62585f71612 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/edge_nodes_list.py @@ -0,0 +1,39 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python edge_nodes_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.edge_nodes.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/EdgeNodes_List.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_create.py new file mode 100644 index 000000000000..5f14a5a94ece --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_create.py @@ -0,0 +1,158 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.endpoints.begin_create( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + endpoint={ + "location": "WestUs", + "properties": { + "contentTypesToCompress": ["text/html", "application/octet-stream"], + "defaultOriginGroup": { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/endpoints/endpoint1/originGroups/originGroup1" + }, + "deliveryPolicy": { + "description": "Test description for a policy.", + "rules": [ + { + "actions": [ + { + "name": "CacheExpiration", + "parameters": { + "cacheBehavior": "Override", + "cacheDuration": "10:10:09", + "cacheType": "All", + "typeName": "DeliveryRuleCacheExpirationActionParameters", + }, + }, + { + "name": "ModifyResponseHeader", + "parameters": { + "headerAction": "Overwrite", + "headerName": "Access-Control-Allow-Origin", + "typeName": "DeliveryRuleHeaderActionParameters", + "value": "*", + }, + }, + { + "name": "ModifyRequestHeader", + "parameters": { + "headerAction": "Overwrite", + "headerName": "Accept-Encoding", + "typeName": "DeliveryRuleHeaderActionParameters", + "value": "gzip", + }, + }, + ], + "conditions": [ + { + "name": "RemoteAddress", + "parameters": { + "matchValues": ["192.168.1.0/24", "10.0.0.0/24"], + "negateCondition": True, + "operator": "IPMatch", + "typeName": "DeliveryRuleRemoteAddressConditionParameters", + }, + } + ], + "name": "rule1", + "order": 1, + } + ], + }, + "isCompressionEnabled": True, + "isHttpAllowed": True, + "isHttpsAllowed": True, + "originGroups": [ + { + "name": "originGroup1", + "properties": { + "healthProbeSettings": { + "probeIntervalInSeconds": 120, + "probePath": "/health.aspx", + "probeProtocol": "Http", + "probeRequestType": "GET", + }, + "origins": [ + { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/endpoints/endpoint1/origins/origin1" + }, + { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/endpoints/endpoint1/origins/origin2" + }, + ], + "responseBasedOriginErrorDetectionSettings": { + "responseBasedDetectedErrorTypes": "TcpErrorsOnly", + "responseBasedFailoverThresholdPercentage": 10, + }, + }, + } + ], + "originHostHeader": "www.bing.com", + "originPath": "/photos", + "origins": [ + { + "name": "origin1", + "properties": { + "enabled": True, + "hostName": "www.someDomain1.net", + "httpPort": 80, + "httpsPort": 443, + "originHostHeader": "www.someDomain1.net", + "priority": 1, + "weight": 50, + }, + }, + { + "name": "origin2", + "properties": { + "enabled": True, + "hostName": "www.someDomain2.net", + "httpPort": 80, + "httpsPort": 443, + "originHostHeader": "www.someDomain2.net", + "priority": 2, + "weight": 50, + }, + }, + ], + "queryStringCachingBehavior": "BypassCaching", + }, + "tags": {"key1": "value1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_delete.py new file mode 100644 index 000000000000..fd412dc443c5 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_delete.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.endpoints.begin_delete( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_get.py new file mode 100644 index 000000000000..43bbe80352ee --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_get.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.endpoints.get( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_list_by_profile.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_list_by_profile.py new file mode 100644 index 000000000000..450791ffc953 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_list_by_profile.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_list_by_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.endpoints.list_by_profile( + resource_group_name="RG", + profile_name="profile1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_ListByProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_list_resource_usage.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_list_resource_usage.py new file mode 100644 index 000000000000..4df4cdca72f1 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_list_resource_usage.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_list_resource_usage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.endpoints.list_resource_usage( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_ListResourceUsage.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_load_content.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_load_content.py new file mode 100644 index 000000000000..1cd586daa074 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_load_content.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_load_content.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.endpoints.begin_load_content( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + content_file_paths={"contentPaths": ["/folder1"]}, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_LoadContent.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_purge_content.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_purge_content.py new file mode 100644 index 000000000000..cf356f689a23 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_purge_content.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_purge_content.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.endpoints.begin_purge_content( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + content_file_paths={"contentPaths": ["/folder1"]}, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_PurgeContent.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_start.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_start.py new file mode 100644 index 000000000000..c89ae1aef22c --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_start.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_start.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.endpoints.begin_start( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Start.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_stop.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_stop.py new file mode 100644 index 000000000000..7aa0592246ec --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_stop.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_stop.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.endpoints.begin_stop( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Stop.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_update.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_update.py new file mode 100644 index 000000000000..6b45fcaa0169 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_update.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.endpoints.begin_update( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + endpoint_update_properties={"tags": {"additionalProperties": "Tag1"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_validate_custom_domain.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_validate_custom_domain.py new file mode 100644 index 000000000000..326ca6f8e89f --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_validate_custom_domain.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python endpoints_validate_custom_domain.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.afd_endpoints.validate_custom_domain( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + custom_domain_properties={"hostName": "www.someDomain.com"}, + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_ValidateCustomDomain.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/get_policy.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/get_policy.py new file mode 100644 index 000000000000..a9c908a83ad9 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/get_policy.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python get_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.policies.get( + resource_group_name="rg1", + policy_name="MicrosoftCdnWafPolicy", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/WafPolicyGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/list_policies_in_a_resource_group.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/list_policies_in_a_resource_group.py new file mode 100644 index 000000000000..d36afb5f7557 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/list_policies_in_a_resource_group.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python list_policies_in_a_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.policies.list( + resource_group_name="rg1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/WafListPolicies.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_locations.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_locations.py new file mode 100644 index 000000000000..5da45693d6c8 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_locations.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python log_analytics_get_log_analytics_locations.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.log_analytics.get_log_analytics_locations( + resource_group_name="RG", + profile_name="profile1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/LogAnalytics_GetLogAnalyticsLocations.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_metrics.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_metrics.py new file mode 100644 index 000000000000..49a7af9c1525 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_metrics.py @@ -0,0 +1,47 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python log_analytics_get_log_analytics_metrics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.log_analytics.get_log_analytics_metrics( + resource_group_name="RG", + profile_name="profile1", + metrics=["clientRequestCount"], + date_time_begin="2020-11-04T04:30:00.000Z", + date_time_end="2020-11-04T05:00:00.000Z", + granularity="PT5M", + custom_domains=["customdomain1.azurecdn.net", "customdomain2.azurecdn.net"], + protocols=["https"], + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/LogAnalytics_GetLogAnalyticsMetrics.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_rankings.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_rankings.py new file mode 100644 index 000000000000..cad527c35c50 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_rankings.py @@ -0,0 +1,46 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python log_analytics_get_log_analytics_rankings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.log_analytics.get_log_analytics_rankings( + resource_group_name="RG", + profile_name="profile1", + rankings=["url"], + metrics=["clientRequestCount"], + max_ranking="5", + date_time_begin="2020-11-04T06:49:27.554Z", + date_time_end="2020-11-04T09:49:27.554Z", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/LogAnalytics_GetLogAnalyticsRankings.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_resources.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_resources.py new file mode 100644 index 000000000000..c71e49b2be17 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_log_analytics_resources.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python log_analytics_get_log_analytics_resources.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.log_analytics.get_log_analytics_resources( + resource_group_name="RG", + profile_name="profile1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/LogAnalytics_GetLogAnalyticsResources.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_waf_log_analytics_metrics.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_waf_log_analytics_metrics.py new file mode 100644 index 000000000000..e24eb5f97da1 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_waf_log_analytics_metrics.py @@ -0,0 +1,45 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python log_analytics_get_waf_log_analytics_metrics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.log_analytics.get_waf_log_analytics_metrics( + resource_group_name="RG", + profile_name="profile1", + metrics=["clientRequestCount"], + date_time_begin="2020-11-04T06:49:27.554Z", + date_time_end="2020-11-04T09:49:27.554Z", + granularity="PT5M", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/LogAnalytics_GetWafLogAnalyticsMetrics.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_waf_log_analytics_rankings.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_waf_log_analytics_rankings.py new file mode 100644 index 000000000000..ce002312ad38 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/log_analytics_get_waf_log_analytics_rankings.py @@ -0,0 +1,46 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python log_analytics_get_waf_log_analytics_rankings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.log_analytics.get_waf_log_analytics_rankings( + resource_group_name="RG", + profile_name="profile1", + metrics=["clientRequestCount"], + date_time_begin="2020-11-04T06:49:27.554Z", + date_time_end="2020-11-04T09:49:27.554Z", + max_ranking="5", + rankings=["ruleId"], + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/LogAnalytics_GetWafLogAnalyticsRankings.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/operations_list.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/operations_list.py new file mode 100644 index 000000000000..4711701b0748 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/operations_list.py @@ -0,0 +1,39 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python operations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Operations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_create.py new file mode 100644 index 000000000000..858d1bdf9897 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_create.py @@ -0,0 +1,62 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python origin_groups_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.origin_groups.begin_create( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + origin_group_name="origingroup1", + origin_group={ + "properties": { + "healthProbeSettings": { + "probeIntervalInSeconds": 120, + "probePath": "/health.aspx", + "probeProtocol": "Http", + "probeRequestType": "GET", + }, + "origins": [ + { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/endpoints/endpoint1/origins/origin1" + } + ], + "responseBasedOriginErrorDetectionSettings": { + "responseBasedDetectedErrorTypes": "TcpErrorsOnly", + "responseBasedFailoverThresholdPercentage": 10, + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/OriginGroups_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_delete.py new file mode 100644 index 000000000000..c67395df21c7 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_delete.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python origin_groups_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.origin_groups.begin_delete( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + origin_group_name="originGroup1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/OriginGroups_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_get.py new file mode 100644 index 000000000000..a2386c975d56 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_get.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python origin_groups_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.origin_groups.get( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + origin_group_name="originGroup1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/OriginGroups_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_update.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_update.py new file mode 100644 index 000000000000..7a4ecaf20a6a --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_update.py @@ -0,0 +1,58 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python origin_groups_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.origin_groups.begin_update( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + origin_group_name="originGroup1", + origin_group_update_properties={ + "properties": { + "healthProbeSettings": { + "probeIntervalInSeconds": 120, + "probePath": "/health.aspx", + "probeProtocol": "Http", + "probeRequestType": "GET", + }, + "origins": [ + { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/endpoints/endpoint1/origins/origin2" + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/OriginGroups_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_create.py new file mode 100644 index 000000000000..a4edaeb2fc58 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_create.py @@ -0,0 +1,57 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python origins_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.origins.begin_create( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + origin_name="www-someDomain-net", + origin={ + "properties": { + "enabled": True, + "hostName": "www.someDomain.net", + "httpPort": 80, + "httpsPort": 443, + "originHostHeader": "www.someDomain.net", + "priority": 1, + "privateLinkApprovalMessage": "Please approve the connection request for this Private Link", + "privateLinkLocation": "eastus", + "privateLinkResourceId": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Network/privateLinkServices/pls1", + "weight": 50, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Origins_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_delete.py new file mode 100644 index 000000000000..7eae43178657 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_delete.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python origins_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.origins.begin_delete( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + origin_name="origin1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Origins_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_get.py new file mode 100644 index 000000000000..4fd90004ad9f --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_get.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python origins_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.origins.get( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + origin_name="www-someDomain-net", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Origins_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_groups_list_by_endpoint.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_groups_list_by_endpoint.py new file mode 100644 index 000000000000..545b4b994eeb --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_groups_list_by_endpoint.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python origins_groups_list_by_endpoint.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.origin_groups.list_by_endpoint( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/OriginGroups_ListByEndpoint.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_list_by_endpoint.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_list_by_endpoint.py new file mode 100644 index 000000000000..2a0a52118f5c --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_list_by_endpoint.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python origins_list_by_endpoint.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.origins.list_by_endpoint( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Origins_ListByEndpoint.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_update.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_update.py new file mode 100644 index 000000000000..c91cbf2f3737 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_update.py @@ -0,0 +1,54 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python origins_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.origins.begin_update( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + origin_name="www-someDomain-net", + origin_update_properties={ + "properties": { + "enabled": True, + "httpPort": 42, + "httpsPort": 43, + "originHostHeader": "www.someDomain2.net", + "priority": 1, + "privateLinkAlias": "APPSERVER.d84e61f0-0870-4d24-9746-7438fa0019d1.westus2.azure.privatelinkservice", + "weight": 50, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Origins_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_create.py new file mode 100644 index 000000000000..31cf98ab3157 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_create.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python profiles_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.profiles.begin_create( + resource_group_name="RG", + profile_name="profile1", + profile={"location": "global", "sku": {"name": "Premium_AzureFrontDoor"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_delete.py new file mode 100644 index 000000000000..32a63feba2f9 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_delete.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python profiles_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.profiles.begin_delete( + resource_group_name="RG", + profile_name="profile1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_generate_sso_uri.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_generate_sso_uri.py new file mode 100644 index 000000000000..5dadc8860e3f --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_generate_sso_uri.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python profiles_generate_sso_uri.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.profiles.generate_sso_uri( + resource_group_name="RG", + profile_name="profile1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_GenerateSsoUri.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_get.py new file mode 100644 index 000000000000..cc68245f49e6 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_get.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python profiles_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.profiles.get( + resource_group_name="RG", + profile_name="profile1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list.py new file mode 100644 index 000000000000..5fd0cc68eea1 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list.py @@ -0,0 +1,39 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python profiles_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.profiles.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_List.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list_by_resource_group.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list_by_resource_group.py new file mode 100644 index 000000000000..9b7579d5f6f9 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list_by_resource_group.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python profiles_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.profiles.list_by_resource_group( + resource_group_name="RG", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list_resource_usage.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list_resource_usage.py new file mode 100644 index 000000000000..00759b40cf31 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list_resource_usage.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python profiles_list_resource_usage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.profiles.list_resource_usage( + resource_group_name="RG", + profile_name="profile1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_ListResourceUsage.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list_supported_optimization_types.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list_supported_optimization_types.py new file mode 100644 index 000000000000..bebdd3153864 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list_supported_optimization_types.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python profiles_list_supported_optimization_types.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.profiles.list_supported_optimization_types( + resource_group_name="RG", + profile_name="profile1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_ListSupportedOptimizationTypes.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_update.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_update.py new file mode 100644 index 000000000000..fd3b6e336027 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_update.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python profiles_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.profiles.begin_update( + resource_group_name="RG", + profile_name="profile1", + profile_update_parameters={"tags": {"additionalProperties": "Tag1"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/resource_usage_list.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/resource_usage_list.py new file mode 100644 index 000000000000..d94b03c920fc --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/resource_usage_list.py @@ -0,0 +1,39 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python resource_usage_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.resource_usage.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/ResourceUsage_List.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_create.py new file mode 100644 index 000000000000..f9b6b18ce3f0 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_create.py @@ -0,0 +1,75 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python routes_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.routes.begin_create( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + route_name="route1", + route={ + "properties": { + "cacheConfiguration": { + "compressionSettings": { + "contentTypesToCompress": ["text/html", "application/octet-stream"], + "isCompressionEnabled": True, + }, + "queryParameters": "querystring=test", + "queryStringCachingBehavior": "IgnoreSpecifiedQueryStrings", + }, + "customDomains": [ + { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/customDomains/domain1" + } + ], + "enabledState": "Enabled", + "forwardingProtocol": "MatchRequest", + "httpsRedirect": "Enabled", + "linkToDefaultDomain": "Enabled", + "originGroup": { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/originGroups/originGroup1" + }, + "originPath": None, + "patternsToMatch": ["/*"], + "ruleSets": [ + { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/ruleSets/ruleSet1" + } + ], + "supportedProtocols": ["Https", "Http"], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Routes_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_delete.py new file mode 100644 index 000000000000..3a80e2afec95 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_delete.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python routes_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.routes.begin_delete( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + route_name="route1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Routes_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_get.py new file mode 100644 index 000000000000..29c0adadb185 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_get.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python routes_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.routes.get( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + route_name="route1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Routes_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_list_by_endpoint.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_list_by_endpoint.py new file mode 100644 index 000000000000..c8c84acfc14e --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_list_by_endpoint.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python routes_list_by_endpoint.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.routes.list_by_endpoint( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Routes_ListByEndpoint.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_update.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_update.py new file mode 100644 index 000000000000..1820bb807035 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_update.py @@ -0,0 +1,74 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python routes_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.routes.begin_update( + resource_group_name="RG", + profile_name="profile1", + endpoint_name="endpoint1", + route_name="route1", + route_update_properties={ + "properties": { + "cacheConfiguration": { + "compressionSettings": { + "contentTypesToCompress": ["text/html", "application/octet-stream"], + "isCompressionEnabled": True, + }, + "queryStringCachingBehavior": "IgnoreQueryString", + }, + "customDomains": [ + { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/customDomains/domain1" + } + ], + "enabledState": "Enabled", + "forwardingProtocol": "MatchRequest", + "httpsRedirect": "Enabled", + "linkToDefaultDomain": "Enabled", + "originGroup": { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/originGroups/originGroup1" + }, + "originPath": None, + "patternsToMatch": ["/*"], + "ruleSets": [ + { + "id": "/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/ruleSets/ruleSet1" + } + ], + "supportedProtocols": ["Https", "Http"], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Routes_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_create.py new file mode 100644 index 000000000000..5df1a35afe52 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_create.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python rule_sets_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.rule_sets.create( + resource_group_name="RG", + profile_name="profile1", + rule_set_name="ruleSet1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/RuleSets_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_delete.py new file mode 100644 index 000000000000..fe82ecf3d2cd --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_delete.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python rule_sets_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.rule_sets.begin_delete( + resource_group_name="RG", + profile_name="profile1", + rule_set_name="ruleSet1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/RuleSets_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_get.py new file mode 100644 index 000000000000..77b289949d3d --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_get.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python rule_sets_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.rule_sets.get( + resource_group_name="RG", + profile_name="profile1", + rule_set_name="ruleSet1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/RuleSets_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_list_by_profile.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_list_by_profile.py new file mode 100644 index 000000000000..3f73bba2cd64 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_list_by_profile.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python rule_sets_list_by_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.rule_sets.list_by_profile( + resource_group_name="RG", + profile_name="profile1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/RuleSets_ListByProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_list_resource_usage.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_list_resource_usage.py new file mode 100644 index 000000000000..2ae1c4471680 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_list_resource_usage.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python rule_sets_list_resource_usage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.rule_sets.list_resource_usage( + resource_group_name="RG", + profile_name="profile1", + rule_set_name="ruleSet1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/RuleSets_ListResourceUsage.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_create.py new file mode 100644 index 000000000000..77c329e77987 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_create.py @@ -0,0 +1,70 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python rules_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.rules.begin_create( + resource_group_name="RG", + profile_name="profile1", + rule_set_name="ruleSet1", + rule_name="rule1", + rule={ + "properties": { + "actions": [ + { + "name": "ModifyResponseHeader", + "parameters": { + "headerAction": "Overwrite", + "headerName": "X-CDN", + "typeName": "DeliveryRuleHeaderActionParameters", + "value": "MSFT", + }, + } + ], + "conditions": [ + { + "name": "RequestMethod", + "parameters": { + "matchValues": ["GET"], + "negateCondition": False, + "operator": "Equal", + "typeName": "DeliveryRuleRequestMethodConditionParameters", + }, + } + ], + "order": 1, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Rules_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_delete.py new file mode 100644 index 000000000000..783849c0779f --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_delete.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.rules.begin_delete( + resource_group_name="RG", + profile_name="profile1", + rule_set_name="ruleSet1", + rule_name="rule1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Rules_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_get.py new file mode 100644 index 000000000000..9cc5154c4318 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_get.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.rules.get( + resource_group_name="RG", + profile_name="profile1", + rule_set_name="ruleSet1", + rule_name="rule1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Rules_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_list_by_rule_set.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_list_by_rule_set.py new file mode 100644 index 000000000000..0aa47e09312b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_list_by_rule_set.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python rules_list_by_rule_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.rules.list_by_rule_set( + resource_group_name="RG", + profile_name="profile1", + rule_set_name="ruleSet1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Rules_ListByRuleSet.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_update.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_update.py new file mode 100644 index 000000000000..d7038993ac20 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_update.py @@ -0,0 +1,59 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python rules_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.rules.begin_update( + resource_group_name="RG", + profile_name="profile1", + rule_set_name="ruleSet1", + rule_name="rule1", + rule_update_properties={ + "properties": { + "actions": [ + { + "name": "ModifyResponseHeader", + "parameters": { + "headerAction": "Overwrite", + "headerName": "X-CDN", + "typeName": "DeliveryRuleHeaderActionParameters", + "value": "MSFT", + }, + } + ], + "order": 1, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Rules_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_create.py new file mode 100644 index 000000000000..adc452f54e53 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_create.py @@ -0,0 +1,54 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python secrets_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.secrets.begin_create( + resource_group_name="RG", + profile_name="profile1", + secret_name="secret1", + secret={ + "properties": { + "parameters": { + "secretSource": { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.KeyVault/vault/kvName/secrets/certificatename" + }, + "secretVersion": "abcdef1234578900abcdef1234567890", + "type": "CustomerCertificate", + "useLatestVersion": False, + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Secrets_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_delete.py new file mode 100644 index 000000000000..c8c405beab8b --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_delete.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python secrets_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.secrets.begin_delete( + resource_group_name="RG", + profile_name="profile1", + secret_name="secret1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Secrets_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_get.py new file mode 100644 index 000000000000..772c7307e7a2 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_get.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python secrets_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.secrets.get( + resource_group_name="RG", + profile_name="profile1", + secret_name="secret1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Secrets_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_list_by_profile.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_list_by_profile.py new file mode 100644 index 000000000000..a59803006ee1 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_list_by_profile.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python secrets_list_by_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.secrets.list_by_profile( + resource_group_name="RG", + profile_name="profile1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Secrets_ListByProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_create.py new file mode 100644 index 000000000000..769c06d5c022 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_create.py @@ -0,0 +1,65 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python security_policies_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.security_policies.begin_create( + resource_group_name="RG", + profile_name="profile1", + security_policy_name="securityPolicy1", + security_policy={ + "properties": { + "parameters": { + "associations": [ + { + "domains": [ + { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/customdomains/testdomain1" + }, + { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/customdomains/testdomain2" + }, + ], + "patternsToMatch": ["/*"], + } + ], + "type": "WebApplicationFirewall", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/wafTest" + }, + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/SecurityPolicies_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_delete.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_delete.py new file mode 100644 index 000000000000..a1a5744376c9 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_delete.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python security_policies_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.security_policies.begin_delete( + resource_group_name="RG", + profile_name="profile1", + security_policy_name="securityPolicy1", + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/SecurityPolicies_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_get.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_get.py new file mode 100644 index 000000000000..20a9de1a9397 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_get.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python security_policies_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.security_policies.get( + resource_group_name="RG", + profile_name="profile1", + security_policy_name="securityPolicy1", + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/SecurityPolicies_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_list_by_profile.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_list_by_profile.py new file mode 100644 index 000000000000..85788f39502d --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_list_by_profile.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python security_policies_list_by_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.security_policies.list_by_profile( + resource_group_name="RG", + profile_name="profile1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/SecurityPolicies_ListByProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_patch.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_patch.py new file mode 100644 index 000000000000..34a9758bbf1d --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_patch.py @@ -0,0 +1,65 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python security_policies_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.security_policies.begin_patch( + resource_group_name="RG", + profile_name="profile1", + security_policy_name="securityPolicy1", + security_policy_update_properties={ + "properties": { + "parameters": { + "associations": [ + { + "domains": [ + { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/customdomains/testdomain1" + }, + { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/customdomains/testdomain2" + }, + ], + "patternsToMatch": ["/*"], + } + ], + "type": "WebApplicationFirewall", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/wafTest" + }, + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/SecurityPolicies_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/validate_probe.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/validate_probe.py new file mode 100644 index 000000000000..3618f68faf76 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/validate_probe.py @@ -0,0 +1,40 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python validate_probe.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.validate_probe( + validate_probe_input={"probeURL": "https://www.bing.com/image"}, + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/ValidateProbe.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/validate_secret.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/validate_secret.py new file mode 100644 index 000000000000..0074220f2b98 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/validate_secret.py @@ -0,0 +1,45 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.cdn import CdnManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cdn +# USAGE + python validate_secret.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CdnManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.validate.secret( + validate_secret_input={ + "secretSource": { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.KeyVault/vault/kvName/certificate/certName" + }, + "secretType": "CustomerCertificate", + }, + ) + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Validate_Secret.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/tests/recordings/test_cli_mgmt_cdn.pyTestMgmtCdntest_cdn.json b/sdk/cdn/azure-mgmt-cdn/tests/recordings/test_cli_mgmt_cdn.pyTestMgmtCdntest_cdn.json index 5ba8b1b1cb5f..ae616c1f7672 100644 --- a/sdk/cdn/azure-mgmt-cdn/tests/recordings/test_cli_mgmt_cdn.pyTestMgmtCdntest_cdn.json +++ b/sdk/cdn/azure-mgmt-cdn/tests/recordings/test_cli_mgmt_cdn.pyTestMgmtCdntest_cdn.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.9.0b2 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0b3 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,13 +17,13 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:08:09 GMT", + "Date": "Fri, 21 Oct 2022 05:31:11 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.12529.19 - NCUS ProdSlices", - "x-ms-request-id": "d25d1a51-a1b3-48d0-b981-42167b644900" + "x-ms-ests-server": "2.1.13943.8 - SCUS ProdSlices", + "X-XSS-Protection": "0" }, "ResponseBody": { "token_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token", @@ -86,7 +86,7 @@ "email" ], "kerberos_endpoint": "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/kerberos", - "tenant_region_scope": "NA", + "tenant_region_scope": "WW", "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.9.0b2 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.12.0b3 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,13 +111,13 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:08:09 GMT", + "Date": "Fri, 21 Oct 2022 05:31:11 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.12559.10 - WUS2 ProdSlices", - "x-ms-request-id": "e1dec507-82f8-467b-b5be-dad28c222800" + "x-ms-ests-server": "2.1.13943.8 - NCUS ProdSlices", + "X-XSS-Protection": "0" }, "ResponseBody": { "tenant_discovery_endpoint": "https://login.microsoftonline.com/common/.well-known/openid-configuration", @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "d2dee3d1-fc65-4132-b44f-28d8d357b0f3", + "client-request-id": "1718cf45-3ec9-4b6f-953c-0e1854ce8add", "Connection": "keep-alive", - "Content-Length": "286", + "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.9.0b2 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.12.0b3 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.17.0", + "x-client-ver": "1.20.0", "x-ms-lib-capability": "retry-after, h429" }, - "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=o0XWF_siD-FhI.5AE83-u0GaQHW_GP7cjy\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", + "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "d2dee3d1-fc65-4132-b44f-28d8d357b0f3", - "Content-Length": "93", + "client-request-id": "1718cf45-3ec9-4b6f-953c-0e1854ce8add", + "Content-Length": "114", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:08:09 GMT", + "Date": "Fri, 21 Oct 2022 05:31:11 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,13 +201,14 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.12559.10 - WUS2 ProdSlices", - "x-ms-request-id": "e0ba6272-4e12-4e3c-8720-2e0efa941e00" + "x-ms-ests-server": "2.1.13943.8 - EUS ProdSlices", + "X-XSS-Protection": "0" }, "ResponseBody": { "token_type": "Bearer", - "expires_in": 3599, - "ext_expires_in": 3599, + "expires_in": 86399, + "ext_expires_in": 86399, + "refresh_in": 43199, "access_token": "access_token" } }, @@ -217,12 +218,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "59", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "WestUs", @@ -230,130 +229,11725 @@ "name": "Standard_Verizon" } }, - "StatusCode": 201, + "StatusCode": 409, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/d4e04cad-9b04-4fad-9fad-1a9c7a3280e9?api-version=2021-06-01", "Cache-Control": "no-cache", - "Content-Length": "348", + "Content-Length": "430", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:08:11 GMT", + "Date": "Fri, 21 Oct 2022 05:31:12 GMT", "Expires": "-1", "Pragma": "no-cache", - "Retry-After": "10", - "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "6b331bf8-b13e-4732-9819-043d5f49b958", - "x-ms-ratelimit-remaining-subscription-resource-requests": "24", - "x-ms-request-id": "16f2ed63-10ce-4860-a5ee-027c05665f03", - "x-ms-routing-request-id": "EASTUS2:20220317T020811Z:6b331bf8-b13e-4732-9819-043d5f49b958" + "x-ms-correlation-request-id": "55a7166e-800b-412d-9897-f07aa61e385c", + "x-ms-failure-cause": "gateway", + "x-ms-routing-request-id": "WESTUS:20221021T053113Z:55a7166e-800b-412d-9897-f07aa61e385c" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename", - "type": "Microsoft.Cdn/profiles", - "name": "profilename", - "location": "WestUs", - "kind": "cdn", - "tags": {}, - "sku": { - "name": "Standard_Verizon" - }, - "properties": { - "resourceState": "Creating", - "identity": null, - "provisioningState": "Creating" + "error": { + "code": "MissingSubscriptionRegistration", + "message": "The subscription is not registered to use namespace \u0027Microsoft.Cdn\u0027. See https://aka.ms/rps-not-found for how to register subscriptions.", + "details": [ + { + "code": "MissingSubscriptionRegistration", + "target": "Microsoft.Cdn", + "message": "The subscription is not registered to use namespace \u0027Microsoft.Cdn\u0027. See https://aka.ms/rps-not-found for how to register subscriptions." + } + ] } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/d4e04cad-9b04-4fad-9fad-1a9c7a3280e9?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn/register?api-version=2016-02-01", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "python-requests/2.28.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:31:13 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "c5ecde6c-3a86-4658-a86f-2060260a86e3", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-routing-request-id": "WESTUS:20221021T053114Z:c5ecde6c-3a86-4658-a86f-2060260a86e3" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn", + "namespace": "Microsoft.Cdn", + "authorizations": [ + { + "applicationId": "92b61450-2139-4e4a-a0cc-898eced7a779", + "roleDefinitionId": "067b29c5-33d0-424f-9209-a02a6cc90732" + } + ], + "resourceTypes": [ + { + "resourceType": "profiles", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "profiles/endpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/endpoints/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "profiles/endpoints/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "profiles/endpoints/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkEndpointNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01" + ] + }, + { + "resourceType": "checkResourceUsage", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02" + ] + }, + { + "resourceType": "validateProbe", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02" + ] + }, + { + "resourceType": "canMigrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "migrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "edgenodes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "CdnWebApplicationFirewallPolicies", + "locations": [ + "global" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "CdnWebApplicationFirewallManagedRuleSets", + "locations": [], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ] + }, + { + "resourceType": "profiles/afdendpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/afdendpoints/routes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets/rules", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/secrets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "validateSecret", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/securitypolicies", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults/routeresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults/ruleresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/secretresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/securitypoliciesresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.28.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20673", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:31:23 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "aa969c43-c027-4534-a0d1-0e55a1e6bf2e", + "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-routing-request-id": "WESTUS:20221021T053124Z:aa969c43-c027-4534-a0d1-0e55a1e6bf2e" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn", + "namespace": "Microsoft.Cdn", + "authorizations": [ + { + "applicationId": "92b61450-2139-4e4a-a0cc-898eced7a779", + "roleDefinitionId": "067b29c5-33d0-424f-9209-a02a6cc90732" + } + ], + "resourceTypes": [ + { + "resourceType": "profiles", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "profiles/endpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/endpoints/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "profiles/endpoints/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "profiles/endpoints/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkEndpointNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01" + ] + }, + { + "resourceType": "checkResourceUsage", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02" + ] + }, + { + "resourceType": "validateProbe", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02" + ] + }, + { + "resourceType": "canMigrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "migrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "edgenodes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "CdnWebApplicationFirewallPolicies", + "locations": [ + "global" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "CdnWebApplicationFirewallManagedRuleSets", + "locations": [], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ] + }, + { + "resourceType": "profiles/afdendpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/afdendpoints/routes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets/rules", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/secrets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "validateSecret", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/securitypolicies", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults/routeresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults/ruleresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/secretresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/securitypoliciesresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.28.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20673", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:31:33 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "2ff7e184-5bca-47e8-a10c-1a045a88dd84", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-routing-request-id": "WESTUS:20221021T053134Z:2ff7e184-5bca-47e8-a10c-1a045a88dd84" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn", + "namespace": "Microsoft.Cdn", + "authorizations": [ + { + "applicationId": "92b61450-2139-4e4a-a0cc-898eced7a779", + "roleDefinitionId": "067b29c5-33d0-424f-9209-a02a6cc90732" + } + ], + "resourceTypes": [ + { + "resourceType": "profiles", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "profiles/endpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/endpoints/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "profiles/endpoints/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "profiles/endpoints/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkEndpointNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01" + ] + }, + { + "resourceType": "checkResourceUsage", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02" + ] + }, + { + "resourceType": "validateProbe", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02" + ] + }, + { + "resourceType": "canMigrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "migrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "edgenodes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "CdnWebApplicationFirewallPolicies", + "locations": [ + "global" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "CdnWebApplicationFirewallManagedRuleSets", + "locations": [], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ] + }, + { + "resourceType": "profiles/afdendpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/afdendpoints/routes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets/rules", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/secrets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "validateSecret", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/securitypolicies", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults/routeresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults/ruleresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/secretresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/securitypoliciesresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.28.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20673", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:31:43 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "5d927ed0-5b83-49ed-8d2b-bf5c823a21db", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-routing-request-id": "WESTUS:20221021T053144Z:5d927ed0-5b83-49ed-8d2b-bf5c823a21db" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn", + "namespace": "Microsoft.Cdn", + "authorizations": [ + { + "applicationId": "92b61450-2139-4e4a-a0cc-898eced7a779", + "roleDefinitionId": "067b29c5-33d0-424f-9209-a02a6cc90732" + } + ], + "resourceTypes": [ + { + "resourceType": "profiles", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "profiles/endpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/endpoints/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "profiles/endpoints/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "profiles/endpoints/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkEndpointNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01" + ] + }, + { + "resourceType": "checkResourceUsage", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02" + ] + }, + { + "resourceType": "validateProbe", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02" + ] + }, + { + "resourceType": "canMigrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "migrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "edgenodes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "CdnWebApplicationFirewallPolicies", + "locations": [ + "global" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "CdnWebApplicationFirewallManagedRuleSets", + "locations": [], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ] + }, + { + "resourceType": "profiles/afdendpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/afdendpoints/routes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets/rules", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/secrets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "validateSecret", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/securitypolicies", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults/routeresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults/ruleresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/secretresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/securitypoliciesresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.28.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20673", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:31:53 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "a7037f25-8912-40aa-9a8e-8270df5e76b9", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-routing-request-id": "WESTUS:20221021T053154Z:a7037f25-8912-40aa-9a8e-8270df5e76b9" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn", + "namespace": "Microsoft.Cdn", + "authorizations": [ + { + "applicationId": "92b61450-2139-4e4a-a0cc-898eced7a779", + "roleDefinitionId": "067b29c5-33d0-424f-9209-a02a6cc90732" + } + ], + "resourceTypes": [ + { + "resourceType": "profiles", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "profiles/endpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/endpoints/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "profiles/endpoints/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "profiles/endpoints/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkEndpointNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01" + ] + }, + { + "resourceType": "checkResourceUsage", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02" + ] + }, + { + "resourceType": "validateProbe", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02" + ] + }, + { + "resourceType": "canMigrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "migrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "edgenodes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "CdnWebApplicationFirewallPolicies", + "locations": [ + "global" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "CdnWebApplicationFirewallManagedRuleSets", + "locations": [], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ] + }, + { + "resourceType": "profiles/afdendpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/afdendpoints/routes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets/rules", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/secrets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "validateSecret", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/securitypolicies", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults/routeresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults/ruleresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/secretresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/securitypoliciesresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.28.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20673", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:32:04 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "79170b2d-db64-46b3-8ea8-1f3bf58a66dc", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-routing-request-id": "WESTUS:20221021T053204Z:79170b2d-db64-46b3-8ea8-1f3bf58a66dc" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn", + "namespace": "Microsoft.Cdn", + "authorizations": [ + { + "applicationId": "92b61450-2139-4e4a-a0cc-898eced7a779", + "roleDefinitionId": "067b29c5-33d0-424f-9209-a02a6cc90732" + } + ], + "resourceTypes": [ + { + "resourceType": "profiles", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "profiles/endpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/endpoints/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "profiles/endpoints/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "profiles/endpoints/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkEndpointNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01" + ] + }, + { + "resourceType": "checkResourceUsage", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02" + ] + }, + { + "resourceType": "validateProbe", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02" + ] + }, + { + "resourceType": "canMigrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "migrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "edgenodes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "CdnWebApplicationFirewallPolicies", + "locations": [ + "global" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "CdnWebApplicationFirewallManagedRuleSets", + "locations": [], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ] + }, + { + "resourceType": "profiles/afdendpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/afdendpoints/routes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets/rules", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/secrets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "validateSecret", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/securitypolicies", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults/routeresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults/ruleresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/secretresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/securitypoliciesresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn?api-version=2016-02-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "python-requests/2.28.1" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "20673", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:32:14 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "c15a29e3-8d70-4af8-8a9c-26738a2ab269", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-routing-request-id": "WESTUS:20221021T053214Z:c15a29e3-8d70-4af8-8a9c-26738a2ab269" + }, + "ResponseBody": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn", + "namespace": "Microsoft.Cdn", + "authorizations": [ + { + "applicationId": "92b61450-2139-4e4a-a0cc-898eced7a779", + "roleDefinitionId": "067b29c5-33d0-424f-9209-a02a6cc90732" + } + ], + "resourceTypes": [ + { + "resourceType": "profiles", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "profiles/endpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/endpoints/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "profiles/endpoints/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "profiles/endpoints/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkEndpointNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01" + ] + }, + { + "resourceType": "checkResourceUsage", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02" + ] + }, + { + "resourceType": "validateProbe", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02" + ] + }, + { + "resourceType": "canMigrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "migrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "edgenodes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "CdnWebApplicationFirewallPolicies", + "locations": [ + "global" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "CdnWebApplicationFirewallManagedRuleSets", + "locations": [], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ] + }, + { + "resourceType": "profiles/afdendpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/afdendpoints/routes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets/rules", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/secrets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "validateSecret", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/securitypolicies", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults/routeresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults/ruleresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/secretresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/securitypoliciesresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + } + ], + "registrationState": "Registering" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn?api-version=2016-02-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853" + "User-Agent": "python-requests/2.28.1" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Encoding": "gzip", + "Content-Length": "20672", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:08:21 GMT", + "Date": "Fri, 21 Oct 2022 05:32:24 GMT", "Expires": "-1", "Pragma": "no-cache", - "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "6467d09e-046a-43ed-8b81-74f30588fb42", - "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-request-id": "b9142403-6ddf-41f5-8029-738bb9813f9a", - "x-ms-routing-request-id": "EASTUS2:20220317T020821Z:6467d09e-046a-43ed-8b81-74f30588fb42" + "x-ms-correlation-request-id": "0073bcfb-6213-4574-bdcb-83f29329afe3", + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-routing-request-id": "WESTUS:20221021T053224Z:0073bcfb-6213-4574-bdcb-83f29329afe3" }, "ResponseBody": { - "status": "InProgress", - "error": { - "code": "None", - "message": null - } + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Cdn", + "namespace": "Microsoft.Cdn", + "authorizations": [ + { + "applicationId": "92b61450-2139-4e4a-a0cc-898eced7a779", + "roleDefinitionId": "067b29c5-33d0-424f-9209-a02a6cc90732" + } + ], + "resourceTypes": [ + { + "resourceType": "profiles", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity" + }, + { + "resourceType": "profiles/endpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/endpoints/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "profiles/endpoints/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "profiles/endpoints/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31" + ] + }, + { + "resourceType": "operationresults/profileresults/endpointresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "checkEndpointNameAvailability", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01" + ] + }, + { + "resourceType": "checkResourceUsage", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02" + ] + }, + { + "resourceType": "validateProbe", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02" + ] + }, + { + "resourceType": "canMigrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "migrate", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview" + ] + }, + { + "resourceType": "operations", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "edgenodes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US", + "West Central US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2020-03-31", + "2019-12-31", + "2019-06-15-preview", + "2019-04-15", + "2018-04-02", + "2017-10-12", + "2017-04-02", + "2016-10-02", + "2016-04-02", + "2015-06-01" + ] + }, + { + "resourceType": "CdnWebApplicationFirewallPolicies", + "locations": [ + "global" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "CdnWebApplicationFirewallManagedRuleSets", + "locations": [], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01", + "2020-04-15", + "2019-06-15-preview" + ] + }, + { + "resourceType": "profiles/afdendpoints", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ], + "capabilities": "CrossResourceGroupResourceMove, CrossSubscriptionResourceMove" + }, + { + "resourceType": "profiles/afdendpoints/routes", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/customdomains", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/origingroups/origins", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/rulesets/rules", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/secrets", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "validateSecret", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "profiles/securitypolicies", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/afdendpointresults/routeresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/customdomainresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/origingroupresults/originresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/rulesetresults/ruleresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/secretresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + }, + { + "resourceType": "operationresults/profileresults/securitypoliciesresults", + "locations": [ + "global", + "Australia East", + "Australia Southeast", + "Brazil South", + "Canada Central", + "Canada East", + "Central India", + "Central US", + "East Asia", + "East US", + "East US 2", + "Japan East", + "Japan West", + "North Central US", + "North Europe", + "South Central US", + "South India", + "Southeast Asia", + "West Europe", + "West India", + "West US" + ], + "apiVersions": [ + "2022-11-01-preview", + "2022-05-01-preview", + "2021-06-01", + "2020-09-01" + ] + } + ], + "registrationState": "Registered" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/d4e04cad-9b04-4fad-9fad-1a9c7a3280e9?api-version=2021-06-01", - "RequestMethod": "GET", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename?api-version=2021-06-01", + "RequestMethod": "PUT", "RequestHeaders": { - "Accept": "*/*", + "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853" + "Content-Length": "59", + "Content-Type": "application/json", + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, - "RequestBody": null, - "StatusCode": 200, + "RequestBody": { + "location": "WestUs", + "sku": { + "name": "Standard_Verizon" + } + }, + "StatusCode": 201, "ResponseHeaders": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/5e7540b8-3c5b-4b05-87ba-22d6be3ecee4?api-version=2021-06-01", "Cache-Control": "no-cache", - "Content-Encoding": "gzip", + "Content-Length": "332", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:08:50 GMT", + "Date": "Fri, 21 Oct 2022 05:32:26 GMT", "Expires": "-1", "Pragma": "no-cache", + "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "Transfer-Encoding": "chunked", - "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "e2ff7e5b-cd2d-49f5-9a60-041556774887", - "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-request-id": "5137dcdd-a43e-46ac-be58-a5de6e3856db", - "x-ms-routing-request-id": "EASTUS2:20220317T020851Z:e2ff7e5b-cd2d-49f5-9a60-041556774887" + "x-ms-correlation-request-id": "e338ac63-3d4a-41de-bff7-9563852d524f", + "x-ms-ratelimit-remaining-subscription-resource-requests": "23", + "x-ms-routing-request-id": "WESTUS:20221021T053226Z:e338ac63-3d4a-41de-bff7-9563852d524f" }, "ResponseBody": { - "status": "InProgress", - "error": { - "code": "None", - "message": null + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename", + "type": "Microsoft.Cdn/profiles", + "name": "profilename", + "location": "WestUs", + "kind": "cdn", + "tags": {}, + "sku": { + "name": "Standard_Verizon" + }, + "properties": { + "resourceState": "Creating", + "provisioningState": "Creating" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/d4e04cad-9b04-4fad-9fad-1a9c7a3280e9?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/5e7540b8-3c5b-4b05-87ba-22d6be3ecee4?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -361,7 +11955,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:09:20 GMT", + "Date": "Fri, 21 Oct 2022 05:32:26 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -369,11 +11963,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "14e7dff3-18b9-4686-9294-9377b8803edc", - "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-request-id": "ccedbfd3-1fd7-417d-aaf0-840c987a3307", - "x-ms-routing-request-id": "EASTUS2:20220317T020921Z:14e7dff3-18b9-4686-9294-9377b8803edc" + "x-ms-correlation-request-id": "b7a18de2-23c8-40a6-939d-fcc5a520a68a", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-routing-request-id": "WESTUS:20221021T053226Z:b7a18de2-23c8-40a6-939d-fcc5a520a68a" }, "ResponseBody": { "status": "InProgress", @@ -384,15 +11976,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/d4e04cad-9b04-4fad-9fad-1a9c7a3280e9?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/5e7540b8-3c5b-4b05-87ba-22d6be3ecee4?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -400,7 +11990,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:09:51 GMT", + "Date": "Fri, 21 Oct 2022 05:32:56 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -408,11 +11998,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "f8d69e0d-df73-4dbc-a464-2d74ac2b2c34", - "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-request-id": "3975bd13-93e5-40bc-a2d4-e6b4d0ecbe67", - "x-ms-routing-request-id": "EASTUS2:20220317T020951Z:f8d69e0d-df73-4dbc-a464-2d74ac2b2c34" + "x-ms-correlation-request-id": "0b36181e-05ee-41ec-b7aa-decd864fc4a1", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-routing-request-id": "WESTUS:20221021T053256Z:0b36181e-05ee-41ec-b7aa-decd864fc4a1" }, "ResponseBody": { "status": "Succeeded", @@ -428,10 +12016,8 @@ "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -439,7 +12025,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:09:51 GMT", + "Date": "Fri, 21 Oct 2022 05:32:56 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -447,11 +12033,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "16cb076f-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "07855be2-c6d1-4296-b809-fdfd1ba81546", + "x-ms-correlation-request-id": "cd9a90c2-eab0-48e1-876b-7160af1acf39", "x-ms-ratelimit-remaining-subscription-resource-requests": "49", - "x-ms-request-id": "f5c6a416-1e11-4408-ba07-5fd6efa7bec8", - "x-ms-routing-request-id": "EASTUS2:20220317T020951Z:07855be2-c6d1-4296-b809-fdfd1ba81546" + "x-ms-routing-request-id": "WESTUS:20221021T053256Z:cd9a90c2-eab0-48e1-876b-7160af1acf39" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename", @@ -465,7 +12049,6 @@ }, "properties": { "resourceState": "Active", - "identity": null, "provisioningState": "Succeeded" } } @@ -476,12 +12059,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "400", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "5468b968-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "WestUs", @@ -511,22 +12092,20 @@ }, "StatusCode": 201, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/1e7d98e1-1cfe-4bf4-8567-9aeccf9bb41a?api-version=2021-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/1ded7274-492e-411b-9f62-e603fe525e3a?api-version=2021-06-01", "Cache-Control": "no-cache", "Content-Length": "1139", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:09:53 GMT", + "Date": "Fri, 21 Oct 2022 05:33:01 GMT", "Expires": "-1", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "5468b968-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "fe5508d8-01de-41a5-b997-5515ae019c52", + "x-ms-correlation-request-id": "503ff709-ce88-453f-9c32-302c414bb831", "x-ms-ratelimit-remaining-subscription-resource-requests": "99", - "x-ms-request-id": "45f4ed41-c999-43d2-903e-912eb1c3db33", - "x-ms-routing-request-id": "EASTUS2:20220317T020953Z:fe5508d8-01de-41a5-b997-5515ae019c52" + "x-ms-routing-request-id": "WESTUS:20221021T053302Z:503ff709-ce88-453f-9c32-302c414bb831" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename/endpoints/endpoint9527x", @@ -582,15 +12161,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/1e7d98e1-1cfe-4bf4-8567-9aeccf9bb41a?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/1ded7274-492e-411b-9f62-e603fe525e3a?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "5468b968-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -598,7 +12175,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:03 GMT", + "Date": "Fri, 21 Oct 2022 05:33:01 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -606,11 +12183,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "5468b968-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "0fb25b23-9e87-4170-a5da-63eab55c646e", - "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-request-id": "d55ecb7c-a2f1-4c32-99ca-bcc29233343c", - "x-ms-routing-request-id": "EASTUS2:20220317T021003Z:0fb25b23-9e87-4170-a5da-63eab55c646e" + "x-ms-correlation-request-id": "51aa6ae7-f0ad-4352-bd97-e20bba956d45", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-routing-request-id": "WESTUS:20221021T053302Z:51aa6ae7-f0ad-4352-bd97-e20bba956d45" }, "ResponseBody": { "status": "InProgress", @@ -621,15 +12196,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/1e7d98e1-1cfe-4bf4-8567-9aeccf9bb41a?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/1ded7274-492e-411b-9f62-e603fe525e3a?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "5468b968-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -637,7 +12210,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:33 GMT", + "Date": "Fri, 21 Oct 2022 05:33:31 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -645,11 +12218,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "5468b968-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "8c0ac1ca-031e-4447-9621-284f7dc31298", - "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-request-id": "770bb5cb-9448-49c6-97a6-d7560439c3cd", - "x-ms-routing-request-id": "EASTUS2:20220317T021033Z:8c0ac1ca-031e-4447-9621-284f7dc31298" + "x-ms-correlation-request-id": "3a336314-1302-4872-a640-53480b71449b", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-routing-request-id": "WESTUS:20221021T053332Z:3a336314-1302-4872-a640-53480b71449b" }, "ResponseBody": { "status": "Succeeded", @@ -665,10 +12236,8 @@ "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "5468b968-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -676,7 +12245,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:33 GMT", + "Date": "Fri, 21 Oct 2022 05:33:31 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -684,11 +12253,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "5468b968-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "3adedf63-fbcb-4e47-8278-7fd21fd62535", + "x-ms-correlation-request-id": "855722e6-f183-42de-babf-13e051c3d783", "x-ms-ratelimit-remaining-subscription-resource-requests": "49", - "x-ms-request-id": "47947003-0aa6-466d-99f6-e92b5391c55b", - "x-ms-routing-request-id": "EASTUS2:20220317T021033Z:3adedf63-fbcb-4e47-8278-7fd21fd62535" + "x-ms-routing-request-id": "WESTUS:20221021T053332Z:855722e6-f183-42de-babf-13e051c3d783" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename/endpoints/endpoint9527x", @@ -749,10 +12316,8 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "6d92e1b6-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -760,7 +12325,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:33 GMT", + "Date": "Fri, 21 Oct 2022 05:33:32 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -768,11 +12333,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "6d92e1b6-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "91a6ff53-43fd-4eed-8363-c3280d88ecb1", - "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-request-id": "86c9a5fc-f2f5-4a00-b1be-9c294254ddbb", - "x-ms-routing-request-id": "EASTUS2:20220317T021033Z:91a6ff53-43fd-4eed-8363-c3280d88ecb1" + "x-ms-correlation-request-id": "b54a0059-c235-419c-9d8e-7929307dd3b2", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-routing-request-id": "WESTUS:20221021T053332Z:b54a0059-c235-419c-9d8e-7929307dd3b2" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename/endpoints/endpoint9527x/origins/origin1", @@ -802,10 +12365,8 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "6d92e1b7-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -813,7 +12374,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:33 GMT", + "Date": "Fri, 21 Oct 2022 05:33:32 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -821,11 +12382,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "6d92e1b7-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "cdf17525-943e-421d-b78c-25fba588395c", + "x-ms-correlation-request-id": "c13c3251-743b-46da-ac59-6bb9cfb8714a", "x-ms-ratelimit-remaining-subscription-resource-requests": "48", - "x-ms-request-id": "7935b287-1198-4825-aaf8-0b45fd7417b1", - "x-ms-routing-request-id": "EASTUS2:20220317T021033Z:cdf17525-943e-421d-b78c-25fba588395c" + "x-ms-routing-request-id": "WESTUS:20221021T053333Z:c13c3251-743b-46da-ac59-6bb9cfb8714a" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename/endpoints/endpoint9527x", @@ -886,10 +12445,8 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "6d92e1b8-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -897,7 +12454,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:33 GMT", + "Date": "Fri, 21 Oct 2022 05:33:32 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -905,11 +12462,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "6d92e1b8-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "8091182f-5fb6-4faf-9466-6b94a20ec8af", + "x-ms-correlation-request-id": "7731d004-f605-43f3-a621-0466158db3ff", "x-ms-ratelimit-remaining-subscription-resource-requests": "48", - "x-ms-request-id": "a4cb10ba-bffe-4a1d-8ac2-f475ed4081bf", - "x-ms-routing-request-id": "EASTUS2:20220317T021034Z:8091182f-5fb6-4faf-9466-6b94a20ec8af" + "x-ms-routing-request-id": "WESTUS:20221021T053333Z:7731d004-f605-43f3-a621-0466158db3ff" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename", @@ -923,7 +12478,6 @@ }, "properties": { "resourceState": "Active", - "identity": null, "provisioningState": "Succeeded" } } @@ -934,12 +12488,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "49", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "6d92e1b9-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "properties": { @@ -949,23 +12501,21 @@ }, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/a7c5fb21-bc83-49de-b711-53e8b12ee874?api-version=2021-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3fdecb7f-b337-4949-85ca-7fd7771681be?api-version=2021-06-01", "Cache-Control": "no-cache", "Content-Length": "578", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:34 GMT", + "Date": "Fri, 21 Oct 2022 05:33:34 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/a7c5fb21-bc83-49de-b711-53e8b12ee874/profileresults/profilename/endpointresults/endpoint9527x/originresults/origin1?api-version=2021-06-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3fdecb7f-b337-4949-85ca-7fd7771681be/profileresults/profilename/endpointresults/endpoint9527x/originresults/origin1?api-version=2021-06-01", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "6d92e1b9-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "daa2954e-91c3-43db-bf33-c442bd5d387f", + "x-ms-correlation-request-id": "a04a69f5-4421-4667-ad79-92fa5ac4e82e", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-request-id": "747ac895-f504-4e96-97b4-e3f7ff7f801d", - "x-ms-routing-request-id": "EASTUS2:20220317T021034Z:daa2954e-91c3-43db-bf33-c442bd5d387f" + "x-ms-routing-request-id": "WESTUS:20221021T053335Z:a04a69f5-4421-4667-ad79-92fa5ac4e82e" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename/endpoints/endpoint9527x/origins/origin1", @@ -990,15 +12540,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/a7c5fb21-bc83-49de-b711-53e8b12ee874?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3fdecb7f-b337-4949-85ca-7fd7771681be?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "6d92e1b9-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1006,7 +12554,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:44 GMT", + "Date": "Fri, 21 Oct 2022 05:33:34 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1014,11 +12562,44 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "6d92e1b9-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "4066efdf-ebbf-4af9-8cc9-088a8bcf613c", - "x-ms-ratelimit-remaining-subscription-reads": "11992", - "x-ms-request-id": "8581dff7-b40d-494c-b056-e04ff96d8078", - "x-ms-routing-request-id": "EASTUS2:20220317T021044Z:4066efdf-ebbf-4af9-8cc9-088a8bcf613c" + "x-ms-correlation-request-id": "50f3523c-df09-41d6-bcba-b4e52b7ae968", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-routing-request-id": "WESTUS:20221021T053335Z:50f3523c-df09-41d6-bcba-b4e52b7ae968" + }, + "ResponseBody": { + "status": "InProgress", + "error": { + "code": "None", + "message": null + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3fdecb7f-b337-4949-85ca-7fd7771681be?api-version=2021-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:34:05 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "b29b2bd7-99bd-4b1e-98b4-dcc96475b29d", + "x-ms-ratelimit-remaining-subscription-reads": "11986", + "x-ms-routing-request-id": "WESTUS:20221021T053405Z:b29b2bd7-99bd-4b1e-98b4-dcc96475b29d" }, "ResponseBody": { "status": "Succeeded", @@ -1034,10 +12615,8 @@ "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "6d92e1b9-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1045,7 +12624,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:44 GMT", + "Date": "Fri, 21 Oct 2022 05:34:05 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1053,11 +12632,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "6d92e1b9-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "99aeafeb-67a3-4809-be0a-35721515d1c7", - "x-ms-ratelimit-remaining-subscription-reads": "11991", - "x-ms-request-id": "31b37eab-a8ac-428f-b266-f4beabe08b63", - "x-ms-routing-request-id": "EASTUS2:20220317T021044Z:99aeafeb-67a3-4809-be0a-35721515d1c7" + "x-ms-correlation-request-id": "f097619d-ed0d-4e8e-b5b2-414bc0095616", + "x-ms-ratelimit-remaining-subscription-reads": "11985", + "x-ms-routing-request-id": "WESTUS:20221021T053405Z:f097619d-ed0d-4e8e-b5b2-414bc0095616" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename/endpoints/endpoint9527x/origins/origin1", @@ -1087,12 +12664,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "34", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "7415cc38-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "hostName": "www.someDomain.com" @@ -1102,7 +12677,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:44 GMT", + "Date": "Fri, 21 Oct 2022 05:34:06 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1110,11 +12685,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "7415cc38-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "106b0dbc-81d6-410e-b8d8-0e3f781226c9", - "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-request-id": "fa97ef2b-13c3-402f-a33a-b5a09d401d80", - "x-ms-routing-request-id": "EASTUS2:20220317T021045Z:106b0dbc-81d6-410e-b8d8-0e3f781226c9" + "x-ms-correlation-request-id": "af26c6ef-e9f3-4442-aa1f-5a6c4a8fc047", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-routing-request-id": "WESTUS:20221021T053406Z:af26c6ef-e9f3-4442-aa1f-5a6c4a8fc047" }, "ResponseBody": { "customDomainValidated": false, @@ -1128,12 +12701,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "30", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "7415cc39-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "contentPaths": [ @@ -1142,35 +12713,31 @@ }, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/82c9c6be-b711-4674-9a1a-cf8dbc562601?api-version=2021-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/76d417d1-718b-4412-9a06-83761a80796a?api-version=2021-06-01", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Thu, 17 Mar 2022 02:10:45 GMT", + "Date": "Fri, 21 Oct 2022 05:34:08 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/82c9c6be-b711-4674-9a1a-cf8dbc562601/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/76d417d1-718b-4412-9a06-83761a80796a/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "7415cc39-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "1a177257-92e4-4842-9bff-6102ce346ac6", + "x-ms-correlation-request-id": "f9b7cc82-33a4-457a-8e90-1eae90576c0d", "x-ms-ratelimit-remaining-subscription-resource-requests": "499", - "x-ms-request-id": "27c5bc1c-dbf6-43e2-b480-e67601f55e34", - "x-ms-routing-request-id": "EASTUS2:20220317T021045Z:1a177257-92e4-4842-9bff-6102ce346ac6" + "x-ms-routing-request-id": "WESTUS:20221021T053408Z:f9b7cc82-33a4-457a-8e90-1eae90576c0d" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/82c9c6be-b711-4674-9a1a-cf8dbc562601?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/76d417d1-718b-4412-9a06-83761a80796a?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "7415cc39-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1178,7 +12745,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:10:55 GMT", + "Date": "Fri, 21 Oct 2022 05:34:08 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1186,11 +12753,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "7415cc39-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "035dc967-3343-4bf8-a742-3897d4ad9506", - "x-ms-ratelimit-remaining-subscription-reads": "11990", - "x-ms-request-id": "8f322460-2594-44d7-ba47-8a491e4543ac", - "x-ms-routing-request-id": "EASTUS2:20220317T021055Z:035dc967-3343-4bf8-a742-3897d4ad9506" + "x-ms-correlation-request-id": "6530867f-06fb-4d75-a29d-8d29240f414a", + "x-ms-ratelimit-remaining-subscription-reads": "11984", + "x-ms-routing-request-id": "WESTUS:20221021T053408Z:6530867f-06fb-4d75-a29d-8d29240f414a" }, "ResponseBody": { "status": "InProgress", @@ -1201,15 +12766,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/82c9c6be-b711-4674-9a1a-cf8dbc562601?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/76d417d1-718b-4412-9a06-83761a80796a?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "7415cc39-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1217,7 +12780,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:11:25 GMT", + "Date": "Fri, 21 Oct 2022 05:34:38 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1225,11 +12788,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "7415cc39-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "884ae813-e180-4549-a44a-6d81af08ba09", - "x-ms-ratelimit-remaining-subscription-reads": "11989", - "x-ms-request-id": "1b5f9a40-8e6b-4bce-85dc-1e640014abc2", - "x-ms-routing-request-id": "EASTUS2:20220317T021125Z:884ae813-e180-4549-a44a-6d81af08ba09" + "x-ms-correlation-request-id": "7feaa187-c9ea-4b3c-ba4b-eb74c40f6fd3", + "x-ms-ratelimit-remaining-subscription-reads": "11983", + "x-ms-routing-request-id": "WESTUS:20221021T053438Z:7feaa187-c9ea-4b3c-ba4b-eb74c40f6fd3" }, "ResponseBody": { "status": "InProgress", @@ -1240,15 +12801,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/82c9c6be-b711-4674-9a1a-cf8dbc562601?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/76d417d1-718b-4412-9a06-83761a80796a?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "7415cc39-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1256,7 +12815,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:11:55 GMT", + "Date": "Fri, 21 Oct 2022 05:35:07 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1264,11 +12823,44 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "7415cc39-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "5b3dbd9c-dda8-4f6d-b365-f38874d38c03", - "x-ms-ratelimit-remaining-subscription-reads": "11988", - "x-ms-request-id": "37f9627a-4654-4160-8b85-a2ad04b7bb12", - "x-ms-routing-request-id": "EASTUS2:20220317T021156Z:5b3dbd9c-dda8-4f6d-b365-f38874d38c03" + "x-ms-correlation-request-id": "8fb2c049-5c67-41bf-9aea-eb18efbb967e", + "x-ms-ratelimit-remaining-subscription-reads": "11982", + "x-ms-routing-request-id": "WESTUS:20221021T053508Z:8fb2c049-5c67-41bf-9aea-eb18efbb967e" + }, + "ResponseBody": { + "status": "InProgress", + "error": { + "code": "None", + "message": null + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/76d417d1-718b-4412-9a06-83761a80796a?api-version=2021-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:35:37 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "3f16ee7a-d93f-4c1e-852c-20cd29b54ac3", + "x-ms-ratelimit-remaining-subscription-reads": "11981", + "x-ms-routing-request-id": "WESTUS:20221021T053538Z:3f16ee7a-d93f-4c1e-852c-20cd29b54ac3" }, "ResponseBody": { "status": "Succeeded", @@ -1279,15 +12871,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/82c9c6be-b711-4674-9a1a-cf8dbc562601/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/76d417d1-718b-4412-9a06-83761a80796a/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "7415cc39-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1295,7 +12885,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:11:55 GMT", + "Date": "Fri, 21 Oct 2022 05:35:38 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1303,14 +12893,12 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "7415cc39-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "1157ec54-5e8e-44a5-a82c-81521f99b438", - "x-ms-ratelimit-remaining-subscription-reads": "11987", - "x-ms-request-id": "d3652554-d284-41d4-bf8e-3baffc78f4e3", - "x-ms-routing-request-id": "EASTUS2:20220317T021156Z:1157ec54-5e8e-44a5-a82c-81521f99b438" + "x-ms-correlation-request-id": "ddc8294d-e445-46ef-acbc-d87bbd08b4c8", + "x-ms-ratelimit-remaining-subscription-reads": "11980", + "x-ms-routing-request-id": "WESTUS:20221021T053539Z:ddc8294d-e445-46ef-acbc-d87bbd08b4c8" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/82c9c6be-b711-4674-9a1a-cf8dbc562601/profileresults/profilename/endpointresults/endpoint9527x", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/76d417d1-718b-4412-9a06-83761a80796a/profileresults/profilename/endpointresults/endpoint9527x", "type": "Microsoft.Cdn/operationresults/profileresults/endpointresults", "name": "endpoint9527x", "location": "WestUs", @@ -1368,32 +12956,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "9e93163c-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/cbf7d9bc-52ea-4ca4-a5dc-0fbec77715b6?api-version=2021-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/ad689636-72ee-4863-ae9c-22b7e1b0fbfd?api-version=2021-06-01", "Cache-Control": "no-cache", "Content-Length": "1136", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:11:56 GMT", + "Date": "Fri, 21 Oct 2022 05:35:39 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/cbf7d9bc-52ea-4ca4-a5dc-0fbec77715b6/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/ad689636-72ee-4863-ae9c-22b7e1b0fbfd/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "9e93163c-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "fc644b88-56a0-437c-9013-f3329680a4a6", + "x-ms-correlation-request-id": "9470423a-a26d-40b9-923b-99947b7ff829", "x-ms-ratelimit-remaining-subscription-resource-requests": "49", - "x-ms-request-id": "7968e766-b6da-423a-90a2-7f8796c5920e", - "x-ms-routing-request-id": "EASTUS2:20220317T021156Z:fc644b88-56a0-437c-9013-f3329680a4a6" + "x-ms-routing-request-id": "WESTUS:20221021T053539Z:9470423a-a26d-40b9-923b-99947b7ff829" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename/endpoints/endpoint9527x", @@ -1449,15 +13033,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/cbf7d9bc-52ea-4ca4-a5dc-0fbec77715b6?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/ad689636-72ee-4863-ae9c-22b7e1b0fbfd?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "9e93163c-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1465,7 +13047,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:12:05 GMT", + "Date": "Fri, 21 Oct 2022 05:35:39 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1473,11 +13055,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "9e93163c-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "8b7cda7d-8b55-4ef7-b643-34be2a832de0", - "x-ms-ratelimit-remaining-subscription-reads": "11986", - "x-ms-request-id": "2535ebe5-c3a7-4c65-bab6-21c36d6864ce", - "x-ms-routing-request-id": "EASTUS2:20220317T021206Z:8b7cda7d-8b55-4ef7-b643-34be2a832de0" + "x-ms-correlation-request-id": "452e0a68-27f6-44a1-8186-6f8104395dfe", + "x-ms-ratelimit-remaining-subscription-reads": "11979", + "x-ms-routing-request-id": "WESTUS:20221021T053540Z:452e0a68-27f6-44a1-8186-6f8104395dfe" }, "ResponseBody": { "status": "InProgress", @@ -1488,15 +13068,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/cbf7d9bc-52ea-4ca4-a5dc-0fbec77715b6?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/ad689636-72ee-4863-ae9c-22b7e1b0fbfd?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "9e93163c-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1504,7 +13082,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:12:36 GMT", + "Date": "Fri, 21 Oct 2022 05:36:10 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1512,11 +13090,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "9e93163c-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "61323a45-5d9e-488b-9601-3f619c1b3b7e", - "x-ms-ratelimit-remaining-subscription-reads": "11985", - "x-ms-request-id": "ce8faae0-3076-423f-a6a8-ad2a325f638d", - "x-ms-routing-request-id": "EASTUS2:20220317T021236Z:61323a45-5d9e-488b-9601-3f619c1b3b7e" + "x-ms-correlation-request-id": "f4985e44-5912-4121-b13e-bb8ec9b0567d", + "x-ms-ratelimit-remaining-subscription-reads": "11978", + "x-ms-routing-request-id": "WESTUS:20221021T053610Z:f4985e44-5912-4121-b13e-bb8ec9b0567d" }, "ResponseBody": { "status": "Succeeded", @@ -1527,15 +13103,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/cbf7d9bc-52ea-4ca4-a5dc-0fbec77715b6/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/ad689636-72ee-4863-ae9c-22b7e1b0fbfd/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "9e93163c-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1543,7 +13117,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:12:36 GMT", + "Date": "Fri, 21 Oct 2022 05:36:10 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1551,14 +13125,12 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "9e93163c-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "bb883ca9-38d9-4ffb-9fc3-dcf83cc1f63d", - "x-ms-ratelimit-remaining-subscription-reads": "11984", - "x-ms-request-id": "e27051ac-0bf0-4fff-b950-6eb6c101fc40", - "x-ms-routing-request-id": "EASTUS2:20220317T021236Z:bb883ca9-38d9-4ffb-9fc3-dcf83cc1f63d" + "x-ms-correlation-request-id": "1d008595-d71b-4706-b46c-bf4061ad5223", + "x-ms-ratelimit-remaining-subscription-reads": "11977", + "x-ms-routing-request-id": "WESTUS:20221021T053610Z:1d008595-d71b-4706-b46c-bf4061ad5223" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/cbf7d9bc-52ea-4ca4-a5dc-0fbec77715b6/profileresults/profilename/endpointresults/endpoint9527x", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/ad689636-72ee-4863-ae9c-22b7e1b0fbfd/profileresults/profilename/endpointresults/endpoint9527x", "type": "Microsoft.Cdn/operationresults/profileresults/endpointresults", "name": "endpoint9527x", "location": "WestUs", @@ -1616,32 +13188,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "b6efde04-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/4b909f48-d8c1-4f5c-bb46-61390f5eeb80?api-version=2021-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/8300d4ac-fce6-4dfc-a3cf-a91d6c06af08?api-version=2021-06-01", "Cache-Control": "no-cache", "Content-Length": "1136", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:12:37 GMT", + "Date": "Fri, 21 Oct 2022 05:36:11 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/4b909f48-d8c1-4f5c-bb46-61390f5eeb80/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/8300d4ac-fce6-4dfc-a3cf-a91d6c06af08/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "b6efde04-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "a0d653bc-8d18-4667-8405-bc1cdb36254c", + "x-ms-correlation-request-id": "23b1e576-3fb0-4e84-93f8-18bea04a05a7", "x-ms-ratelimit-remaining-subscription-resource-requests": "49", - "x-ms-request-id": "d690a299-ef7c-494e-9cd6-58554a0230d7", - "x-ms-routing-request-id": "EASTUS2:20220317T021237Z:a0d653bc-8d18-4667-8405-bc1cdb36254c" + "x-ms-routing-request-id": "WESTUS:20221021T053612Z:23b1e576-3fb0-4e84-93f8-18bea04a05a7" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename/endpoints/endpoint9527x", @@ -1697,15 +13265,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/4b909f48-d8c1-4f5c-bb46-61390f5eeb80?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/8300d4ac-fce6-4dfc-a3cf-a91d6c06af08?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "b6efde04-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1713,7 +13279,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:12:47 GMT", + "Date": "Fri, 21 Oct 2022 05:36:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1721,11 +13287,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "b6efde04-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "f4d98b9d-0126-435c-893a-887e6d017db4", - "x-ms-ratelimit-remaining-subscription-reads": "11983", - "x-ms-request-id": "c48393cd-196f-4398-8c67-eb4e59343fd9", - "x-ms-routing-request-id": "EASTUS2:20220317T021247Z:f4d98b9d-0126-435c-893a-887e6d017db4" + "x-ms-correlation-request-id": "560c4253-4521-47b3-8327-4096ed6d747c", + "x-ms-ratelimit-remaining-subscription-reads": "11976", + "x-ms-routing-request-id": "WESTUS:20221021T053612Z:560c4253-4521-47b3-8327-4096ed6d747c" }, "ResponseBody": { "status": "InProgress", @@ -1736,15 +13300,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/4b909f48-d8c1-4f5c-bb46-61390f5eeb80?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/8300d4ac-fce6-4dfc-a3cf-a91d6c06af08?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "b6efde04-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1752,7 +13314,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:13:17 GMT", + "Date": "Fri, 21 Oct 2022 05:36:41 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1760,11 +13322,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "b6efde04-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "727446c0-0517-4335-a003-d44501320458", - "x-ms-ratelimit-remaining-subscription-reads": "11982", - "x-ms-request-id": "b982d618-043b-43cd-b9d3-0e09ec0c876e", - "x-ms-routing-request-id": "EASTUS2:20220317T021317Z:727446c0-0517-4335-a003-d44501320458" + "x-ms-correlation-request-id": "cf58563f-8b05-4766-8eff-724be6e6a1ac", + "x-ms-ratelimit-remaining-subscription-reads": "11975", + "x-ms-routing-request-id": "WESTUS:20221021T053642Z:cf58563f-8b05-4766-8eff-724be6e6a1ac" }, "ResponseBody": { "status": "Succeeded", @@ -1775,15 +13335,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/4b909f48-d8c1-4f5c-bb46-61390f5eeb80/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/8300d4ac-fce6-4dfc-a3cf-a91d6c06af08/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "b6efde04-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1791,7 +13349,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:13:17 GMT", + "Date": "Fri, 21 Oct 2022 05:36:42 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1799,14 +13357,12 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "b6efde04-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "33461cd0-c32a-48c7-bcd2-10ae327b0fca", - "x-ms-ratelimit-remaining-subscription-reads": "11981", - "x-ms-request-id": "1c78164f-2a23-4bbc-a906-8281ac37d8ae", - "x-ms-routing-request-id": "EASTUS2:20220317T021317Z:33461cd0-c32a-48c7-bcd2-10ae327b0fca" + "x-ms-correlation-request-id": "79b12ce0-0ff1-4e19-9ea6-ce4020c40edd", + "x-ms-ratelimit-remaining-subscription-reads": "11974", + "x-ms-routing-request-id": "WESTUS:20221021T053642Z:79b12ce0-0ff1-4e19-9ea6-ce4020c40edd" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/4b909f48-d8c1-4f5c-bb46-61390f5eeb80/profileresults/profilename/endpointresults/endpoint9527x", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/8300d4ac-fce6-4dfc-a3cf-a91d6c06af08/profileresults/profilename/endpointresults/endpoint9527x", "type": "Microsoft.Cdn/operationresults/profileresults/endpointresults", "name": "endpoint9527x", "location": "WestUs", @@ -1864,12 +13420,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "30", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "contentPaths": [ @@ -1878,35 +13432,31 @@ }, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3bd7a357-9ed3-40a6-9c14-6de18bcbd291?api-version=2021-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228?api-version=2021-06-01", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Thu, 17 Mar 2022 02:13:18 GMT", + "Date": "Fri, 21 Oct 2022 05:36:43 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3bd7a357-9ed3-40a6-9c14-6de18bcbd291/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "03741933-4c76-448d-8897-e02c80c02633", + "x-ms-correlation-request-id": "8abb180b-9c3a-4e19-9d53-41d344cf6f3c", "x-ms-ratelimit-remaining-subscription-resource-requests": "499", - "x-ms-request-id": "c2b652ba-8e24-40a1-bfc5-7a5b122a2bca", - "x-ms-routing-request-id": "EASTUS2:20220317T021318Z:03741933-4c76-448d-8897-e02c80c02633" + "x-ms-routing-request-id": "WESTUS:20221021T053644Z:8abb180b-9c3a-4e19-9d53-41d344cf6f3c" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3bd7a357-9ed3-40a6-9c14-6de18bcbd291?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1914,7 +13464,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:13:28 GMT", + "Date": "Fri, 21 Oct 2022 05:36:44 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1922,11 +13472,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "841bf258-5731-4623-9606-2445ad0b3a93", - "x-ms-ratelimit-remaining-subscription-reads": "11980", - "x-ms-request-id": "31c6b2c6-7f9f-45ec-9aa1-424790c83b0b", - "x-ms-routing-request-id": "EASTUS2:20220317T021328Z:841bf258-5731-4623-9606-2445ad0b3a93" + "x-ms-correlation-request-id": "8c370040-0188-4a9f-bd0c-c6024a94f142", + "x-ms-ratelimit-remaining-subscription-reads": "11973", + "x-ms-routing-request-id": "WESTUS:20221021T053644Z:8c370040-0188-4a9f-bd0c-c6024a94f142" }, "ResponseBody": { "status": "InProgress", @@ -1937,15 +13485,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3bd7a357-9ed3-40a6-9c14-6de18bcbd291?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1953,7 +13499,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:13:57 GMT", + "Date": "Fri, 21 Oct 2022 05:37:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -1961,11 +13507,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "7400a14b-2af7-437c-8cae-e2527eb69db9", - "x-ms-ratelimit-remaining-subscription-reads": "11979", - "x-ms-request-id": "99e44836-422e-42c3-bd82-a556317d3422", - "x-ms-routing-request-id": "EASTUS2:20220317T021358Z:7400a14b-2af7-437c-8cae-e2527eb69db9" + "x-ms-correlation-request-id": "10b58d5e-74a1-4a1f-9775-545704dda92f", + "x-ms-ratelimit-remaining-subscription-reads": "11972", + "x-ms-routing-request-id": "WESTUS:20221021T053714Z:10b58d5e-74a1-4a1f-9775-545704dda92f" }, "ResponseBody": { "status": "InProgress", @@ -1976,15 +13520,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3bd7a357-9ed3-40a6-9c14-6de18bcbd291?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1992,7 +13534,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:14:28 GMT", + "Date": "Fri, 21 Oct 2022 05:37:43 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2000,11 +13542,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "16113acf-def8-461d-a1a1-b4fa01ad993e", - "x-ms-ratelimit-remaining-subscription-reads": "11978", - "x-ms-request-id": "e2090669-7806-4fa5-969c-a1b3109c38d3", - "x-ms-routing-request-id": "EASTUS2:20220317T021428Z:16113acf-def8-461d-a1a1-b4fa01ad993e" + "x-ms-correlation-request-id": "dc447a42-194a-4a43-a289-eaf95f016153", + "x-ms-ratelimit-remaining-subscription-reads": "11971", + "x-ms-routing-request-id": "WESTUS:20221021T053744Z:dc447a42-194a-4a43-a289-eaf95f016153" }, "ResponseBody": { "status": "InProgress", @@ -2015,15 +13555,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3bd7a357-9ed3-40a6-9c14-6de18bcbd291?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -2031,7 +13569,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:14:58 GMT", + "Date": "Fri, 21 Oct 2022 05:38:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2039,11 +13577,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "7478e40b-6ba1-4ad4-99c7-50ca2b9ed7ca", - "x-ms-ratelimit-remaining-subscription-reads": "11977", - "x-ms-request-id": "544c6e96-e502-4141-8327-3985c2277db6", - "x-ms-routing-request-id": "EASTUS2:20220317T021458Z:7478e40b-6ba1-4ad4-99c7-50ca2b9ed7ca" + "x-ms-correlation-request-id": "539c7ca2-ede0-4ffd-b8db-0b027f596258", + "x-ms-ratelimit-remaining-subscription-reads": "11970", + "x-ms-routing-request-id": "WESTUS:20221021T053814Z:539c7ca2-ede0-4ffd-b8db-0b027f596258" }, "ResponseBody": { "status": "InProgress", @@ -2054,15 +13590,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3bd7a357-9ed3-40a6-9c14-6de18bcbd291?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -2070,7 +13604,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:28 GMT", + "Date": "Fri, 21 Oct 2022 05:38:44 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2078,11 +13612,114 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "bf9e96c1-ebe1-43c8-96cb-f961cf37b042", - "x-ms-ratelimit-remaining-subscription-reads": "11976", - "x-ms-request-id": "85d93348-4eba-4075-bbcf-3ea53620f485", - "x-ms-routing-request-id": "EASTUS2:20220317T021528Z:bf9e96c1-ebe1-43c8-96cb-f961cf37b042" + "x-ms-correlation-request-id": "d0ba9d71-d11b-4db9-8ff8-231d57df69bb", + "x-ms-ratelimit-remaining-subscription-reads": "11969", + "x-ms-routing-request-id": "WESTUS:20221021T053844Z:d0ba9d71-d11b-4db9-8ff8-231d57df69bb" + }, + "ResponseBody": { + "status": "InProgress", + "error": { + "code": "None", + "message": null + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228?api-version=2021-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:39:14 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "faec80d3-d27a-4db8-8242-534e8ae893c8", + "x-ms-ratelimit-remaining-subscription-reads": "11968", + "x-ms-routing-request-id": "WESTUS:20221021T053915Z:faec80d3-d27a-4db8-8242-534e8ae893c8" + }, + "ResponseBody": { + "status": "InProgress", + "error": { + "code": "None", + "message": null + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228?api-version=2021-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:39:45 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "d7103519-9ec1-4475-80c9-814350bb673a", + "x-ms-ratelimit-remaining-subscription-reads": "11967", + "x-ms-routing-request-id": "WESTUS:20221021T053945Z:d7103519-9ec1-4475-80c9-814350bb673a" + }, + "ResponseBody": { + "status": "InProgress", + "error": { + "code": "None", + "message": null + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228?api-version=2021-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:40:14 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "deeb5119-5502-4165-9c54-85dd07c5c456", + "x-ms-ratelimit-remaining-subscription-reads": "11966", + "x-ms-routing-request-id": "WESTUS:20221021T054015Z:deeb5119-5502-4165-9c54-85dd07c5c456" }, "ResponseBody": { "status": "Succeeded", @@ -2093,15 +13730,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3bd7a357-9ed3-40a6-9c14-6de18bcbd291/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -2109,7 +13744,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:28 GMT", + "Date": "Fri, 21 Oct 2022 05:40:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2117,14 +13752,12 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "cf4f223e-a597-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "935750b8-984c-406d-bf77-99ef02a55355", - "x-ms-ratelimit-remaining-subscription-reads": "11975", - "x-ms-request-id": "4201349c-a472-46e4-a940-fa843daa46de", - "x-ms-routing-request-id": "EASTUS2:20220317T021528Z:935750b8-984c-406d-bf77-99ef02a55355" + "x-ms-correlation-request-id": "37aeb272-bb4e-438c-847b-e25aa10f8b1c", + "x-ms-ratelimit-remaining-subscription-reads": "11965", + "x-ms-routing-request-id": "WESTUS:20221021T054015Z:37aeb272-bb4e-438c-847b-e25aa10f8b1c" }, "ResponseBody": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3bd7a357-9ed3-40a6-9c14-6de18bcbd291/profileresults/profilename/endpointresults/endpoint9527x", + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/b90053b8-3352-4dec-acc9-cbef7d5a5228/profileresults/profilename/endpointresults/endpoint9527x", "type": "Microsoft.Cdn/operationresults/profileresults/endpointresults", "name": "endpoint9527x", "location": "WestUs", @@ -2182,11 +13815,9 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "1d70948e-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -2194,7 +13825,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:29 GMT", + "Date": "Fri, 21 Oct 2022 05:40:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2202,11 +13833,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "1d70948e-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "acae00ea-41cc-4ea4-b604-00238166eb69", - "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-request-id": "299b217f-ba26-4671-b1d9-ed09f5d8ade8", - "x-ms-routing-request-id": "EASTUS2:20220317T021529Z:acae00ea-41cc-4ea4-b604-00238166eb69" + "x-ms-correlation-request-id": "c919f4b0-d641-4b12-b08f-ebdf3618bc5e", + "x-ms-ratelimit-remaining-subscription-writes": "1197", + "x-ms-routing-request-id": "WESTUS:20221021T054015Z:c919f4b0-d641-4b12-b08f-ebdf3618bc5e" }, "ResponseBody": { "supportedOptimizationTypes": [ @@ -2221,12 +13850,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "43", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "1d70948f-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "tags": { @@ -2238,7 +13865,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:29 GMT", + "Date": "Fri, 21 Oct 2022 05:40:17 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2246,11 +13873,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "1d70948f-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "62115159-f0a9-47ac-9451-16c1f4efada9", + "x-ms-correlation-request-id": "22f27884-3899-4ff6-bc7f-37d09252064e", "x-ms-ratelimit-remaining-subscription-resource-requests": "98", - "x-ms-request-id": "fd83a87b-6a2d-4146-82c4-47e3cab2343e", - "x-ms-routing-request-id": "EASTUS2:20220317T021529Z:62115159-f0a9-47ac-9451-16c1f4efada9" + "x-ms-routing-request-id": "WESTUS:20221021T054018Z:22f27884-3899-4ff6-bc7f-37d09252064e" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename/endpoints/endpoint9527x", @@ -2311,11 +13936,9 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "1d709490-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -2323,7 +13946,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:29 GMT", + "Date": "Fri, 21 Oct 2022 05:40:18 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2331,14 +13954,12 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "1d709490-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "e9b232ec-82ef-4797-a43d-a9abf93a7c1e", - "x-ms-ratelimit-remaining-subscription-writes": "1197", - "x-ms-request-id": "d5b2e37f-175d-4cbb-9fbb-b3e081b75890", - "x-ms-routing-request-id": "EASTUS2:20220317T021529Z:e9b232ec-82ef-4797-a43d-a9abf93a7c1e" + "x-ms-correlation-request-id": "015dff09-e3b8-4359-b797-807d7037f036", + "x-ms-ratelimit-remaining-subscription-writes": "1196", + "x-ms-routing-request-id": "WESTUS:20221021T054018Z:015dff09-e3b8-4359-b797-807d7037f036" }, "ResponseBody": { - "ssoUriValue": "https://cdn.windowsazure.com/account/loginexternal/?token=EngQevLZvZEJBmCqzMx4NhkXPr%2fLYbBPG%2fUn%2fKynXvg%3d\u0026timestamp=2022-03-17T02:15:29.9020291Z\u0026cdnAccountId=159E8F\u0026userCustomId=SSO-f3b245b8-c305-46bd-8512-71962a434a05\u0026restEndpointId=11" + "ssoUriValue": "https://cdn.windowsazure.com/account/loginexternal/?token=8OcFIpD4JZ5nh3IuOB5z%2f%2bQT7vulAAcUa6FaPxE5PeA%3d\u0026timestamp=2022-10-21T05:40:18.4031044Z\u0026cdnAccountId=18EFB1\u0026userCustomId=SSO-312dc31f-0cbe-4f38-85f1-b660b5e0ddd1\u0026restEndpointId=12" } }, { @@ -2347,12 +13968,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "43", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "1d709491-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "tags": { @@ -2361,23 +13980,21 @@ }, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/a04e2561-f1b5-4181-917b-cca4e44fb1ec?api-version=2021-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/4101f68e-9942-464a-a3e1-d4b148e768a8?api-version=2021-06-01", "Cache-Control": "no-cache", - "Content-Length": "377", + "Content-Length": "361", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:30 GMT", + "Date": "Fri, 21 Oct 2022 05:40:19 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/a04e2561-f1b5-4181-917b-cca4e44fb1ec/profileresults/profilename?api-version=2021-06-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/4101f68e-9942-464a-a3e1-d4b148e768a8/profileresults/profilename?api-version=2021-06-01", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "1d709491-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "1f66c343-d759-48f2-8009-b7bd11b19659", - "x-ms-ratelimit-remaining-subscription-resource-requests": "23", - "x-ms-request-id": "abc42e7f-a151-4369-9c4c-1862fbc1c3f5", - "x-ms-routing-request-id": "EASTUS2:20220317T021530Z:1f66c343-d759-48f2-8009-b7bd11b19659" + "x-ms-correlation-request-id": "e4ec91c8-3057-483c-b721-5e2b892c09ad", + "x-ms-ratelimit-remaining-subscription-resource-requests": "22", + "x-ms-routing-request-id": "WESTUS:20221021T054019Z:e4ec91c8-3057-483c-b721-5e2b892c09ad" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename", @@ -2393,21 +14010,18 @@ }, "properties": { "resourceState": "Active", - "identity": null, "provisioningState": "Succeeded" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/a04e2561-f1b5-4181-917b-cca4e44fb1ec?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/4101f68e-9942-464a-a3e1-d4b148e768a8?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "1d709491-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -2415,7 +14029,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:40 GMT", + "Date": "Fri, 21 Oct 2022 05:40:19 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2423,11 +14037,44 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "1d709491-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "3c307d4f-9a2d-439f-b4cf-3acdd9940100", - "x-ms-ratelimit-remaining-subscription-reads": "11974", - "x-ms-request-id": "e903c6fb-0683-4029-ba91-46f1a93ac40b", - "x-ms-routing-request-id": "EASTUS2:20220317T021540Z:3c307d4f-9a2d-439f-b4cf-3acdd9940100" + "x-ms-correlation-request-id": "ef61a571-1f87-4852-b5ae-b29d231d3b83", + "x-ms-ratelimit-remaining-subscription-reads": "11964", + "x-ms-routing-request-id": "WESTUS:20221021T054019Z:ef61a571-1f87-4852-b5ae-b29d231d3b83" + }, + "ResponseBody": { + "status": "InProgress", + "error": { + "code": "None", + "message": null + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/4101f68e-9942-464a-a3e1-d4b148e768a8?api-version=2021-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:40:49 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "cd3d64c4-196d-4817-8d4c-71095f7acd24", + "x-ms-ratelimit-remaining-subscription-reads": "11963", + "x-ms-routing-request-id": "WESTUS:20221021T054049Z:cd3d64c4-196d-4817-8d4c-71095f7acd24" }, "ResponseBody": { "status": "Succeeded", @@ -2443,10 +14090,8 @@ "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "1d709491-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -2454,7 +14099,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:40 GMT", + "Date": "Fri, 21 Oct 2022 05:40:49 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2462,11 +14107,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "1d709491-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "5fe3721d-c104-445b-90c4-fe5ccc14dfa5", - "x-ms-ratelimit-remaining-subscription-resource-requests": "48", - "x-ms-request-id": "3b79386d-9755-41f2-82cc-6d55529c329d", - "x-ms-routing-request-id": "EASTUS2:20220317T021540Z:5fe3721d-c104-445b-90c4-fe5ccc14dfa5" + "x-ms-correlation-request-id": "e85b3dee-88d3-4a07-8652-585fc52d8762", + "x-ms-ratelimit-remaining-subscription-resource-requests": "49", + "x-ms-routing-request-id": "WESTUS:20221021T054050Z:e85b3dee-88d3-4a07-8652-585fc52d8762" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/profiles/profilename", @@ -2482,7 +14125,6 @@ }, "properties": { "resourceState": "Active", - "identity": null, "provisioningState": "Succeeded" } } @@ -2493,12 +14135,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "66", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "248c3944-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "name": "sampleName", @@ -2509,7 +14149,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:41 GMT", + "Date": "Fri, 21 Oct 2022 05:40:49 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2517,11 +14157,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "248c3944-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "c5b386bb-de85-4f26-86a2-0db1326d6ed1", - "x-ms-ratelimit-remaining-subscription-writes": "1196", - "x-ms-request-id": "3692fe5f-5d97-4a85-aa76-0559968fa0be", - "x-ms-routing-request-id": "EASTUS2:20220317T021541Z:c5b386bb-de85-4f26-86a2-0db1326d6ed1" + "x-ms-correlation-request-id": "f85471dd-ae94-408d-9753-33406e4b580d", + "x-ms-ratelimit-remaining-subscription-writes": "1195", + "x-ms-routing-request-id": "WESTUS:20221021T054050Z:f85471dd-ae94-408d-9753-33406e4b580d" }, "ResponseBody": { "nameAvailable": true, @@ -2535,12 +14173,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "42", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "248c3945-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "probeURL": "https://www.bing.com/image" @@ -2550,7 +14186,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:41 GMT", + "Date": "Fri, 21 Oct 2022 05:40:50 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2558,11 +14194,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "248c3945-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "e3775d1d-a52a-4890-bed6-745d3fb9df0a", - "x-ms-ratelimit-remaining-subscription-writes": "1195", - "x-ms-request-id": "67625eda-0411-4ad8-a1f9-b590f3057c0d", - "x-ms-routing-request-id": "EASTUS2:20220317T021541Z:e3775d1d-a52a-4890-bed6-745d3fb9df0a" + "x-ms-correlation-request-id": "e39494ef-9c31-4831-9368-496d8cdb6fe1", + "x-ms-ratelimit-remaining-subscription-writes": "1194", + "x-ms-routing-request-id": "WESTUS:20221021T054051Z:e39494ef-9c31-4831-9368-496d8cdb6fe1" }, "ResponseBody": { "isValid": true, @@ -2576,12 +14210,10 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "66", "Content-Type": "application/json", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "248c3946-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "name": "sampleName", @@ -2592,7 +14224,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:41 GMT", + "Date": "Fri, 21 Oct 2022 05:40:50 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2600,11 +14232,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "248c3946-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "ad4fad9d-5df0-4060-91fa-76d581e8b0e1", + "x-ms-correlation-request-id": "d6ef2a76-b068-4c60-ac39-f5cfad7a552c", "x-ms-ratelimit-remaining-tenant-writes": "1199", - "x-ms-request-id": "5c31e869-8091-4f9c-a134-9911616bd8b7", - "x-ms-routing-request-id": "EASTUS2:20220317T021542Z:ad4fad9d-5df0-4060-91fa-76d581e8b0e1" + "x-ms-routing-request-id": "WESTUS:20221021T054051Z:d6ef2a76-b068-4c60-ac39-f5cfad7a552c" }, "ResponseBody": { "nameAvailable": true, @@ -2618,27 +14248,23 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "255321bc-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 204, "ResponseHeaders": { "Cache-Control": "no-cache", - "Date": "Thu, 17 Mar 2022 02:15:41 GMT", + "Date": "Fri, 21 Oct 2022 05:40:51 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "255321bc-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "16f468e2-d233-47ad-aa75-4079d39830f4", + "x-ms-correlation-request-id": "e96bf602-494b-4eed-898c-38d186ff9025", "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-request-id": "b3cd23f8-2285-4b50-ac42-709eacd63b45", - "x-ms-routing-request-id": "EASTUS2:20220317T021542Z:16f468e2-d233-47ad-aa75-4079d39830f4" + "x-ms-routing-request-id": "WESTUS:20221021T054051Z:e96bf602-494b-4eed-898c-38d186ff9025" }, "ResponseBody": null }, @@ -2648,44 +14274,38 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "255321bd-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/18142b3a-f562-4fee-8e76-efe919f29092?api-version=2021-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/a0074736-16e1-472c-87a3-cbe23589e391?api-version=2021-06-01", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Thu, 17 Mar 2022 02:15:42 GMT", + "Date": "Fri, 21 Oct 2022 05:40:52 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/18142b3a-f562-4fee-8e76-efe919f29092/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/a0074736-16e1-472c-87a3-cbe23589e391/profileresults/profilename/endpointresults/endpoint9527x?api-version=2021-06-01", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "255321bd-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "a634e45a-f475-4761-9748-383e2a743349", + "x-ms-correlation-request-id": "917e05a1-aa0f-4e1c-8cfe-023bed3e230e", "x-ms-ratelimit-remaining-subscription-deletes": "14998", - "x-ms-request-id": "c93d2965-3315-4588-bfab-a819815feba1", - "x-ms-routing-request-id": "EASTUS2:20220317T021542Z:a634e45a-f475-4761-9748-383e2a743349" + "x-ms-routing-request-id": "WESTUS:20221021T054053Z:917e05a1-aa0f-4e1c-8cfe-023bed3e230e" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/18142b3a-f562-4fee-8e76-efe919f29092?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/a0074736-16e1-472c-87a3-cbe23589e391?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "255321bd-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -2693,7 +14313,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:15:52 GMT", + "Date": "Fri, 21 Oct 2022 05:40:52 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2701,11 +14321,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "255321bd-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "803a4c85-8f53-428b-baf1-5a54d9199ef8", - "x-ms-ratelimit-remaining-subscription-reads": "11973", - "x-ms-request-id": "4ed8f92f-2166-4f20-aa41-f51b4d632919", - "x-ms-routing-request-id": "EASTUS2:20220317T021552Z:803a4c85-8f53-428b-baf1-5a54d9199ef8" + "x-ms-correlation-request-id": "e8e75d6f-76a1-41ac-aec3-5a7b0a4ded58", + "x-ms-ratelimit-remaining-subscription-reads": "11962", + "x-ms-routing-request-id": "WESTUS:20221021T054053Z:e8e75d6f-76a1-41ac-aec3-5a7b0a4ded58" }, "ResponseBody": { "status": "InProgress", @@ -2716,15 +14334,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/18142b3a-f562-4fee-8e76-efe919f29092?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/a0074736-16e1-472c-87a3-cbe23589e391?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "255321bd-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -2732,7 +14348,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:16:21 GMT", + "Date": "Fri, 21 Oct 2022 05:41:23 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2740,11 +14356,9 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "255321bd-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "b1bc9612-7085-4e5b-a15e-5d7c08f272d5", - "x-ms-ratelimit-remaining-subscription-reads": "11972", - "x-ms-request-id": "cb730d3c-7748-4e8e-ab80-515efe7c0440", - "x-ms-routing-request-id": "EASTUS2:20220317T021622Z:b1bc9612-7085-4e5b-a15e-5d7c08f272d5" + "x-ms-correlation-request-id": "ede61c14-bca4-410d-8860-28c96e61c1be", + "x-ms-ratelimit-remaining-subscription-reads": "11961", + "x-ms-routing-request-id": "WESTUS:20221021T054123Z:ede61c14-bca4-410d-8860-28c96e61c1be" }, "ResponseBody": { "status": "Succeeded", @@ -2760,44 +14374,38 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "3d9be3f8-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { - "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3ecb27a6-cad4-49ab-a0ab-8e7406f5168d?api-version=2021-06-01", + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/bf35f204-07fd-494e-9e81-354f1d7cd8e0?api-version=2021-06-01", "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Thu, 17 Mar 2022 02:16:22 GMT", + "Date": "Fri, 21 Oct 2022 05:41:24 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3ecb27a6-cad4-49ab-a0ab-8e7406f5168d/profileresults/profilename?api-version=2021-06-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/bf35f204-07fd-494e-9e81-354f1d7cd8e0/profileresults/profilename?api-version=2021-06-01", "Pragma": "no-cache", "Retry-After": "10", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "3d9be3f8-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "5fa8508e-dbeb-4bca-8d1c-e9388cd7e8ff", + "x-ms-correlation-request-id": "6ce9494a-9d7b-47e4-a234-bb6cff957a7d", "x-ms-ratelimit-remaining-subscription-deletes": "14997", - "x-ms-request-id": "162d7175-591a-40d8-a06c-f3dd594c4f72", - "x-ms-routing-request-id": "EASTUS2:20220317T021623Z:5fa8508e-dbeb-4bca-8d1c-e9388cd7e8ff" + "x-ms-routing-request-id": "WESTUS:20221021T054125Z:6ce9494a-9d7b-47e4-a234-bb6cff957a7d" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/3ecb27a6-cad4-49ab-a0ab-8e7406f5168d?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/bf35f204-07fd-494e-9e81-354f1d7cd8e0?api-version=2021-06-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", - "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-python-mgmt-cdn/12.0.0 Python/3.8.12 (Linux-5.11.0-1028-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", - "x-ms-client-request-id": "3d9be3f8-a598-11ec-85ab-f5721f063853" + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -2805,7 +14413,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 17 Mar 2022 02:16:33 GMT", + "Date": "Fri, 21 Oct 2022 05:41:24 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -2813,11 +14421,44 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-client-request-id": "3d9be3f8-a598-11ec-85ab-f5721f063853", - "x-ms-correlation-request-id": "42434e29-fb6c-41ac-bc6e-ebc13ef916f5", - "x-ms-ratelimit-remaining-subscription-reads": "11971", - "x-ms-request-id": "3f90f750-8dcd-4722-b98b-b0339fab4d4a", - "x-ms-routing-request-id": "EASTUS2:20220317T021633Z:42434e29-fb6c-41ac-bc6e-ebc13ef916f5" + "x-ms-correlation-request-id": "ac6e37f3-cc92-4f43-9076-778552926cc9", + "x-ms-ratelimit-remaining-subscription-reads": "11960", + "x-ms-routing-request-id": "WESTUS:20221021T054125Z:ac6e37f3-cc92-4f43-9076-778552926cc9" + }, + "ResponseBody": { + "status": "InProgress", + "error": { + "code": "None", + "message": null + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/ae7c1d7b/providers/Microsoft.Cdn/operationresults/bf35f204-07fd-494e-9e81-354f1d7cd8e0?api-version=2021-06-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-mgmt-cdn/12.1.0b1 Python/3.8.14 (Linux-5.15.0-1022-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 21 Oct 2022 05:41:54 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "379307a9-b59a-4b79-81a4-b5b3c28dcf7c", + "x-ms-ratelimit-remaining-subscription-reads": "11959", + "x-ms-routing-request-id": "WESTUS:20221021T054155Z:379307a9-b59a-4b79-81a4-b5b3c28dcf7c" }, "ResponseBody": { "status": "Succeeded", @@ -2829,4 +14470,4 @@ } ], "Variables": {} -} +} \ No newline at end of file