diff --git a/sdk/cdn/azure-mgmt-cdn/_meta.json b/sdk/cdn/azure-mgmt-cdn/_meta.json index 6cf3316622531..3c935aef8d14c 100644 --- a/sdk/cdn/azure-mgmt-cdn/_meta.json +++ b/sdk/cdn/azure-mgmt-cdn/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e1da7cbab8d4f554484dedb676ba7bdbdf6cdf78", + "commit": "4d033b83e6ee8aa879013b8bacf2eb6a35e565ed", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.1.11", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.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", + "autorest_command": "autorest specification/cdn/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --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 f2465edeea383..be3eb8d20d1dd 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/__init__.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["CdnManagementClient"] +__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 32f76bd38fbe1..da38726eabce0 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 @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import CdnManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -38,7 +38,6 @@ RulesOperations, SecretsOperations, SecurityPoliciesOperations, - ValidateOperations, ) if TYPE_CHECKING: @@ -71,8 +70,6 @@ class CdnManagementClient( :vartype security_policies: azure.mgmt.cdn.operations.SecurityPoliciesOperations :ivar secrets: SecretsOperations operations :vartype secrets: azure.mgmt.cdn.operations.SecretsOperations - :ivar validate: ValidateOperations operations - :vartype validate: azure.mgmt.cdn.operations.ValidateOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.cdn.operations.LogAnalyticsOperations :ivar profiles: ProfilesOperations operations @@ -101,7 +98,7 @@ class CdnManagementClient( :type subscription_id: str :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 + :keyword api_version: Api Version. Default value is "2023-05-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 @@ -118,9 +115,9 @@ def __init__( self._config = CdnManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -140,7 +137,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) - self.validate = ValidateOperations(self._client, self._config, self._serialize, self._deserialize) self.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) self.profiles = ProfilesOperations(self._client, self._config, self._serialize, self._deserialize) self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -177,15 +173,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> CdnManagementClient + def __enter__(self) -> "CdnManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) 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 5dd76fe5a2a88..72b1ae5992c67 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_configuration.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_configuration.py @@ -29,14 +29,14 @@ class CdnManagementClientConfiguration(Configuration): # pylint: disable=too-ma :type credential: ~azure.core.credentials.TokenCredential :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 + :keyword api_version: Api Version. Default value is "2023-05-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: super(CdnManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-06-01") # type: str + api_version: str = kwargs.pop("api_version", "2023-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-cdn/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + 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) diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_serialization.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_serialization.py index 7c1dedb5133d3..4bae2292227bd 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_serialization.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): 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 + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): 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) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore 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", {}): @@ -621,26 +645,26 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore 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) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -659,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +699,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -718,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -726,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # 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)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -780,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +869,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -866,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): 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'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -878,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -925,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1001,10 +1036,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): 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) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # 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) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1371,7 @@ class Deserializer(object): 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): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = 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 @@ -1416,7 +1452,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1480,7 @@ def _deserialize(self, target_obj, data): 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 + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1510,7 @@ def _classify_target(self, target, data): 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. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): 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/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1579,7 @@ def _unpack_content(raw_data, content_type=None): 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 RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1601,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1783,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1834,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1846,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1862,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1877,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1907,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore 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) @@ -1886,7 +1922,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1937,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1960,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1996,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: 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 4fbf5f4fe2274..7f38712a5635c 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_vendor.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/_vendor.py @@ -27,18 +27,7 @@ def _convert_request(request, files=None): return request -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) - - -class MixinABC(ABC): +class CdnManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" _client: "PipelineClient" 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 f831c169578e5..48944bf3938a2 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.1.0b1" +VERSION = "2.0.0" diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/__init__.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/__init__.py index e4b3bc8a43463..ca0d8662c45fc 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 @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["CdnManagementClient"] +__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 fce6771322b72..97f7f6a3456b1 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 @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import CdnManagementClientConfiguration from .operations import ( @@ -38,7 +38,6 @@ RulesOperations, SecretsOperations, SecurityPoliciesOperations, - ValidateOperations, ) if TYPE_CHECKING: @@ -71,8 +70,6 @@ class CdnManagementClient( :vartype security_policies: azure.mgmt.cdn.aio.operations.SecurityPoliciesOperations :ivar secrets: SecretsOperations operations :vartype secrets: azure.mgmt.cdn.aio.operations.SecretsOperations - :ivar validate: ValidateOperations operations - :vartype validate: azure.mgmt.cdn.aio.operations.ValidateOperations :ivar log_analytics: LogAnalyticsOperations operations :vartype log_analytics: azure.mgmt.cdn.aio.operations.LogAnalyticsOperations :ivar profiles: ProfilesOperations operations @@ -101,7 +98,7 @@ class CdnManagementClient( :type subscription_id: str :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 + :keyword api_version: Api Version. Default value is "2023-05-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 @@ -118,9 +115,9 @@ def __init__( self._config = CdnManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -140,7 +137,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) - self.validate = ValidateOperations(self._client, self._config, self._serialize, self._deserialize) self.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) self.profiles = ProfilesOperations(self._client, self._config, self._serialize, self._deserialize) self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -184,5 +180,5 @@ async def __aenter__(self) -> "CdnManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) 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 67537ccaa97fe..af108b166c250 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 @@ -29,14 +29,14 @@ class CdnManagementClientConfiguration(Configuration): # pylint: disable=too-ma :type credential: ~azure.core.credentials_async.AsyncTokenCredential :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 + :keyword api_version: Api Version. Default value is "2023-05-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: super(CdnManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-06-01") # type: str + api_version: str = kwargs.pop("api_version", "2023-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 index e558875d96f7c..2fc2afd41b443 100644 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_vendor.py +++ b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/_vendor.py @@ -19,7 +19,7 @@ from .._serialization import Deserializer, Serializer -class MixinABC(ABC): +class CdnManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" _client: "AsyncPipelineClient" 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 558a501919e22..ebcf7eb374376 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 @@ -17,7 +17,6 @@ from ._rules_operations import RulesOperations from ._security_policies_operations import SecurityPoliciesOperations from ._secrets_operations import SecretsOperations -from ._validate_operations import ValidateOperations from ._log_analytics_operations import LogAnalyticsOperations from ._profiles_operations import ProfilesOperations from ._endpoints_operations import EndpointsOperations @@ -31,7 +30,7 @@ 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 * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -46,7 +45,6 @@ "RulesOperations", "SecurityPoliciesOperations", "SecretsOperations", - "ValidateOperations", "LogAnalyticsOperations", "ProfilesOperations", "EndpointsOperations", 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 935dd86559c8f..292b9d83ff26f 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,7 +39,7 @@ build_refresh_validation_token_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +73,7 @@ def list_by_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 - or CDN profile which is unique within the resource group. Required. + 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 AFDDomain or the result of cls(response) @@ -82,8 +83,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDDomainListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -106,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -122,7 +123,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -130,14 +131,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AFDDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,7 +152,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -183,8 +187,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDDomain] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -197,10 +201,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,7 +222,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -238,14 +245,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDDomain] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain, (IO, bytes)): + if isinstance(custom_domain, (IOBase, bytes)): _content = custom_domain else: _json = self._serialize.body(custom_domain, "AFDDomain") @@ -264,10 +271,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -277,21 +285,26 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 201: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 202: deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -392,7 +405,7 @@ async def begin_create( :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. Is either a model type or a IO type. Required. + :param custom_domain: Domain properties. Is either a AFDDomain 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. @@ -413,14 +426,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDDomain] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, @@ -441,10 +454,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -456,9 +469,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -479,14 +494,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDDomain] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain_update_properties, (IO, bytes)): + if isinstance(custom_domain_update_properties, (IOBase, bytes)): _content = custom_domain_update_properties else: _json = self._serialize.body(custom_domain_update_properties, "AFDDomainUpdateParameters") @@ -505,10 +520,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -518,18 +534,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -630,8 +651,8 @@ async def begin_update( :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. Is either a model type or a IO type. - Required. + :param custom_domain_update_properties: Domain properties. Is either a + AFDDomainUpdateParameters 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. @@ -652,14 +673,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDDomain] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, @@ -680,10 +701,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -695,9 +716,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, custom_domain_name: str, **kwargs: Any @@ -713,8 +736,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -727,10 +750,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -740,10 +764,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -775,11 +805,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -798,10 +828,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -813,9 +843,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 @@ -831,8 +863,8 @@ async def _refresh_validation_token_initial( # pylint: disable=inconsistent-ret _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_validation_token_request( resource_group_name=resource_group_name, @@ -845,10 +877,11 @@ async def _refresh_validation_token_initial( # pylint: disable=inconsistent-ret params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -858,10 +891,16 @@ async def _refresh_validation_token_initial( # pylint: disable=inconsistent-ret error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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" + } @distributed_trace_async async def begin_refresh_validation_token( @@ -892,11 +931,11 @@ async def begin_refresh_validation_token( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._refresh_validation_token_initial( # type: ignore resource_group_name=resource_group_name, @@ -915,10 +954,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -930,6 +969,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } 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 7cd89bd04b616..9c31f34f14221 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,7 +41,7 @@ build_update_request, build_validate_custom_domain_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,8 +85,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDEndpointListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +109,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +125,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,14 +133,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AFDEndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,7 +154,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -185,8 +189,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDEndpoint] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -199,10 +203,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,7 +224,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -240,14 +247,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDEndpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(endpoint, (IO, bytes)): + if isinstance(endpoint, (IOBase, bytes)): _content = endpoint else: _json = self._serialize.body(endpoint, "AFDEndpoint") @@ -266,10 +273,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -279,6 +287,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDEndpoint", pipeline_response) @@ -286,14 +295,18 @@ async def _create_initial( deserialized = self._deserialize("AFDEndpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -397,7 +410,7 @@ async def begin_create( :param endpoint_name: Name of the endpoint under the profile which is unique globally. Required. :type endpoint_name: str - :param endpoint: Endpoint properties. Is either a model type or a IO type. Required. + :param endpoint: Endpoint properties. Is either a AFDEndpoint 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. @@ -418,14 +431,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -446,10 +459,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -461,9 +474,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -484,14 +499,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDEndpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(endpoint_update_properties, (IO, bytes)): + if isinstance(endpoint_update_properties, (IOBase, bytes)): _content = endpoint_update_properties else: _json = self._serialize.body(endpoint_update_properties, "AFDEndpointUpdateParameters") @@ -510,10 +525,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -523,18 +539,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDEndpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -644,8 +665,8 @@ async def begin_update( :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. Is either a model type or a IO - type. Required. + :param endpoint_update_properties: Endpoint update properties. Is either a + AFDEndpointUpdateParameters 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. @@ -666,14 +687,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -694,10 +715,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -709,9 +730,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any @@ -727,8 +750,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -741,10 +764,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -754,10 +778,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -789,11 +819,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -812,10 +842,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -827,9 +857,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _purge_content_initial( # pylint: disable=inconsistent-return-statements self, @@ -850,14 +882,14 @@ async def _purge_content_initial( # pylint: disable=inconsistent-return-stateme _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(contents, (IO, bytes)): + if isinstance(contents, (IOBase, bytes)): _content = contents else: _json = self._serialize.body(contents, "AfdPurgeParameters") @@ -876,10 +908,11 @@ async def _purge_content_initial( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -889,10 +922,16 @@ async def _purge_content_initial( # pylint: disable=inconsistent-return-stateme error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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" + } @overload async def begin_purge_content( @@ -1000,7 +1039,7 @@ async def begin_purge_content( :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. + either a AfdPurgeParameters 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. @@ -1020,12 +1059,12 @@ async def begin_purge_content( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._purge_content_initial( # type: ignore resource_group_name=resource_group_name, @@ -1046,10 +1085,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -1061,16 +1100,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } @distributed_trace def list_resource_usage( 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. + """Checks the quota and actual usage of endpoints under the given Azure Front Door profile. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -1088,8 +1128,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1113,7 +1153,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1129,7 +1169,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1137,14 +1177,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1157,7 +1198,9 @@ async def get_next(next_link=None): 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" + } @overload async def validate_custom_domain( @@ -1170,8 +1213,8 @@ async def validate_custom_domain( 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. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door endpoint + in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -1203,8 +1246,8 @@ async def validate_custom_domain( 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. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door endpoint + in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -1234,8 +1277,8 @@ async def validate_custom_domain( 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. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door endpoint + in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -1245,8 +1288,8 @@ async def validate_custom_domain( :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. + :param custom_domain_properties: Custom domain to be validated. Is either a + ValidateCustomDomainInput 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. @@ -1267,14 +1310,14 @@ async def validate_custom_domain( _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.ValidateCustomDomainOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateCustomDomainOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain_properties, (IO, bytes)): + if isinstance(custom_domain_properties, (IOBase, bytes)): _content = custom_domain_properties else: _json = self._serialize.body(custom_domain_properties, "ValidateCustomDomainInput") @@ -1293,10 +1336,11 @@ async def validate_custom_domain( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1313,4 +1357,6 @@ async def validate_custom_domain( 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" + } 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 115348f8bd175..3da4f232ba850 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,7 +39,7 @@ build_list_resource_usage_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +83,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDOriginGroupListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -106,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -122,7 +123,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -130,14 +131,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AFDOriginGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,7 +152,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -182,8 +186,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDOriginGroup] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -196,10 +200,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,7 +221,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -237,14 +244,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOriginGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_group, (IO, bytes)): + if isinstance(origin_group, (IOBase, bytes)): _content = origin_group else: _json = self._serialize.body(origin_group, "AFDOriginGroup") @@ -263,10 +270,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -276,6 +284,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDOriginGroup", pipeline_response) @@ -283,14 +292,18 @@ async def _create_initial( deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -391,7 +404,8 @@ async def begin_create( :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. Is either a model type or a IO type. Required. + :param origin_group: Origin group properties. Is either a AFDOriginGroup 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. @@ -412,14 +426,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOriginGroup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, @@ -440,10 +454,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -455,9 +469,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -478,14 +494,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOriginGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_group_update_properties, (IO, bytes)): + if isinstance(origin_group_update_properties, (IOBase, bytes)): _content = origin_group_update_properties else: _json = self._serialize.body(origin_group_update_properties, "AFDOriginGroupUpdateParameters") @@ -504,10 +520,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -517,18 +534,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -629,8 +651,8 @@ async def begin_update( :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. Is either a model type or a IO - type. Required. + :param origin_group_update_properties: Origin group properties. Is either a + AFDOriginGroupUpdateParameters 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'. @@ -652,14 +674,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOriginGroup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, @@ -680,10 +702,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -695,9 +717,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, origin_group_name: str, **kwargs: Any @@ -713,8 +737,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -727,10 +751,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -740,10 +765,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -774,11 +805,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -797,10 +828,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -812,16 +843,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace def list_resource_usage( 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. + """Checks the quota and actual usage of endpoints under the given Azure Front Door profile.. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -839,8 +871,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -864,7 +896,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -880,7 +912,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -888,14 +920,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -908,4 +941,6 @@ async def get_next(next_link=None): 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" + } 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 12df229dcfb51..2333477cb723f 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,7 +38,7 @@ build_list_by_origin_group_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,8 +85,8 @@ def list_by_origin_group( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDOriginListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +126,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,14 +134,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AFDOriginListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,7 +155,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -187,8 +191,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDOrigin] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -202,10 +206,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,7 +227,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -244,14 +251,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOrigin] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin, (IO, bytes)): + if isinstance(origin, (IOBase, bytes)): _content = origin else: _json = self._serialize.body(origin, "AFDOrigin") @@ -271,10 +278,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,6 +292,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDOrigin", pipeline_response) @@ -291,14 +300,18 @@ async def _create_initial( deserialized = self._deserialize("AFDOrigin", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -408,7 +421,7 @@ async def begin_create( :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. Is either a model type or a IO type. Required. + :param origin: Origin properties. Is either a AFDOrigin 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. @@ -429,14 +442,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOrigin] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, @@ -458,10 +471,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -473,9 +486,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -497,14 +512,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOrigin] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_update_properties, (IO, bytes)): + if isinstance(origin_update_properties, (IOBase, bytes)): _content = origin_update_properties else: _json = self._serialize.body(origin_update_properties, "AFDOriginUpdateParameters") @@ -524,10 +539,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -537,18 +553,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDOrigin", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -658,8 +679,8 @@ async def begin_update( :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. Is either a model type or a IO type. - Required. + :param origin_update_properties: Origin properties. Is either a AFDOriginUpdateParameters 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. @@ -680,14 +701,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOrigin] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, @@ -709,10 +730,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -724,9 +745,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 @@ -742,8 +765,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -757,10 +780,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -770,10 +794,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -806,11 +836,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -830,10 +860,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -845,6 +875,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 57dd129410254..d19dfedfdcd3a 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 @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,19 +21,24 @@ ) 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_profiles_operations import ( + build_check_endpoint_name_availability_request, build_check_host_name_availability_request, build_list_resource_usage_request, + build_upgrade_request, + build_validate_secret_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,16 +63,164 @@ def __init__(self, *args, **kwargs) -> None: 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") + @overload + async def check_endpoint_name_availability( + self, + resource_group_name: str, + profile_name: str, + check_endpoint_name_availability_input: _models.CheckEndpointNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckEndpointNameAvailabilityOutput: + """Check the availability of an afdx endpoint name, and return the globally unique endpoint 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 which is + unique within the resource group. Required. + :type profile_name: str + :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, + profile_name: str, + check_endpoint_name_availability_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckEndpointNameAvailabilityOutput: + """Check the availability of an afdx endpoint name, and return the globally unique endpoint 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 which is + unique within the resource group. Required. + :type profile_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_async + async def check_endpoint_name_availability( + self, + resource_group_name: str, + profile_name: str, + check_endpoint_name_availability_input: Union[_models.CheckEndpointNameAvailabilityInput, IO], + **kwargs: Any + ) -> _models.CheckEndpointNameAvailabilityOutput: + """Check the availability of an afdx endpoint name, and return the globally unique endpoint 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 which is + unique within the resource group. Required. + :type profile_name: str + :param check_endpoint_name_availability_input: Input to check. Is either a + CheckEndpointNameAvailabilityInput 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckEndpointNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_endpoint_name_availability_input, (IOBase, 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( + 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, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CheckEndpointNameAvailabilityOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_endpoint_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkEndpointNameAvailability" + } + @distributed_trace def list_resource_usage( 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. + """Checks the quota and actual usage of endpoints under the given Azure Front Door 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 or CDN - profile which is unique within the resource group. Required. + :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 :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Usage or the result of cls(response) @@ -76,8 +230,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -100,7 +254,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -116,7 +270,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,14 +278,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -144,7 +299,9 @@ async def get_next(next_link=None): 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" + } @overload async def check_host_name_availability( @@ -156,12 +313,13 @@ async def check_host_name_availability( content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: - """Check the name availability of a host name. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door 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 Azure Front Door Standard or Azure Front Door Premium or CDN - profile which is unique within the resource group. Required. + :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 check_host_name_availability_input: Custom domain to be validated. Required. :type check_host_name_availability_input: ~azure.mgmt.cdn.models.CheckHostNameAvailabilityInput @@ -184,12 +342,13 @@ async def check_host_name_availability( content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: - """Check the name availability of a host name. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door 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 Azure Front Door Standard or Azure Front Door Premium or CDN - profile which is unique within the resource group. Required. + :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 check_host_name_availability_input: Custom domain to be validated. Required. :type check_host_name_availability_input: IO @@ -210,15 +369,16 @@ async def check_host_name_availability( check_host_name_availability_input: Union[_models.CheckHostNameAvailabilityInput, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: - """Check the name availability of a host name. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door 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 Azure Front Door Standard or Azure Front Door Premium or CDN - profile which is unique within the resource group. Required. + :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 check_host_name_availability_input: Custom domain to be validated. Is either a model - type or a IO type. Required. + :param check_host_name_availability_input: Custom domain to be validated. Is either a + CheckHostNameAvailabilityInput 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'. @@ -240,14 +400,14 @@ async def check_host_name_availability( _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.CheckNameAvailabilityOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_host_name_availability_input, (IO, bytes)): + if isinstance(check_host_name_availability_input, (IOBase, bytes)): _content = check_host_name_availability_input else: _json = self._serialize.body(check_host_name_availability_input, "CheckHostNameAvailabilityInput") @@ -265,10 +425,11 @@ async def check_host_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -285,4 +446,380 @@ async def check_host_name_availability( 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" + } + + @overload + async def validate_secret( + self, + resource_group_name: str, + profile_name: str, + validate_secret_input: _models.ValidateSecretInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidateSecretOutput: + """Validate a Secret in the 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 which is + unique within the resource group. Required. + :type profile_name: str + :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 validate_secret( + self, + resource_group_name: str, + profile_name: str, + validate_secret_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidateSecretOutput: + """Validate a Secret in the 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 which is + unique within the resource group. Required. + :type profile_name: str + :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) + :rtype: ~azure.mgmt.cdn.models.ValidateSecretOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate_secret( + self, + resource_group_name: str, + profile_name: str, + validate_secret_input: Union[_models.ValidateSecretInput, IO], + **kwargs: Any + ) -> _models.ValidateSecretOutput: + """Validate a Secret in the 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 which is + unique within the resource group. Required. + :type profile_name: str + :param validate_secret_input: The Secret source. Is either a ValidateSecretInput 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateSecretOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_secret_input, (IOBase, bytes)): + _content = validate_secret_input + else: + _json = self._serialize.body(validate_secret_input, "ValidateSecretInput") + + request = build_validate_secret_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, + content=_content, + template_url=self.validate_secret.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidateSecretOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_secret.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/validateSecret" + } + + async def _upgrade_initial( + self, + resource_group_name: str, + profile_name: str, + profile_upgrade_parameters: Union[_models.ProfileUpgradeParameters, IO], + **kwargs: Any + ) -> _models.Profile: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(profile_upgrade_parameters, (IOBase, bytes)): + _content = profile_upgrade_parameters + else: + _json = self._serialize.body(profile_upgrade_parameters, "ProfileUpgradeParameters") + + request = build_upgrade_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, + content=_content, + template_url=self._upgrade_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Profile", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = self._deserialize("Profile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/upgrade" + } + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + profile_name: str, + profile_upgrade_parameters: _models.ProfileUpgradeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Profile]: + """Upgrade a profile from Standard_AzureFrontDoor to Premium_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 which is + unique within the resource group. Required. + :type profile_name: str + :param profile_upgrade_parameters: Profile upgrade input parameter. Required. + :type profile_upgrade_parameters: ~azure.mgmt.cdn.models.ProfileUpgradeParameters + :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 Profile or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_upgrade( + self, + resource_group_name: str, + profile_name: str, + profile_upgrade_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Profile]: + """Upgrade a profile from Standard_AzureFrontDoor to Premium_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 which is + unique within the resource group. Required. + :type profile_name: str + :param profile_upgrade_parameters: Profile upgrade input parameter. Required. + :type profile_upgrade_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_upgrade( + self, + resource_group_name: str, + profile_name: str, + profile_upgrade_parameters: Union[_models.ProfileUpgradeParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Profile]: + """Upgrade a profile from Standard_AzureFrontDoor to Premium_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 which is + unique within the resource group. Required. + :type profile_name: str + :param profile_upgrade_parameters: Profile upgrade input parameter. Is either a + ProfileUpgradeParameters type or a IO type. Required. + :type profile_upgrade_parameters: ~azure.mgmt.cdn.models.ProfileUpgradeParameters 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._upgrade_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + profile_upgrade_parameters=profile_upgrade_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("Profile", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + 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) # type: ignore + + begin_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/upgrade" + } 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 3b668761818d6..b0b12fa3ff650 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,13 +32,13 @@ build_check_name_availability_with_subscription_request, build_validate_probe_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CdnManagementClientOperationsMixin(MixinABC): +class CdnManagementClientOperationsMixin(CdnManagementClientMixinABC): @overload async def check_endpoint_name_availability( self, @@ -101,8 +102,8 @@ async def check_endpoint_name_availability( :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. + :param check_endpoint_name_availability_input: Input to check. Is either a + CheckEndpointNameAvailabilityInput 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'. @@ -124,14 +125,14 @@ async def check_endpoint_name_availability( _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.CheckEndpointNameAvailabilityOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckEndpointNameAvailabilityOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_endpoint_name_availability_input, (IO, bytes)): + if isinstance(check_endpoint_name_availability_input, (IOBase, bytes)): _content = check_endpoint_name_availability_input else: _json = self._serialize.body(check_endpoint_name_availability_input, "CheckEndpointNameAvailabilityInput") @@ -148,10 +149,11 @@ async def check_endpoint_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -168,7 +170,9 @@ async def check_endpoint_name_availability( 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" + } @overload async def check_name_availability( @@ -217,8 +221,8 @@ async def check_name_availability( """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. + :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput + 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. @@ -239,14 +243,14 @@ async def check_name_availability( _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.CheckNameAvailabilityOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_input, (IO, bytes)): + if isinstance(check_name_availability_input, (IOBase, bytes)): _content = check_name_availability_input else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") @@ -261,10 +265,11 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -281,7 +286,7 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/providers/Microsoft.Cdn/checkNameAvailability"} # type: ignore + check_name_availability.metadata = {"url": "/providers/Microsoft.Cdn/checkNameAvailability"} @overload async def check_name_availability_with_subscription( @@ -330,8 +335,8 @@ async def check_name_availability_with_subscription( """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. + :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput + 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. @@ -352,14 +357,14 @@ async def check_name_availability_with_subscription( _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.CheckNameAvailabilityOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_input, (IO, bytes)): + if isinstance(check_name_availability_input, (IOBase, bytes)): _content = check_name_availability_input else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") @@ -375,10 +380,11 @@ async def check_name_availability_with_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -395,7 +401,9 @@ async def check_name_availability_with_subscription( 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" + } @overload async def validate_probe( @@ -443,7 +451,8 @@ async def validate_probe( 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. Is either a model type or a IO type. Required. + :param validate_probe_input: Input to check. Is either a ValidateProbeInput 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. @@ -464,14 +473,14 @@ async def validate_probe( _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.ValidateProbeOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateProbeOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_probe_input, (IO, bytes)): + if isinstance(validate_probe_input, (IOBase, bytes)): _content = validate_probe_input else: _json = self._serialize.body(validate_probe_input, "ValidateProbeInput") @@ -487,10 +496,11 @@ async def validate_probe( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,4 +517,4 @@ async def validate_probe( return deserialized - validate_probe.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe"} # type: ignore + validate_probe.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe"} 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 37f32c5e91c1c..03f367f3da8d4 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,7 +39,7 @@ build_get_request, build_list_by_endpoint_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,8 +86,8 @@ def list_by_endpoint( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomainListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,7 +111,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -126,7 +127,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -134,14 +135,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -154,7 +156,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -188,8 +192,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -203,10 +207,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -223,7 +228,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -245,14 +252,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain_properties, (IO, bytes)): + if isinstance(custom_domain_properties, (IOBase, bytes)): _content = custom_domain_properties else: _json = self._serialize.body(custom_domain_properties, "CustomDomainParameters") @@ -272,10 +279,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -285,6 +293,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CustomDomain", pipeline_response) @@ -292,14 +301,18 @@ async def _create_initial( deserialized = self._deserialize("CustomDomain", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -410,7 +423,7 @@ async def begin_create( :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. Is either a - model type or a IO type. Required. + CustomDomainParameters 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. @@ -431,14 +444,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -460,7 +473,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -472,9 +485,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _delete_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any @@ -490,8 +505,8 @@ async def _delete_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]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.CustomDomain]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -505,10 +520,11 @@ async def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -519,20 +535,25 @@ async def _delete_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) 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}" + } @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[None]: + ) -> AsyncLROPoller[_models.CustomDomain]: """Deletes an existing custom domain within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. @@ -561,13 +582,13 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -581,13 +602,17 @@ async def begin_delete( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -599,9 +624,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}" + } async def _disable_custom_https_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any @@ -617,8 +644,8 @@ async def _disable_custom_https_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[_models.CustomDomain] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) request = build_disable_custom_https_request( resource_group_name=resource_group_name, @@ -632,10 +659,11 @@ async def _disable_custom_https_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -645,18 +673,23 @@ async def _disable_custom_https_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CustomDomain", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _disable_custom_https_initial.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" + } @distributed_trace_async async def begin_disable_custom_https( @@ -690,13 +723,13 @@ async def begin_disable_custom_https( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._disable_custom_https_initial( # type: ignore + raw_result = await self._disable_custom_https_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -716,7 +749,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -728,9 +761,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_disable_custom_https.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps"} # type: ignore + begin_disable_custom_https.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps" + } async def _enable_custom_https_initial( self, @@ -752,14 +787,14 @@ async def _enable_custom_https_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain_https_parameters, (IO, bytes)): + if isinstance(custom_domain_https_parameters, (IOBase, bytes)): _content = custom_domain_https_parameters else: if custom_domain_https_parameters is not None: @@ -782,10 +817,11 @@ async def _enable_custom_https_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -795,18 +831,23 @@ async def _enable_custom_https_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CustomDomain", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _enable_custom_https_initial.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" + } @overload async def begin_enable_custom_https( @@ -922,8 +963,8 @@ async def begin_enable_custom_https( :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. + enabling ssl uses CDN managed certificate by default. Is either a CustomDomainHttpsParameters + 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. @@ -944,14 +985,14 @@ async def begin_enable_custom_https( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._enable_custom_https_initial( # type: ignore + raw_result = await self._enable_custom_https_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -973,7 +1014,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -985,6 +1026,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_enable_custom_https.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps"} # type: ignore + begin_enable_custom_https.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps" + } 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 ff2db51262e42..3bc2247052c5a 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 @@ -28,7 +28,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._edge_nodes_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,8 +66,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EdgeNode"]: _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EdgenodeResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -87,7 +87,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -103,7 +103,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,14 +111,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EdgenodeResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,4 +132,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Cdn/edgenodes"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Cdn/edgenodes"} 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 4202966861b18..4415f4146918c 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -43,7 +44,7 @@ build_update_request, build_validate_custom_domain_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,8 +88,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +112,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -127,7 +128,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -135,14 +136,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -155,7 +157,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -188,8 +192,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -202,10 +206,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,7 +227,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -243,14 +250,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(endpoint, (IO, bytes)): + if isinstance(endpoint, (IOBase, bytes)): _content = endpoint else: _json = self._serialize.body(endpoint, "Endpoint") @@ -269,10 +276,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,6 +290,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Endpoint", pipeline_response) @@ -289,14 +298,18 @@ async def _create_initial( deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -400,7 +413,7 @@ async def begin_create( :param endpoint_name: Name of the endpoint under the profile which is unique globally. Required. :type endpoint_name: str - :param endpoint: Endpoint properties. Is either a model type or a IO type. Required. + :param endpoint: Endpoint properties. Is either a Endpoint 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. @@ -421,14 +434,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -449,7 +462,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -461,9 +474,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -484,14 +499,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(endpoint_update_properties, (IO, bytes)): + if isinstance(endpoint_update_properties, (IOBase, bytes)): _content = endpoint_update_properties else: _json = self._serialize.body(endpoint_update_properties, "EndpointUpdateParameters") @@ -510,10 +525,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -523,18 +539,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -644,8 +665,8 @@ async def begin_update( :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. Is either a model type or a IO - type. Required. + :param endpoint_update_properties: Endpoint update properties. Is either a + EndpointUpdateParameters 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. @@ -666,14 +687,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -694,7 +715,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -706,9 +727,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any @@ -724,8 +747,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -738,10 +761,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -751,10 +775,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -786,11 +816,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -809,7 +839,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -821,9 +851,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _start_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any @@ -839,8 +871,8 @@ async def _start_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[_models.Endpoint] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -853,10 +885,11 @@ async def _start_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -866,18 +899,23 @@ async def _start_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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" + } @distributed_trace_async async def begin_start( @@ -909,13 +947,13 @@ async def begin_start( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._start_initial( # type: ignore + raw_result = await self._start_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -934,7 +972,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -946,9 +984,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } async def _stop_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any @@ -964,8 +1004,8 @@ async def _stop_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[_models.Endpoint] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) request = build_stop_request( resource_group_name=resource_group_name, @@ -978,10 +1018,11 @@ async def _stop_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -991,18 +1032,23 @@ async def _stop_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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" + } @distributed_trace_async async def begin_stop( @@ -1034,13 +1080,13 @@ async def begin_stop( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._stop_initial( # type: ignore + raw_result = await self._stop_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -1059,7 +1105,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1071,9 +1117,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } async def _purge_content_initial( # pylint: disable=inconsistent-return-statements self, @@ -1094,14 +1142,14 @@ async def _purge_content_initial( # pylint: disable=inconsistent-return-stateme _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(content_file_paths, (IO, bytes)): + if isinstance(content_file_paths, (IOBase, bytes)): _content = content_file_paths else: _json = self._serialize.body(content_file_paths, "PurgeParameters") @@ -1120,10 +1168,11 @@ async def _purge_content_initial( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1133,10 +1182,16 @@ async def _purge_content_initial( # pylint: disable=inconsistent-return-stateme error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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" + } @overload async def begin_purge_content( @@ -1241,8 +1296,8 @@ async def begin_purge_content( :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. Is either a model type or a - IO type. Required. + '/pictures/*' which removes all folders and files in the directory. Is either a PurgeParameters + 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. @@ -1262,12 +1317,12 @@ async def begin_purge_content( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._purge_content_initial( # type: ignore resource_group_name=resource_group_name, @@ -1288,7 +1343,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1300,9 +1355,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } async def _load_content_initial( # pylint: disable=inconsistent-return-statements self, @@ -1323,14 +1380,14 @@ async def _load_content_initial( # pylint: disable=inconsistent-return-statemen _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(content_file_paths, (IO, bytes)): + if isinstance(content_file_paths, (IOBase, bytes)): _content = content_file_paths else: _json = self._serialize.body(content_file_paths, "LoadParameters") @@ -1349,10 +1406,11 @@ async def _load_content_initial( # pylint: disable=inconsistent-return-statemen params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1362,10 +1420,16 @@ async def _load_content_initial( # pylint: disable=inconsistent-return-statemen error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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" + } @overload async def begin_load_content( @@ -1467,8 +1531,8 @@ async def begin_load_content( 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. Is either a model type or a IO type. - Required. + e.g. ‘/pictures/city.png' which loads a single file. Is either a LoadParameters 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. @@ -1488,12 +1552,12 @@ async def begin_load_content( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._load_content_initial( # type: ignore resource_group_name=resource_group_name, @@ -1514,7 +1578,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1526,9 +1590,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } @overload async def validate_custom_domain( @@ -1613,8 +1679,8 @@ async def validate_custom_domain( :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. + :param custom_domain_properties: Custom domain to be validated. Is either a + ValidateCustomDomainInput 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. @@ -1635,14 +1701,14 @@ async def validate_custom_domain( _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.ValidateCustomDomainOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateCustomDomainOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain_properties, (IO, bytes)): + if isinstance(custom_domain_properties, (IOBase, bytes)): _content = custom_domain_properties else: _json = self._serialize.body(custom_domain_properties, "ValidateCustomDomainInput") @@ -1661,10 +1727,11 @@ async def validate_custom_domain( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1681,7 +1748,9 @@ async def validate_custom_domain( 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" + } @distributed_trace def list_resource_usage( @@ -1705,8 +1774,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceUsageListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1730,7 +1799,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1746,7 +1815,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1754,14 +1823,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1774,4 +1844,6 @@ async def get_next(next_link=None): 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" + } 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 67c8dfcfcd9a5..7eac211a140d2 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 @@ -34,7 +34,7 @@ build_get_waf_log_analytics_metrics_request, build_get_waf_log_analytics_rankings_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -116,8 +116,8 @@ async def get_log_analytics_metrics( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MetricsResponse] = kwargs.pop("cls", None) request = build_get_log_analytics_metrics_request( resource_group_name=resource_group_name, @@ -138,10 +138,11 @@ async def get_log_analytics_metrics( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,7 +159,9 @@ async def get_log_analytics_metrics( 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" + } @distributed_trace_async async def get_log_analytics_rankings( @@ -208,8 +211,8 @@ async def get_log_analytics_rankings( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RankingsResponse] = kwargs.pop("cls", None) request = build_get_log_analytics_rankings_request( resource_group_name=resource_group_name, @@ -227,10 +230,11 @@ async def get_log_analytics_rankings( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,7 +251,9 @@ async def get_log_analytics_rankings( 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" + } @distributed_trace_async async def get_log_analytics_locations( @@ -276,8 +282,8 @@ async def get_log_analytics_locations( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContinentsResponse] = kwargs.pop("cls", None) request = build_get_log_analytics_locations_request( resource_group_name=resource_group_name, @@ -289,10 +295,11 @@ async def get_log_analytics_locations( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,7 +316,9 @@ async def get_log_analytics_locations( 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" + } @distributed_trace_async async def get_log_analytics_resources( @@ -338,8 +347,8 @@ async def get_log_analytics_resources( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourcesResponse] = kwargs.pop("cls", None) request = build_get_log_analytics_resources_request( resource_group_name=resource_group_name, @@ -351,10 +360,11 @@ async def get_log_analytics_resources( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -371,7 +381,9 @@ async def get_log_analytics_resources( 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" + } @distributed_trace_async async def get_waf_log_analytics_metrics( @@ -424,8 +436,8 @@ async def get_waf_log_analytics_metrics( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WafMetricsResponse] = kwargs.pop("cls", None) request = build_get_waf_log_analytics_metrics_request( resource_group_name=resource_group_name, @@ -444,10 +456,11 @@ async def get_waf_log_analytics_metrics( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -464,7 +477,9 @@ async def get_waf_log_analytics_metrics( 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" + } @distributed_trace_async async def get_waf_log_analytics_rankings( @@ -517,8 +532,8 @@ async def get_waf_log_analytics_rankings( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WafRankingsResponse] = kwargs.pop("cls", None) request = build_get_waf_log_analytics_rankings_request( resource_group_name=resource_group_name, @@ -537,10 +552,11 @@ async def get_waf_log_analytics_rankings( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,4 +573,6 @@ async def get_waf_log_analytics_rankings( 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" + } 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 8a22a7dfda9f6..c4bec21bda1ff 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 @@ -28,7 +28,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._managed_rule_sets_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,8 +67,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ManagedRuleSetDefinition _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ManagedRuleSetDefinitionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -89,7 +89,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -105,7 +105,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -113,14 +113,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ManagedRuleSetDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,4 +134,6 @@ async def get_next(next_link=None): 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" + } 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 e81f264fc127f..dc6fbad0f9878 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 @@ -28,7 +28,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,8 +65,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -86,7 +86,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -102,7 +102,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -110,14 +110,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -130,4 +131,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Cdn/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Cdn/operations"} 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 c1a48eaa9f056..57a10046532fc 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,7 +38,7 @@ build_list_by_endpoint_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,8 +85,8 @@ def list_by_endpoint( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OriginGroupListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +126,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,14 +134,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OriginGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,7 +155,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -188,8 +192,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OriginGroup] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -203,10 +207,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -223,7 +228,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -245,14 +252,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OriginGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_group, (IO, bytes)): + if isinstance(origin_group, (IOBase, bytes)): _content = origin_group else: _json = self._serialize.body(origin_group, "OriginGroup") @@ -272,10 +279,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -285,6 +293,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("OriginGroup", pipeline_response) @@ -292,14 +301,18 @@ async def _create_initial( deserialized = self._deserialize("OriginGroup", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -412,7 +425,8 @@ async def begin_create( :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. Is either a model type or a IO type. Required. + :param origin_group: Origin group properties. Is either a OriginGroup 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. @@ -433,14 +447,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OriginGroup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -462,7 +476,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -474,9 +488,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -498,14 +514,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OriginGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_group_update_properties, (IO, bytes)): + if isinstance(origin_group_update_properties, (IOBase, bytes)): _content = origin_group_update_properties else: _json = self._serialize.body(origin_group_update_properties, "OriginGroupUpdateParameters") @@ -525,10 +541,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,18 +555,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("OriginGroup", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -662,8 +684,8 @@ async def begin_update( :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. Is either a model type or a IO - type. Required. + :param origin_group_update_properties: Origin group properties. Is either a + OriginGroupUpdateParameters 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. @@ -684,14 +706,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OriginGroup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -713,7 +735,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -725,9 +747,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 @@ -743,8 +767,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -758,10 +782,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -771,10 +796,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -808,11 +839,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -832,7 +863,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -844,6 +875,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 aeedeae734026..c8c744403f784 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,7 +38,7 @@ build_list_by_endpoint_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,8 +85,8 @@ def list_by_endpoint( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OriginListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +126,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,14 +134,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OriginListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,7 +155,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -187,8 +191,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Origin] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -202,10 +206,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,7 +227,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -244,14 +251,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Origin] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin, (IO, bytes)): + if isinstance(origin, (IOBase, bytes)): _content = origin else: _json = self._serialize.body(origin, "Origin") @@ -271,10 +278,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,6 +292,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Origin", pipeline_response) @@ -291,14 +300,18 @@ async def _create_initial( deserialized = self._deserialize("Origin", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Origin", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -408,7 +421,7 @@ async def begin_create( :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. Is either a model type or a IO type. Required. + :param origin: Origin properties. Is either a Origin 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. @@ -429,14 +442,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Origin] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -458,7 +471,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -470,9 +483,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -494,14 +509,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Origin] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_update_properties, (IO, bytes)): + if isinstance(origin_update_properties, (IOBase, bytes)): _content = origin_update_properties else: _json = self._serialize.body(origin_update_properties, "OriginUpdateParameters") @@ -521,10 +536,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,18 +550,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Origin", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Origin", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -655,8 +676,8 @@ async def begin_update( :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. Is either a model type or a IO type. - Required. + :param origin_update_properties: Origin properties. Is either a OriginUpdateParameters 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. @@ -677,14 +698,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Origin] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -706,7 +727,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -718,9 +739,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 @@ -736,8 +759,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -751,10 +774,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -764,10 +788,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -800,11 +830,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -824,7 +854,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -836,6 +866,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 bb1707a8a4d55..4997f04c8729f 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,7 +38,7 @@ build_list_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +79,8 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,7 +102,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -117,7 +118,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,14 +126,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CdnWebApplicationFirewallPolicyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,7 +147,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -173,8 +177,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -186,10 +190,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -206,7 +211,9 @@ async def get( 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}" + } async def _create_or_update_initial( self, @@ -226,14 +233,14 @@ async def _create_or_update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cdn_web_application_firewall_policy, (IO, bytes)): + if isinstance(cdn_web_application_firewall_policy, (IOBase, bytes)): _content = cdn_web_application_firewall_policy else: _json = self._serialize.body(cdn_web_application_firewall_policy, "CdnWebApplicationFirewallPolicy") @@ -251,10 +258,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -264,6 +272,7 @@ async def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) @@ -271,14 +280,18 @@ async def _create_or_update_initial( deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create_or_update( @@ -367,8 +380,8 @@ async def begin_create_or_update( :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. Is either a model type or a - IO type. Required. + :param cdn_web_application_firewall_policy: Policy to be created. Is either a + CdnWebApplicationFirewallPolicy type or a IO type. Required. :type cdn_web_application_firewall_policy: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -391,14 +404,14 @@ async def begin_create_or_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy=cdn_web_application_firewall_policy, @@ -418,7 +431,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -430,9 +443,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -454,14 +469,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cdn_web_application_firewall_policy_patch_parameters, (IO, bytes)): + if isinstance(cdn_web_application_firewall_policy_patch_parameters, (IOBase, bytes)): _content = cdn_web_application_firewall_policy_patch_parameters else: _json = self._serialize.body( @@ -481,10 +496,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,18 +510,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -602,7 +623,8 @@ async def begin_update( :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. Is either a model type or a IO type. Required. + parameters to be patched. Is either a CdnWebApplicationFirewallPolicyPatchParameters type or a + IO type. Required. :type cdn_web_application_firewall_policy_patch_parameters: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -625,14 +647,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy_patch_parameters=cdn_web_application_firewall_policy_patch_parameters, @@ -652,7 +674,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -664,9 +686,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -694,8 +718,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -707,10 +731,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -723,4 +748,6 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}" + } 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 d4ca450cbe5ed..9a49825950e17 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,6 +32,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._profiles_operations import ( + build_can_migrate_request, build_create_request, build_delete_request, build_generate_sso_uri_request, @@ -39,9 +41,11 @@ build_list_request, build_list_resource_usage_request, build_list_supported_optimization_types_request, + build_migrate_request, + build_migration_commit_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +83,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Profile"]: _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProfileListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,7 +105,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -117,7 +121,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,14 +129,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,7 +150,7 @@ async def get_next(next_link=None): 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"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Profile"]: @@ -162,8 +167,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProfileListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -185,7 +190,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -201,7 +206,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,14 +214,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -229,7 +235,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> _models.Profile: @@ -257,8 +265,8 @@ async def get(self, resource_group_name: str, profile_name: str, **kwargs: Any) _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -270,10 +278,11 @@ async def get(self, resource_group_name: str, profile_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -290,7 +299,9 @@ async def get(self, resource_group_name: str, profile_name: str, **kwargs: Any) 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}" + } async def _create_initial( self, resource_group_name: str, profile_name: str, profile: Union[_models.Profile, IO], **kwargs: Any @@ -306,14 +317,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(profile, (IO, bytes)): + if isinstance(profile, (IOBase, bytes)): _content = profile else: _json = self._serialize.body(profile, "Profile") @@ -331,10 +342,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -344,6 +356,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Profile", pipeline_response) @@ -351,14 +364,18 @@ async def _create_initial( deserialized = self._deserialize("Profile", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Profile", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -446,8 +463,8 @@ async def begin_create( :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. + :param profile: Profile properties needed to create a new profile. Is either a Profile 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. @@ -468,14 +485,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, profile=profile, @@ -495,7 +512,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -507,9 +524,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -529,14 +548,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(profile_update_parameters, (IO, bytes)): + if isinstance(profile_update_parameters, (IOBase, bytes)): _content = profile_update_parameters else: _json = self._serialize.body(profile_update_parameters, "ProfileUpdateParameters") @@ -554,10 +573,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -567,18 +587,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Profile", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Profile", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -673,7 +698,7 @@ async def begin_update( 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. + either a ProfileUpdateParameters 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. @@ -694,14 +719,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, profile_update_parameters=profile_update_parameters, @@ -721,7 +746,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -733,9 +758,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, **kwargs: Any @@ -751,8 +778,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -764,10 +791,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -777,10 +805,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -808,11 +842,11 @@ async def begin_delete(self, resource_group_name: str, profile_name: str, **kwar _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -830,7 +864,552 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}" + } + + async def _can_migrate_initial( + self, resource_group_name: str, can_migrate_parameters: Union[_models.CanMigrateParameters, IO], **kwargs: Any + ) -> Optional[_models.CanMigrateResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CanMigrateResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(can_migrate_parameters, (IOBase, bytes)): + _content = can_migrate_parameters + else: + _json = self._serialize.body(can_migrate_parameters, "CanMigrateParameters") + + request = build_can_migrate_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._can_migrate_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CanMigrateResult", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _can_migrate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/canMigrate" + } + + @overload + async def begin_can_migrate( + self, + resource_group_name: str, + can_migrate_parameters: _models.CanMigrateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CanMigrateResult]: + """Checks if CDN profile can be migrated to Azure Frontdoor(Standard/Premium) profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param can_migrate_parameters: Properties needed to check if cdn profile or classic frontdoor + can be migrated. Required. + :type can_migrate_parameters: ~azure.mgmt.cdn.models.CanMigrateParameters + :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 CanMigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CanMigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_can_migrate( + self, + resource_group_name: str, + can_migrate_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CanMigrateResult]: + """Checks if CDN profile can be migrated to Azure Frontdoor(Standard/Premium) profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param can_migrate_parameters: Properties needed to check if cdn profile or classic frontdoor + can be migrated. Required. + :type can_migrate_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 CanMigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CanMigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_can_migrate( + self, resource_group_name: str, can_migrate_parameters: Union[_models.CanMigrateParameters, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.CanMigrateResult]: + """Checks if CDN profile can be migrated to Azure Frontdoor(Standard/Premium) profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param can_migrate_parameters: Properties needed to check if cdn profile or classic frontdoor + can be migrated. Is either a CanMigrateParameters type or a IO type. Required. + :type can_migrate_parameters: ~azure.mgmt.cdn.models.CanMigrateParameters 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 CanMigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.CanMigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CanMigrateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._can_migrate_initial( + resource_group_name=resource_group_name, + can_migrate_parameters=can_migrate_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("CanMigrateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + 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) # type: ignore + + begin_can_migrate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/canMigrate" + } + + async def _migrate_initial( + self, resource_group_name: str, migration_parameters: Union[_models.MigrationParameters, IO], **kwargs: Any + ) -> _models.MigrateResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(migration_parameters, (IOBase, bytes)): + _content = migration_parameters + else: + _json = self._serialize.body(migration_parameters, "MigrationParameters") + + request = build_migrate_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._migrate_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("MigrateResult", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = self._deserialize("MigrateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _migrate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/migrate" + } + + @overload + async def begin_migrate( + self, + resource_group_name: str, + migration_parameters: _models.MigrationParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrateResult]: + """Migrate the CDN profile to Azure Frontdoor(Standard/Premium) profile. The change need to be + committed after this. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param migration_parameters: Properties needed to migrate the profile. Required. + :type migration_parameters: ~azure.mgmt.cdn.models.MigrationParameters + :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 MigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.MigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_migrate( + self, + resource_group_name: str, + migration_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MigrateResult]: + """Migrate the CDN profile to Azure Frontdoor(Standard/Premium) profile. The change need to be + committed after this. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param migration_parameters: Properties needed to migrate the profile. Required. + :type migration_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 MigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.MigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_migrate( + self, resource_group_name: str, migration_parameters: Union[_models.MigrationParameters, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.MigrateResult]: + """Migrate the CDN profile to Azure Frontdoor(Standard/Premium) profile. The change need to be + committed after this. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param migration_parameters: Properties needed to migrate the profile. Is either a + MigrationParameters type or a IO type. Required. + :type migration_parameters: ~azure.mgmt.cdn.models.MigrationParameters 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 MigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cdn.models.MigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._migrate_initial( + resource_group_name=resource_group_name, + migration_parameters=migration_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("MigrateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + 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) # type: ignore + + begin_migrate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/migrate" + } + + async def _migration_commit_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_migration_commit_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._migration_commit_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _migration_commit_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/migrationCommit" + } + + @distributed_trace_async + async def begin_migration_commit( + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Commit the migrated Azure Frontdoor(Standard/Premium) 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 + :keyword callable cls: A custom type or function 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 = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._migration_commit_initial( # type: ignore + resource_group_name=resource_group_name, + profile_name=profile_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): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -842,9 +1421,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore + begin_migration_commit.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/migrationCommit" + } @distributed_trace_async async def generate_sso_uri(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> _models.SsoUri: @@ -875,8 +1456,8 @@ async def generate_sso_uri(self, resource_group_name: str, profile_name: 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.SsoUri] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SsoUri] = kwargs.pop("cls", None) request = build_generate_sso_uri_request( resource_group_name=resource_group_name, @@ -888,10 +1469,11 @@ async def generate_sso_uri(self, resource_group_name: str, profile_name: str, ** params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -908,7 +1490,9 @@ async def generate_sso_uri(self, resource_group_name: str, profile_name: str, ** 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" + } @distributed_trace_async async def list_supported_optimization_types( @@ -938,8 +1522,8 @@ async def list_supported_optimization_types( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedOptimizationTypesListResult] = kwargs.pop("cls", None) request = build_list_supported_optimization_types_request( resource_group_name=resource_group_name, @@ -951,10 +1535,11 @@ async def list_supported_optimization_types( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -971,7 +1556,9 @@ async def list_supported_optimization_types( 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" + } @distributed_trace def list_resource_usage( @@ -993,8 +1580,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceUsageListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1017,7 +1604,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1033,7 +1620,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1041,14 +1628,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1061,4 +1649,6 @@ async def get_next(next_link=None): 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" + } 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 2efe56aedf9fe..d6c74e3f581a4 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 @@ -28,7 +28,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resource_usage_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,8 +65,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceUsage"]: _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceUsageListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -87,7 +87,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -103,7 +103,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,14 +111,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,4 +132,4 @@ async def get_next(next_link=None): 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"} 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 bef111d0fa4c3..37d29ba02847e 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,7 +38,7 @@ build_list_by_endpoint_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,8 +85,8 @@ def list_by_endpoint( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RouteListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +126,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,14 +134,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RouteListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,7 +155,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -188,8 +192,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -203,10 +207,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -223,7 +228,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -245,14 +252,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(route, (IO, bytes)): + if isinstance(route, (IOBase, bytes)): _content = route else: _json = self._serialize.body(route, "Route") @@ -272,10 +279,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -285,6 +293,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Route", pipeline_response) @@ -292,14 +301,18 @@ async def _create_initial( deserialized = self._deserialize("Route", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Route", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -410,7 +423,7 @@ async def begin_create( :type endpoint_name: str :param route_name: Name of the routing rule. Required. :type route_name: str - :param route: Route properties. Is either a model type or a IO type. Required. + :param route: Route properties. Is either a Route 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. @@ -430,14 +443,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -459,10 +472,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -474,9 +487,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -498,14 +513,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(route_update_properties, (IO, bytes)): + if isinstance(route_update_properties, (IOBase, bytes)): _content = route_update_properties else: _json = self._serialize.body(route_update_properties, "RouteUpdateParameters") @@ -525,10 +540,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,18 +554,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Route", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Route", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -660,8 +681,8 @@ async def begin_update( :type endpoint_name: str :param route_name: Name of the routing rule. Required. :type route_name: str - :param route_update_properties: Route update properties. Is either a model type or a IO type. - Required. + :param route_update_properties: Route update properties. Is either a RouteUpdateParameters 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. @@ -681,14 +702,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -710,10 +731,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -725,9 +746,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 @@ -743,8 +766,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -758,10 +781,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -771,10 +795,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -808,11 +838,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -832,10 +862,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -847,6 +877,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 27de2ab036d39..a31c55e3703aa 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 @@ -37,7 +37,7 @@ build_list_by_profile_request, build_list_resource_usage_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +81,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuleSetListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,7 +105,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -121,7 +121,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -129,14 +129,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,7 +150,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -182,8 +185,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuleSet] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -196,10 +199,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,7 +220,9 @@ async def get( 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}" + } @distributed_trace_async async def create( @@ -248,8 +254,8 @@ async def create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuleSet] = kwargs.pop("cls", None) request = build_create_request( resource_group_name=resource_group_name, @@ -262,10 +268,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,11 +289,13 @@ async def create( deserialized = self._deserialize("RuleSet", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, rule_set_name: str, **kwargs: Any @@ -302,8 +311,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -316,10 +325,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -329,10 +339,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -364,11 +380,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -387,10 +403,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -402,16 +418,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace def list_resource_usage( 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. + """Checks the quota and actual usage of endpoints under the given Azure Front Door profile.. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -429,8 +446,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -454,7 +471,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -470,7 +487,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -478,14 +495,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,4 +516,6 @@ async def get_next(next_link=None): 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" + } 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 b8d3c93f7a09e..cc52c5bbcf153 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,7 +38,7 @@ build_list_by_rule_set_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +84,8 @@ def list_by_rule_set( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +109,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +125,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,14 +133,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,7 +154,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -185,8 +189,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -200,10 +204,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -220,7 +225,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -242,14 +249,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(rule, (IO, bytes)): + if isinstance(rule, (IOBase, bytes)): _content = rule else: _json = self._serialize.body(rule, "Rule") @@ -269,10 +276,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,6 +290,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Rule", pipeline_response) @@ -289,14 +298,18 @@ async def _create_initial( deserialized = self._deserialize("Rule", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Rule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -401,7 +414,7 @@ async def begin_create( :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. Is either a model type or a IO type. Required. + :param rule: The delivery rule properties. Is either a Rule 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. @@ -421,14 +434,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, @@ -450,10 +463,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -465,9 +478,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _update_initial( self, @@ -489,14 +504,14 @@ async def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(rule_update_properties, (IO, bytes)): + if isinstance(rule_update_properties, (IOBase, bytes)): _content = rule_update_properties else: _json = self._serialize.body(rule_update_properties, "RuleUpdateParameters") @@ -516,10 +531,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,18 +545,23 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Rule", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Rule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_update( @@ -645,8 +666,8 @@ async def begin_update( :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. Is either a model type or a IO type. - Required. + :param rule_update_properties: Delivery rule properties. Is either a RuleUpdateParameters 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. @@ -666,14 +687,14 @@ async def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, @@ -695,10 +716,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -710,9 +731,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 @@ -728,8 +751,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -743,10 +766,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -756,10 +780,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -791,11 +821,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -815,10 +845,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -830,6 +860,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 52f990c5d2a89..abcd24de067b8 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -36,7 +37,7 @@ build_get_request, build_list_by_profile_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +81,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SecretListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,7 +105,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -120,7 +121,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,14 +129,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecretListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -148,7 +150,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get(self, resource_group_name: str, profile_name: str, secret_name: str, **kwargs: Any) -> _models.Secret: @@ -177,8 +181,8 @@ async def get(self, resource_group_name: str, profile_name: str, secret_name: st _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -191,10 +195,11 @@ async def get(self, resource_group_name: str, profile_name: str, secret_name: st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -211,7 +216,9 @@ async def get(self, resource_group_name: str, profile_name: str, secret_name: st 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}" + } async def _create_initial( self, @@ -232,14 +239,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(secret, (IO, bytes)): + if isinstance(secret, (IOBase, bytes)): _content = secret else: _json = self._serialize.body(secret, "Secret") @@ -258,10 +265,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -271,6 +279,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Secret", pipeline_response) @@ -278,14 +287,18 @@ async def _create_initial( deserialized = self._deserialize("Secret", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Secret", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -383,7 +396,7 @@ async def begin_create( :type profile_name: str :param secret_name: Name of the Secret under the profile. Required. :type secret_name: str - :param secret: The Secret properties. Is either a model type or a IO type. Required. + :param secret: The Secret properties. Is either a Secret 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. @@ -404,14 +417,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, secret_name=secret_name, @@ -432,10 +445,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -447,9 +460,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, secret_name: str, **kwargs: Any @@ -465,8 +480,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -479,10 +494,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -492,10 +508,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -525,11 +547,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -548,10 +570,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -563,6 +585,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 808a8150e5799..a704a89fda482 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,7 +38,7 @@ build_list_by_profile_request, build_patch_request, ) -from .._vendor import MixinABC +from .._vendor import CdnManagementClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +82,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SecurityPolicyListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,7 +106,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -121,7 +122,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -129,14 +130,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SecurityPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,7 +151,9 @@ async def get_next(next_link=None): 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" + } @distributed_trace_async async def get( @@ -180,8 +184,8 @@ async def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SecurityPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -194,10 +198,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -214,7 +219,9 @@ async def get( 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}" + } async def _create_initial( self, @@ -235,14 +242,14 @@ async def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_policy, (IO, bytes)): + if isinstance(security_policy, (IOBase, bytes)): _content = security_policy else: _json = self._serialize.body(security_policy, "SecurityPolicy") @@ -261,10 +268,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -274,6 +282,7 @@ async def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SecurityPolicy", pipeline_response) @@ -281,14 +290,18 @@ async def _create_initial( deserialized = self._deserialize("SecurityPolicy", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_create( @@ -386,8 +399,8 @@ async def begin_create( :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. Is either a model type or a IO type. - Required. + :param security_policy: The security policy properties. Is either a SecurityPolicy 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. @@ -408,14 +421,14 @@ async def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, @@ -436,10 +449,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -451,9 +464,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _patch_initial( self, @@ -474,14 +489,14 @@ async def _patch_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_policy_update_properties, (IO, bytes)): + if isinstance(security_policy_update_properties, (IOBase, bytes)): _content = security_policy_update_properties else: _json = self._serialize.body(security_policy_update_properties, "SecurityPolicyUpdateParameters") @@ -500,10 +515,11 @@ async def _patch_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -513,18 +529,23 @@ async def _patch_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SecurityPolicy", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload async def begin_patch( @@ -622,8 +643,8 @@ async def begin_patch( :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. Is either a model - type or a IO type. Required. + :param security_policy_update_properties: Security policy update properties. Is either a + SecurityPolicyUpdateParameters 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'. @@ -645,14 +666,14 @@ async def begin_patch( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPolicy] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._patch_initial( # type: ignore + raw_result = await self._patch_initial( resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, @@ -673,10 +694,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -688,9 +709,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, security_policy_name: str, **kwargs: Any @@ -706,8 +729,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -720,10 +743,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -733,10 +757,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace_async async def begin_delete( @@ -766,11 +796,11 @@ async def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -789,10 +819,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = 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: @@ -804,6 +834,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 deleted file mode 100644 index 557716a4ff073..0000000000000 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/aio/operations/_validate_operations.py +++ /dev/null @@ -1,162 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, 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 -from .._vendor import MixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ValidateOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cdn.aio.CdnManagementClient`'s - :attr:`validate` attribute. - """ - - models = _models - - 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") - - @overload - async def secret( - self, - validate_secret_input: _models.ValidateSecretInput, - *, - 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: ~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) - :rtype: ~azure.mgmt.cdn.models.ValidateSecretOutput - :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: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _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.ValidateSecretOutput] - - 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, - content=_content, - template_url=self.secret.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ValidateSecretOutput", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - secret.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret"} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py b/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/models/__init__.py index 060ab1bb56ce6..112aa1acb3826 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 @@ -37,6 +37,8 @@ from ._models_py3 import CacheConfiguration from ._models_py3 import CacheExpirationActionParameters from ._models_py3 import CacheKeyQueryStringActionParameters +from ._models_py3 import CanMigrateParameters +from ._models_py3 import CanMigrateResult from ._models_py3 import CdnCertificateSourceParameters from ._models_py3 import CdnEndpoint from ._models_py3 import CdnManagedHttpsParameters @@ -134,12 +136,17 @@ from ._models_py3 import ManagedRuleSetDefinition from ._models_py3 import ManagedRuleSetDefinitionList from ._models_py3 import ManagedRuleSetList +from ._models_py3 import ManagedServiceIdentity from ._models_py3 import MatchCondition from ._models_py3 import MetricAvailability from ._models_py3 import MetricSpecification from ._models_py3 import MetricsResponse from ._models_py3 import MetricsResponseSeriesItem from ._models_py3 import MetricsResponseSeriesPropertiesItemsItem +from ._models_py3 import MigrateResult +from ._models_py3 import MigrationErrorType +from ._models_py3 import MigrationParameters +from ._models_py3 import MigrationWebApplicationFirewallMapping from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationsListResult @@ -159,8 +166,10 @@ from ._models_py3 import PolicySettings from ._models_py3 import PostArgsMatchConditionParameters from ._models_py3 import Profile +from ._models_py3 import ProfileChangeSkuWafMapping from ._models_py3 import ProfileListResult from ._models_py3 import ProfileUpdateParameters +from ._models_py3 import ProfileUpgradeParameters from ._models_py3 import ProxyResource from ._models_py3 import PurgeParameters from ._models_py3 import QueryStringMatchConditionParameters @@ -235,6 +244,7 @@ from ._models_py3 import Usage from ._models_py3 import UsageName from ._models_py3 import UsagesListResult +from ._models_py3 import UserAssignedIdentity from ._models_py3 import UserManagedHttpsParameters from ._models_py3 import ValidateCustomDomainInput from ._models_py3 import ValidateCustomDomainOutput @@ -261,6 +271,7 @@ 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 CanMigrateDefaultSku from ._cdn_management_client_enums import CdnCertificateSourceParametersTypeName from ._cdn_management_client_enums import CertificateSource from ._cdn_management_client_enums import CertificateType @@ -303,10 +314,11 @@ 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 ManagedServiceIdentityType 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 MetricsGranularity +from ._cdn_management_client_enums import MetricsSeriesUnit from ._cdn_management_client_enums import MinimumTlsVersion from ._cdn_management_client_enums import Operator from ._cdn_management_client_enums import OptimizationType @@ -383,13 +395,13 @@ 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 WafMetricsGranularity +from ._cdn_management_client_enums import WafMetricsSeriesUnit 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 * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -424,6 +436,8 @@ "CacheConfiguration", "CacheExpirationActionParameters", "CacheKeyQueryStringActionParameters", + "CanMigrateParameters", + "CanMigrateResult", "CdnCertificateSourceParameters", "CdnEndpoint", "CdnManagedHttpsParameters", @@ -521,12 +535,17 @@ "ManagedRuleSetDefinition", "ManagedRuleSetDefinitionList", "ManagedRuleSetList", + "ManagedServiceIdentity", "MatchCondition", "MetricAvailability", "MetricSpecification", "MetricsResponse", "MetricsResponseSeriesItem", "MetricsResponseSeriesPropertiesItemsItem", + "MigrateResult", + "MigrationErrorType", + "MigrationParameters", + "MigrationWebApplicationFirewallMapping", "Operation", "OperationDisplay", "OperationsListResult", @@ -546,8 +565,10 @@ "PolicySettings", "PostArgsMatchConditionParameters", "Profile", + "ProfileChangeSkuWafMapping", "ProfileListResult", "ProfileUpdateParameters", + "ProfileUpgradeParameters", "ProxyResource", "PurgeParameters", "QueryStringMatchConditionParameters", @@ -622,6 +643,7 @@ "Usage", "UsageName", "UsagesListResult", + "UserAssignedIdentity", "UserManagedHttpsParameters", "ValidateCustomDomainInput", "ValidateCustomDomainOutput", @@ -647,6 +669,7 @@ "CacheExpirationActionParametersTypeName", "CacheKeyQueryStringActionParametersTypeName", "CacheType", + "CanMigrateDefaultSku", "CdnCertificateSourceParametersTypeName", "CertificateSource", "CertificateType", @@ -689,10 +712,11 @@ "LogRanking", "LogRankingMetric", "ManagedRuleEnabledState", + "ManagedServiceIdentityType", "MatchProcessingBehavior", "MatchVariable", - "MetricsResponseGranularity", - "MetricsResponseSeriesItemUnit", + "MetricsGranularity", + "MetricsSeriesUnit", "MinimumTlsVersion", "Operator", "OptimizationType", @@ -769,8 +793,8 @@ "WafGranularity", "WafMatchVariable", "WafMetric", - "WafMetricsResponseGranularity", - "WafMetricsResponseSeriesItemUnit", + "WafMetricsGranularity", + "WafMetricsSeriesUnit", "WafRankingGroupBy", "WafRankingType", "WafRuleType", 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 79857b9e22c21..f44da6ef7f273 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 @@ -106,6 +106,13 @@ class CacheType(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "All" +class CanMigrateDefaultSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Recommended sku for the migration.""" + + STANDARD_AZURE_FRONT_DOOR = "Standard_AzureFrontDoor" + PREMIUM_AZURE_FRONT_DOOR = "Premium_AzureFrontDoor" + + class CdnCertificateSourceParametersTypeName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """CdnCertificateSourceParametersTypeName.""" @@ -478,6 +485,17 @@ class ManagedRuleEnabledState(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENABLED = "Enabled" +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + + 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. @@ -485,6 +503,7 @@ class MatchProcessingBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONTINUE = "Continue" STOP = "Stop" + CONTINUE_ENUM = "Continue" class MatchVariable(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -511,16 +530,16 @@ class MatchVariable(str, Enum, metaclass=CaseInsensitiveEnumMeta): SSL_PROTOCOL = "SslProtocol" -class MetricsResponseGranularity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """MetricsResponseGranularity.""" +class MetricsGranularity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MetricsGranularity.""" PT5_M = "PT5M" PT1_H = "PT1H" P1_D = "P1D" -class MetricsResponseSeriesItemUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """MetricsResponseSeriesItemUnit.""" +class MetricsSeriesUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MetricsSeriesUnit.""" COUNT = "count" BYTES = "bytes" @@ -708,6 +727,11 @@ class ProfileResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): ACTIVE = "Active" DELETING = "Deleting" DISABLED = "Disabled" + MIGRATING = "Migrating" + MIGRATED = "Migrated" + PENDING_MIGRATION_COMMIT = "PendingMigrationCommit" + COMMITTING_MIGRATION = "CommittingMigration" + ABORTING_MIGRATION = "AbortingMigration" class ProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1216,16 +1240,16 @@ class WafMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): CLIENT_REQUEST_COUNT = "clientRequestCount" -class WafMetricsResponseGranularity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """WafMetricsResponseGranularity.""" +class WafMetricsGranularity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WafMetricsGranularity.""" PT5_M = "PT5M" PT1_H = "PT1H" P1_D = "P1D" -class WafMetricsResponseSeriesItemUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """WafMetricsResponseSeriesItemUnit.""" +class WafMetricsSeriesUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WafMetricsSeriesUnit.""" COUNT = "count" 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 a711cfeaf34d0..40bf17abfeb43 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 @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -37,7 +37,7 @@ class ActivatedResourceReference(_serialization.Model): "is_active": {"key": "isActive", "type": "bool"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -76,7 +76,7 @@ class Resource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -86,7 +86,8 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than + required location and tags. Variables are only populated by the server, and will be ignored when sending a request. @@ -114,13 +115,14 @@ class ProxyResource(Resource): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) 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. + """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. @@ -156,6 +158,8 @@ class AFDDomain(ProxyResource): # pylint: disable=too-many-instance-attributes :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 + :ivar extended_properties: Key-Value pair representing migration properties for domains. + :vartype extended_properties: dict[str, str] :ivar validation_properties: Values the customer needs to validate domain ownership. :vartype validation_properties: ~azure.mgmt.cdn.models.DomainValidationProperties """ @@ -188,6 +192,7 @@ class AFDDomain(ProxyResource): # pylint: disable=too-many-instance-attributes "deployment_status": {"key": "properties.deploymentStatus", "type": "str"}, "domain_validation_state": {"key": "properties.domainValidationState", "type": "str"}, "host_name": {"key": "properties.hostName", "type": "str"}, + "extended_properties": {"key": "properties.extendedProperties", "type": "{str}"}, "validation_properties": {"key": "properties.validationProperties", "type": "DomainValidationProperties"}, } @@ -198,8 +203,9 @@ def __init__( azure_dns_zone: Optional["_models.ResourceReference"] = None, pre_validated_custom_domain_resource_id: Optional["_models.ResourceReference"] = None, host_name: Optional[str] = None, - **kwargs - ): + extended_properties: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """ :keyword tls_settings: The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl @@ -212,6 +218,8 @@ def __init__( :paramtype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference :keyword host_name: The host name of the domain. Must be a domain name. :paramtype host_name: str + :keyword extended_properties: Key-Value pair representing migration properties for domains. + :paramtype extended_properties: dict[str, str] """ super().__init__(**kwargs) self.profile_name = None @@ -222,6 +230,7 @@ def __init__( self.deployment_status = None self.domain_validation_state = None self.host_name = host_name + self.extended_properties = extended_properties self.validation_properties = None @@ -256,8 +265,8 @@ def __init__( certificate_type: Union[str, "_models.AfdCertificateType"], minimum_tls_version: Optional[Union[str, "_models.AfdMinimumTlsVersion"]] = None, secret: Optional["_models.ResourceReference"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword certificate_type: Defines the source of the SSL certificate. Required. Known values are: "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". @@ -275,7 +284,8 @@ def __init__( 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. + """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,7 +304,7 @@ class AFDDomainListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of domain objects if there are any. :paramtype next_link: str @@ -327,7 +337,7 @@ class AFDStateProperties(_serialization.Model): "deployment_status": {"key": "deploymentStatus", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -372,8 +382,8 @@ def __init__( tls_settings: Optional["_models.AFDDomainHttpsParameters"] = None, azure_dns_zone: Optional["_models.ResourceReference"] = None, pre_validated_custom_domain_resource_id: Optional["_models.ResourceReference"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tls_settings: The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl @@ -423,6 +433,8 @@ class AFDDomainProperties(AFDDomainUpdatePropertiesParameters, AFDStatePropertie :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. Required. :vartype host_name: str + :ivar extended_properties: Key-Value pair representing migration properties for domains. + :vartype extended_properties: dict[str, str] :ivar validation_properties: Values the customer needs to validate domain ownership. :vartype validation_properties: ~azure.mgmt.cdn.models.DomainValidationProperties """ @@ -448,6 +460,7 @@ class AFDDomainProperties(AFDDomainUpdatePropertiesParameters, AFDStatePropertie }, "domain_validation_state": {"key": "domainValidationState", "type": "str"}, "host_name": {"key": "hostName", "type": "str"}, + "extended_properties": {"key": "extendedProperties", "type": "{str}"}, "validation_properties": {"key": "validationProperties", "type": "DomainValidationProperties"}, } @@ -458,8 +471,9 @@ def __init__( tls_settings: Optional["_models.AFDDomainHttpsParameters"] = None, azure_dns_zone: Optional["_models.ResourceReference"] = None, pre_validated_custom_domain_resource_id: Optional["_models.ResourceReference"] = None, - **kwargs - ): + extended_properties: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """ :keyword tls_settings: The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl @@ -472,6 +486,8 @@ def __init__( :paramtype pre_validated_custom_domain_resource_id: ~azure.mgmt.cdn.models.ResourceReference :keyword host_name: The host name of the domain. Must be a domain name. Required. :paramtype host_name: str + :keyword extended_properties: Key-Value pair representing migration properties for domains. + :paramtype extended_properties: dict[str, str] """ super().__init__( tls_settings=tls_settings, @@ -483,6 +499,7 @@ def __init__( self.deployment_status = None self.domain_validation_state = None self.host_name = host_name + self.extended_properties = extended_properties self.validation_properties = None self.profile_name = None self.tls_settings = tls_settings @@ -528,8 +545,8 @@ def __init__( tls_settings: Optional["_models.AFDDomainHttpsParameters"] = None, azure_dns_zone: Optional["_models.ResourceReference"] = None, pre_validated_custom_domain_resource_id: Optional["_models.ResourceReference"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tls_settings: The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl @@ -586,7 +603,7 @@ class TrackedResource(Resource): "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: Any) -> None: """ :keyword location: Resource location. Required. :paramtype location: str @@ -599,7 +616,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw 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. + """Azure Front Door endpoint is the entity within a Azure Front Door 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. @@ -677,8 +696,8 @@ def __init__( auto_generated_domain_name_label_scope: Optional[ Union[str, "_models.AutoGeneratedDomainNameLabelScope"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. Required. :paramtype location: str @@ -703,7 +722,8 @@ def __init__( 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. + """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. @@ -722,7 +742,7 @@ class AFDEndpointListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of endpoint objects if there is any. :paramtype next_link: str @@ -753,7 +773,7 @@ class AFDEndpointPropertiesUpdateParameters(_serialization.Model): "enabled_state": {"key": "enabledState", "type": "str"}, } - def __init__(self, *, enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs): + def __init__(self, *, enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, **kwargs: Any) -> None: """ :keyword enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Known values are: "Enabled" and "Disabled". @@ -813,8 +833,8 @@ def __init__( auto_generated_domain_name_label_scope: Optional[ Union[str, "_models.AutoGeneratedDomainNameLabelScope"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled_state: Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. Known values are: "Enabled" and "Disabled". @@ -863,8 +883,8 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Endpoint tags. :paramtype tags: dict[str, str] @@ -879,7 +899,8 @@ def __init__( 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.). + """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. :vartype error: ~azure.mgmt.cdn.models.ErrorDetail @@ -889,7 +910,7 @@ class AfdErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.cdn.models.ErrorDetail @@ -899,7 +920,9 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): 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. + """Azure Front Door origin is the source of the content being delivered via Azure Front Door. 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. @@ -923,8 +946,8 @@ class AFDOrigin(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. :vartype https_port: int :ivar origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin + leave this blank, the request hostname determines this value. Azure Front Door origins, such as + Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. :vartype origin_host_header: str :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities @@ -994,16 +1017,16 @@ def __init__( *, azure_origin: Optional["_models.ResourceReference"] = None, host_name: Optional[str] = None, - http_port: Optional[int] = None, - https_port: Optional[int] = None, + http_port: int = 80, + https_port: int = 443, origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, shared_private_link_resource: Optional["_models.SharedPrivateLinkResourceProperties"] = None, enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, enforce_certificate_name_check: bool = True, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_origin: Resource reference to the Azure origin resource. :paramtype azure_origin: ~azure.mgmt.cdn.models.ResourceReference @@ -1015,8 +1038,8 @@ def __init__( :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. :paramtype https_port: int :keyword origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin + leave this blank, the request hostname determines this value. Azure Front Door origins, such as + Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. :paramtype origin_host_header: str :keyword priority: Priority of origin in given origin group for load balancing. Higher @@ -1055,7 +1078,8 @@ def __init__( 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. + """AFDOrigin group comprising of origins is used for load balancing to origins when the content + cannot be served from Azure Front Door. Variables are only populated by the server, and will be ignored when sending a request. @@ -1127,8 +1151,8 @@ def __init__( 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, "_models.EnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword load_balancing_settings: Load balancing settings for a backend pool. :paramtype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters @@ -1156,11 +1180,12 @@ def __init__( 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. + """Result of the request to list origin groups. It contains a list of origin groups objects and a + URL link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of CDN origin groups within an endpoint. + :ivar value: List of Azure Front Door origin groups within an Azure Front Door endpoint. :vartype value: list[~azure.mgmt.cdn.models.AFDOriginGroup] :ivar next_link: URL to get the next set of origin objects if there are any. :vartype next_link: str @@ -1175,7 +1200,7 @@ class AFDOriginGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of origin objects if there are any. :paramtype next_link: str @@ -1229,8 +1254,8 @@ def __init__( 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, "_models.EnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword load_balancing_settings: Load balancing settings for a backend pool. :paramtype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters @@ -1309,8 +1334,8 @@ def __init__( 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, "_models.EnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword load_balancing_settings: Load balancing settings for a backend pool. :paramtype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters @@ -1390,8 +1415,8 @@ def __init__( 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, "_models.EnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword load_balancing_settings: Load balancing settings for a backend pool. :paramtype load_balancing_settings: ~azure.mgmt.cdn.models.LoadBalancingSettingsParameters @@ -1417,11 +1442,12 @@ def __init__( 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. + """Result of the request to list origins. It contains a list of origin objects and a URL link to + get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of CDN origins within an endpoint. + :ivar value: List of Azure Front Door origins within an Azure Front Door endpoint. :vartype value: list[~azure.mgmt.cdn.models.AFDOrigin] :ivar next_link: URL to get the next set of origin objects if there are any. :vartype next_link: str @@ -1436,7 +1462,7 @@ class AFDOriginListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of origin objects if there are any. :paramtype next_link: str @@ -1463,8 +1489,8 @@ class AFDOriginUpdatePropertiesParameters(_serialization.Model): # pylint: disa :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. :vartype https_port: int :ivar origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin + leave this blank, the request hostname determines this value. Azure Front Door origins, such as + Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. :vartype origin_host_header: str :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities @@ -1516,16 +1542,16 @@ def __init__( *, azure_origin: Optional["_models.ResourceReference"] = None, host_name: Optional[str] = None, - http_port: Optional[int] = None, - https_port: Optional[int] = None, + http_port: int = 80, + https_port: int = 443, origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, shared_private_link_resource: Optional["_models.SharedPrivateLinkResourceProperties"] = None, enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, enforce_certificate_name_check: bool = True, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_origin: Resource reference to the Azure origin resource. :paramtype azure_origin: ~azure.mgmt.cdn.models.ResourceReference @@ -1537,8 +1563,8 @@ def __init__( :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. :paramtype https_port: int :keyword origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin + leave this blank, the request hostname determines this value. Azure Front Door origins, such as + Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. :paramtype origin_host_header: str :keyword priority: Priority of origin in given origin group for load balancing. Higher @@ -1599,8 +1625,8 @@ class AFDOriginProperties( :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. :vartype https_port: int :ivar origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin + leave this blank, the request hostname determines this value. Azure Front Door origins, such as + Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. :vartype origin_host_header: str :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities @@ -1656,16 +1682,16 @@ def __init__( *, azure_origin: Optional["_models.ResourceReference"] = None, host_name: Optional[str] = None, - http_port: Optional[int] = None, - https_port: Optional[int] = None, + http_port: int = 80, + https_port: int = 443, origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, shared_private_link_resource: Optional["_models.SharedPrivateLinkResourceProperties"] = None, enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, enforce_certificate_name_check: bool = True, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_origin: Resource reference to the Azure origin resource. :paramtype azure_origin: ~azure.mgmt.cdn.models.ResourceReference @@ -1677,8 +1703,8 @@ def __init__( :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. :paramtype https_port: int :keyword origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin + leave this blank, the request hostname determines this value. Azure Front Door origins, such as + Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. :paramtype origin_host_header: str :keyword priority: Priority of origin in given origin group for load balancing. Higher @@ -1745,8 +1771,8 @@ class AFDOriginUpdateParameters(_serialization.Model): # pylint: disable=too-ma :ivar https_port: The value of the HTTPS port. Must be between 1 and 65535. :vartype https_port: int :ivar origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin + leave this blank, the request hostname determines this value. Azure Front Door origins, such as + Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. :vartype origin_host_header: str :ivar priority: Priority of origin in given origin group for load balancing. Higher priorities @@ -1798,16 +1824,16 @@ def __init__( *, azure_origin: Optional["_models.ResourceReference"] = None, host_name: Optional[str] = None, - http_port: Optional[int] = None, - https_port: Optional[int] = None, + http_port: int = 80, + https_port: int = 443, origin_host_header: Optional[str] = None, priority: Optional[int] = None, weight: Optional[int] = None, shared_private_link_resource: Optional["_models.SharedPrivateLinkResourceProperties"] = None, enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, enforce_certificate_name_check: bool = True, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword azure_origin: Resource reference to the Azure origin resource. :paramtype azure_origin: ~azure.mgmt.cdn.models.ResourceReference @@ -1819,8 +1845,8 @@ def __init__( :keyword https_port: The value of the HTTPS port. Must be between 1 and 65535. :paramtype https_port: int :keyword origin_host_header: The host header value sent to the origin with each request. If you - leave this blank, the request hostname determines this value. Azure CDN origins, such as Web - Apps, Blob Storage, and Cloud Services require this host header value to match the origin + leave this blank, the request hostname determines this value. Azure Front Door origins, such as + Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. :paramtype origin_host_header: str :keyword priority: Priority of origin in given origin group for load balancing. Higher @@ -1877,7 +1903,7 @@ class AfdPurgeParameters(_serialization.Model): "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: Any) -> None: """ :keyword content_paths: The path to the content to be purged. Can describe a file path or a wild card directory. Required. @@ -1891,7 +1917,8 @@ def __init__(self, *, content_paths: List[str], domains: Optional[List[str]] = N class AfdRouteCacheConfiguration(_serialization.Model): - """Caching settings for a caching-type route. To disable caching, do not provide a cacheConfiguration object. + """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 @@ -1918,8 +1945,8 @@ def __init__( query_string_caching_behavior: Optional[Union[str, "_models.AfdQueryStringCachingBehavior"]] = None, query_parameters: Optional[str] = None, compression_settings: Optional["_models.CompressionSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :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, @@ -1964,7 +1991,7 @@ class Certificate(_serialization.Model): "expiration_date": {"key": "expirationDate", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SecretType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SecretType"]] = None, **kwargs: Any) -> None: """ :keyword type: The type of the secret resource. Known values are: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". @@ -1977,7 +2004,8 @@ def __init__(self, *, type: Optional[Union[str, "_models.SecretType"]] = None, * class AzureFirstPartyManagedCertificate(Certificate): - """Azure FirstParty Managed Certificate provided by other first party resource providers to enable HTTPS. + """Azure FirstParty Managed Certificate provided by other first party resource providers to enable + HTTPS. Variables are only populated by the server, and will be ignored when sending a request. @@ -2001,7 +2029,7 @@ class AzureFirstPartyManagedCertificate(Certificate): "expiration_date": {"key": "expirationDate", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SecretType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SecretType"]] = None, **kwargs: Any) -> None: """ :keyword type: The type of the secret resource. Known values are: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". @@ -2041,38 +2069,76 @@ class SecretParameters(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None class AzureFirstPartyManagedCertificateParameters(SecretParameters): - """Azure FirstParty Managed Certificate provided by other first party resource providers to enable HTTPS. + """Azure FirstParty Managed Certificate provided by other first party resource providers to enable + HTTPS. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :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: Resource reference to the Azure Key Vault certificate. Expected to be in + format of + /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. + :vartype secret_source: ~azure.mgmt.cdn.models.ResourceReference + :ivar subject: Subject name in the certificate. + :vartype subject: str + :ivar expiration_date: Certificate expiration date. + :vartype expiration_date: str + :ivar certificate_authority: Certificate issuing authority. + :vartype certificate_authority: str + :ivar subject_alternative_names: The list of SANs. + :vartype subject_alternative_names: list[str] + :ivar thumbprint: Certificate thumbprint. + :vartype thumbprint: str """ _validation = { "type": {"required": True}, + "secret_source": {"readonly": 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"}, + "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, **kwargs): - """ """ + def __init__(self, *, subject_alternative_names: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword subject_alternative_names: The list of SANs. + :paramtype subject_alternative_names: list[str] + """ super().__init__(**kwargs) - self.type = "AzureFirstPartyManagedCertificate" # type: str + self.type: str = "AzureFirstPartyManagedCertificate" + self.secret_source = None + self.subject = None + self.expiration_date = None + self.certificate_authority = None + self.subject_alternative_names = subject_alternative_names + self.thumbprint = None class CacheConfiguration(_serialization.Model): - """Caching settings for a caching-type route. To disable caching, do not provide a cacheConfiguration object. + """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 @@ -2112,8 +2178,8 @@ def __init__( is_compression_enabled: Optional[Union[str, "_models.RuleIsCompressionEnabled"]] = None, cache_behavior: Optional[Union[str, "_models.RuleCacheBehavior"]] = None, cache_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :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, @@ -2181,8 +2247,8 @@ def __init__( cache_behavior: Union[str, "_models.CacheBehavior"], cache_type: Union[str, "_models.CacheType"], cache_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleCacheExpirationActionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.CacheExpirationActionParametersTypeName @@ -2233,8 +2299,8 @@ def __init__( type_name: Union[str, "_models.CacheKeyQueryStringActionParametersTypeName"], query_string_behavior: Union[str, "_models.QueryStringBehavior"], query_parameters: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.CacheKeyQueryStringActionParametersTypeName @@ -2250,6 +2316,80 @@ def __init__( self.query_parameters = query_parameters +class CanMigrateParameters(_serialization.Model): + """Request body for CanMigrate operation. + + All required parameters must be populated in order to send to Azure. + + :ivar classic_resource_reference: Resource reference of the classic cdn profile or classic + frontdoor that need to be migrated. Required. + :vartype classic_resource_reference: ~azure.mgmt.cdn.models.ResourceReference + """ + + _validation = { + "classic_resource_reference": {"required": True}, + } + + _attribute_map = { + "classic_resource_reference": {"key": "classicResourceReference", "type": "ResourceReference"}, + } + + def __init__(self, *, classic_resource_reference: "_models.ResourceReference", **kwargs: Any) -> None: + """ + :keyword classic_resource_reference: Resource reference of the classic cdn profile or classic + frontdoor that need to be migrated. Required. + :paramtype classic_resource_reference: ~azure.mgmt.cdn.models.ResourceReference + """ + super().__init__(**kwargs) + self.classic_resource_reference = classic_resource_reference + + +class CanMigrateResult(_serialization.Model): + """Result for canMigrate operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar type: Resource type. + :vartype type: str + :ivar can_migrate: Flag that says if the profile can be migrated. + :vartype can_migrate: bool + :ivar default_sku: Recommended sku for the migration. Known values are: + "Standard_AzureFrontDoor" and "Premium_AzureFrontDoor". + :vartype default_sku: str or ~azure.mgmt.cdn.models.CanMigrateDefaultSku + :ivar errors: + :vartype errors: list[~azure.mgmt.cdn.models.MigrationErrorType] + """ + + _validation = { + "id": {"readonly": True}, + "type": {"readonly": True}, + "can_migrate": {"readonly": True}, + "default_sku": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "can_migrate": {"key": "properties.canMigrate", "type": "bool"}, + "default_sku": {"key": "properties.defaultSku", "type": "str"}, + "errors": {"key": "properties.errors", "type": "[MigrationErrorType]"}, + } + + def __init__(self, *, errors: Optional[List["_models.MigrationErrorType"]] = None, **kwargs: Any) -> None: + """ + :keyword errors: + :paramtype errors: list[~azure.mgmt.cdn.models.MigrationErrorType] + """ + super().__init__(**kwargs) + self.id = None + self.type = None + self.can_migrate = None + self.default_sku = None + self.errors = errors + + class CdnCertificateSourceParameters(_serialization.Model): """Defines the parameters for using CDN managed certificate for securing custom domain. @@ -2277,8 +2417,8 @@ def __init__( *, type_name: Union[str, "_models.CdnCertificateSourceParametersTypeName"], certificate_type: Union[str, "_models.CertificateType"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "CdnCertificateSourceParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.CdnCertificateSourceParametersTypeName @@ -2302,7 +2442,7 @@ class CdnEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: ARM Resource ID string. :paramtype id: str @@ -2350,8 +2490,8 @@ def __init__( *, protocol_type: Union[str, "_models.ProtocolType"], minimum_tls_version: Optional[Union[str, "_models.MinimumTlsVersion"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword protocol_type: Defines the TLS extension protocol that is used for secure delivery. Required. Known values are: "ServerNameIndication" and "IPBased". @@ -2361,7 +2501,7 @@ def __init__( :paramtype minimum_tls_version: str or ~azure.mgmt.cdn.models.MinimumTlsVersion """ super().__init__(**kwargs) - self.certificate_source = None # type: Optional[str] + self.certificate_source: Optional[str] = None self.protocol_type = protocol_type self.minimum_tls_version = minimum_tls_version @@ -2407,8 +2547,8 @@ def __init__( protocol_type: Union[str, "_models.ProtocolType"], certificate_source_parameters: "_models.CdnCertificateSourceParameters", minimum_tls_version: Optional[Union[str, "_models.MinimumTlsVersion"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword protocol_type: Defines the TLS extension protocol that is used for secure delivery. Required. Known values are: "ServerNameIndication" and "IPBased". @@ -2421,7 +2561,7 @@ def __init__( :paramtype certificate_source_parameters: ~azure.mgmt.cdn.models.CdnCertificateSourceParameters """ super().__init__(protocol_type=protocol_type, minimum_tls_version=minimum_tls_version, **kwargs) - self.certificate_source = "Cdn" # type: str + self.certificate_source: str = "Cdn" self.certificate_source_parameters = certificate_source_parameters @@ -2460,6 +2600,9 @@ class CdnWebApplicationFirewallPolicy(TrackedResource): # pylint: disable=too-m :ivar endpoint_links: Describes Azure CDN endpoints associated with this Web Application Firewall policy. :vartype endpoint_links: list[~azure.mgmt.cdn.models.CdnEndpoint] + :ivar extended_properties: Key-Value pair representing additional properties for Web + Application Firewall policy. + :vartype extended_properties: dict[str, str] :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 @@ -2494,6 +2637,7 @@ class CdnWebApplicationFirewallPolicy(TrackedResource): # pylint: disable=too-m "custom_rules": {"key": "properties.customRules", "type": "CustomRuleList"}, "managed_rules": {"key": "properties.managedRules", "type": "ManagedRuleSetList"}, "endpoint_links": {"key": "properties.endpointLinks", "type": "[CdnEndpoint]"}, + "extended_properties": {"key": "properties.extendedProperties", "type": "{str}"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "resource_state": {"key": "properties.resourceState", "type": "str"}, } @@ -2509,8 +2653,9 @@ def __init__( rate_limit_rules: Optional["_models.RateLimitRuleList"] = None, custom_rules: Optional["_models.CustomRuleList"] = None, managed_rules: Optional["_models.ManagedRuleSetList"] = None, - **kwargs - ): + extended_properties: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """ :keyword location: Resource location. Required. :paramtype location: str @@ -2529,6 +2674,9 @@ def __init__( :paramtype custom_rules: ~azure.mgmt.cdn.models.CustomRuleList :keyword managed_rules: Describes managed rules inside the policy. :paramtype managed_rules: ~azure.mgmt.cdn.models.ManagedRuleSetList + :keyword extended_properties: Key-Value pair representing additional properties for Web + Application Firewall policy. + :paramtype extended_properties: dict[str, str] """ super().__init__(location=location, tags=tags, **kwargs) self.etag = etag @@ -2538,12 +2686,14 @@ def __init__( self.custom_rules = custom_rules self.managed_rules = managed_rules self.endpoint_links = None + self.extended_properties = extended_properties self.provisioning_state = None self.resource_state = None 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. + """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. @@ -2563,7 +2713,7 @@ class CdnWebApplicationFirewallPolicyList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of WebApplicationFirewallPolicy objects if there are any. @@ -2585,7 +2735,7 @@ class CdnWebApplicationFirewallPolicyPatchParameters(_serialization.Model): "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: Any) -> None: """ :keyword tags: CdnWebApplicationFirewallPolicy tags. :paramtype tags: dict[str, str] @@ -2630,8 +2780,8 @@ def __init__( auto_generated_domain_name_label_scope: Optional[ Union[str, "_models.AutoGeneratedDomainNameLabelScope"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The resource name to validate. Required. :paramtype name: str @@ -2681,7 +2831,7 @@ class CheckEndpointNameAvailabilityOutput(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name_available = None @@ -2707,7 +2857,7 @@ class CheckHostNameAvailabilityInput(_serialization.Model): "host_name": {"key": "hostName", "type": "str"}, } - def __init__(self, *, host_name: str, **kwargs): + def __init__(self, *, host_name: str, **kwargs: Any) -> None: """ :keyword host_name: The host name to validate. Required. :paramtype host_name: str @@ -2738,7 +2888,7 @@ class CheckNameAvailabilityInput(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: Union[str, "_models.ResourceType"], **kwargs): + def __init__(self, *, name: str, type: Union[str, "_models.ResourceType"], **kwargs: Any) -> None: """ :keyword name: The resource name to validate. Required. :paramtype name: str @@ -2776,7 +2926,7 @@ class CheckNameAvailabilityOutput(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name_available = None @@ -2798,7 +2948,9 @@ class CidrIpAddress(_serialization.Model): "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: Any + ) -> None: """ :keyword base_ip_address: Ip address itself. :paramtype base_ip_address: str @@ -2847,11 +2999,11 @@ def __init__( *, type_name: Union[str, "_models.ClientPortMatchConditionParametersTypeName"], operator: Union[str, "_models.ClientPortOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleClientPortConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.ClientPortMatchConditionParametersTypeName @@ -2888,7 +3040,9 @@ class Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesD "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: Any + ) -> None: """ :keyword date_time: :paramtype date_time: ~datetime.datetime @@ -2914,7 +3068,9 @@ class Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesData "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: Any + ) -> None: """ :keyword date_time: :paramtype date_time: ~datetime.datetime @@ -2944,8 +3100,13 @@ class ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMet } 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: Any + ) -> None: """ :keyword metric: :paramtype metric: str @@ -2983,8 +3144,8 @@ def __init__( *, content_types_to_compress: Optional[List[str]] = None, is_compression_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword content_types_to_compress: List of content types on which compression applies. The value should be a valid MIME type. @@ -3020,8 +3181,8 @@ def __init__( *, continents: Optional[List["_models.ContinentsResponseContinentsItem"]] = None, country_or_regions: Optional[List["_models.ContinentsResponseCountryOrRegionsItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword continents: :paramtype continents: list[~azure.mgmt.cdn.models.ContinentsResponseContinentsItem] @@ -3045,7 +3206,7 @@ class ContinentsResponseContinentsItem(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: :paramtype id: str @@ -3073,8 +3234,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin continent_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: :paramtype id: str @@ -3127,11 +3288,11 @@ def __init__( type_name: Union[str, "_models.CookiesMatchConditionParametersTypeName"], operator: Union[str, "_models.CookiesOperator"], selector: Optional[str] = None, - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleCookiesConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.CookiesMatchConditionParametersTypeName @@ -3158,7 +3319,8 @@ def __init__( 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. + """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. @@ -3229,8 +3391,8 @@ def __init__( host_name: Optional[str] = None, custom_https_parameters: Optional["_models.CustomDomainHttpsParameters"] = None, validation_data: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword host_name: The host name of the custom domain. Must be a domain name. :paramtype host_name: str @@ -3252,7 +3414,8 @@ def __init__( 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. + """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. @@ -3271,7 +3434,7 @@ class CustomDomainListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of custom domain objects if there are any. :paramtype next_link: str @@ -3292,7 +3455,7 @@ class CustomDomainParameters(_serialization.Model): "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: Any) -> None: """ :keyword host_name: The host name of the custom domain. Must be a domain name. :paramtype host_name: str @@ -3356,8 +3519,8 @@ def __init__( secret_version: Optional[str] = None, use_latest_version: Optional[bool] = None, subject_alternative_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of the secret resource. Known values are: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". @@ -3441,8 +3604,8 @@ def __init__( secret_version: Optional[str] = None, use_latest_version: Optional[bool] = None, subject_alternative_names: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword secret_source: Resource reference to the Azure Key Vault certificate. Expected to be in format of @@ -3457,7 +3620,7 @@ def __init__( :paramtype subject_alternative_names: list[str] """ super().__init__(**kwargs) - self.type = "CustomerCertificate" # type: str + self.type: str = "CustomerCertificate" self.secret_source = secret_source self.secret_version = secret_version self.use_latest_version = use_latest_version @@ -3511,8 +3674,8 @@ def __init__( match_conditions: List["_models.MatchCondition"], action: Union[str, "_models.ActionType"], enabled_state: Optional[Union[str, "_models.CustomRuleEnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Defines the name of the custom rule. Required. :paramtype name: str @@ -3547,7 +3710,7 @@ class CustomRuleList(_serialization.Model): "rules": {"key": "rules", "type": "[CustomRule]"}, } - def __init__(self, *, rules: Optional[List["_models.CustomRule"]] = None, **kwargs): + def __init__(self, *, rules: Optional[List["_models.CustomRule"]] = None, **kwargs: Any) -> None: """ :keyword rules: List of rules. :paramtype rules: list[~azure.mgmt.cdn.models.CustomRule] @@ -3581,7 +3744,9 @@ class DeepCreatedCustomDomain(_serialization.Model): "validation_data": {"key": "properties.validationData", "type": "str"}, } - def __init__(self, *, name: str, host_name: Optional[str] = None, validation_data: Optional[str] = None, **kwargs): + def __init__( + self, *, name: str, host_name: Optional[str] = None, validation_data: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword name: Custom domain name. Required. :paramtype name: str @@ -3686,8 +3851,8 @@ def __init__( private_link_resource_id: Optional[str] = None, private_link_location: Optional[str] = None, private_link_approval_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Origin name which must be unique within the endpoint. Required. :paramtype name: str @@ -3743,7 +3908,8 @@ def __init__( 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. + """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. @@ -3794,8 +3960,8 @@ def __init__( response_based_origin_error_detection_settings: Optional[ "_models.ResponseBasedOriginErrorDetectionParameters" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Origin group name which must be unique within the endpoint. Required. :paramtype name: str @@ -3862,8 +4028,8 @@ def __init__( actions: List["_models.DeliveryRuleAction"], name: Optional[str] = None, conditions: Optional[List["_models.DeliveryRuleCondition"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the rule. :paramtype name: str @@ -3925,10 +4091,10 @@ class DeliveryRuleAction(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None # type: Optional[str] + self.name: Optional[str] = None class DeliveryRuleCacheExpirationAction(DeliveryRuleAction): @@ -3955,13 +4121,13 @@ class DeliveryRuleCacheExpirationAction(DeliveryRuleAction): "parameters": {"key": "parameters", "type": "CacheExpirationActionParameters"}, } - def __init__(self, *, parameters: "_models.CacheExpirationActionParameters", **kwargs): + def __init__(self, *, parameters: "_models.CacheExpirationActionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.CacheExpirationActionParameters """ super().__init__(**kwargs) - self.name = "CacheExpiration" # type: str + self.name: str = "CacheExpiration" self.parameters = parameters @@ -3989,13 +4155,13 @@ class DeliveryRuleCacheKeyQueryStringAction(DeliveryRuleAction): "parameters": {"key": "parameters", "type": "CacheKeyQueryStringActionParameters"}, } - def __init__(self, *, parameters: "_models.CacheKeyQueryStringActionParameters", **kwargs): + def __init__(self, *, parameters: "_models.CacheKeyQueryStringActionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.CacheKeyQueryStringActionParameters """ super().__init__(**kwargs) - self.name = "CacheKeyQueryString" # type: str + self.name: str = "CacheKeyQueryString" self.parameters = parameters @@ -4054,10 +4220,10 @@ class DeliveryRuleCondition(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None # type: Optional[str] + self.name: Optional[str] = None class DeliveryRuleClientPortCondition(DeliveryRuleCondition): @@ -4084,13 +4250,13 @@ class DeliveryRuleClientPortCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "ClientPortMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.ClientPortMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.ClientPortMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.ClientPortMatchConditionParameters """ super().__init__(**kwargs) - self.name = "ClientPort" # type: str + self.name: str = "ClientPort" self.parameters = parameters @@ -4118,13 +4284,13 @@ class DeliveryRuleCookiesCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "CookiesMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.CookiesMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.CookiesMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.CookiesMatchConditionParameters """ super().__init__(**kwargs) - self.name = "Cookies" # type: str + self.name: str = "Cookies" self.parameters = parameters @@ -4152,13 +4318,13 @@ class DeliveryRuleHostNameCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "HostNameMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.HostNameMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.HostNameMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.HostNameMatchConditionParameters """ super().__init__(**kwargs) - self.name = "HostName" # type: str + self.name: str = "HostName" self.parameters = parameters @@ -4186,13 +4352,13 @@ class DeliveryRuleHttpVersionCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "HttpVersionMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.HttpVersionMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.HttpVersionMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.HttpVersionMatchConditionParameters """ super().__init__(**kwargs) - self.name = "HttpVersion" # type: str + self.name: str = "HttpVersion" self.parameters = parameters @@ -4220,13 +4386,13 @@ class DeliveryRuleIsDeviceCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "IsDeviceMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.IsDeviceMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.IsDeviceMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.IsDeviceMatchConditionParameters """ super().__init__(**kwargs) - self.name = "IsDevice" # type: str + self.name: str = "IsDevice" self.parameters = parameters @@ -4254,13 +4420,13 @@ class DeliveryRulePostArgsCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "PostArgsMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.PostArgsMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.PostArgsMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.PostArgsMatchConditionParameters """ super().__init__(**kwargs) - self.name = "PostArgs" # type: str + self.name: str = "PostArgs" self.parameters = parameters @@ -4288,13 +4454,13 @@ class DeliveryRuleQueryStringCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "QueryStringMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.QueryStringMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.QueryStringMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.QueryStringMatchConditionParameters """ super().__init__(**kwargs) - self.name = "QueryString" # type: str + self.name: str = "QueryString" self.parameters = parameters @@ -4322,13 +4488,13 @@ class DeliveryRuleRemoteAddressCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "RemoteAddressMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.RemoteAddressMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.RemoteAddressMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RemoteAddressMatchConditionParameters """ super().__init__(**kwargs) - self.name = "RemoteAddress" # type: str + self.name: str = "RemoteAddress" self.parameters = parameters @@ -4356,13 +4522,13 @@ class DeliveryRuleRequestBodyCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "RequestBodyMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.RequestBodyMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.RequestBodyMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RequestBodyMatchConditionParameters """ super().__init__(**kwargs) - self.name = "RequestBody" # type: str + self.name: str = "RequestBody" self.parameters = parameters @@ -4390,13 +4556,13 @@ class DeliveryRuleRequestHeaderAction(DeliveryRuleAction): "parameters": {"key": "parameters", "type": "HeaderActionParameters"}, } - def __init__(self, *, parameters: "_models.HeaderActionParameters", **kwargs): + def __init__(self, *, parameters: "_models.HeaderActionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.HeaderActionParameters """ super().__init__(**kwargs) - self.name = "ModifyRequestHeader" # type: str + self.name: str = "ModifyRequestHeader" self.parameters = parameters @@ -4424,13 +4590,13 @@ class DeliveryRuleRequestHeaderCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "RequestHeaderMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.RequestHeaderMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.RequestHeaderMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RequestHeaderMatchConditionParameters """ super().__init__(**kwargs) - self.name = "RequestHeader" # type: str + self.name: str = "RequestHeader" self.parameters = parameters @@ -4458,13 +4624,13 @@ class DeliveryRuleRequestMethodCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "RequestMethodMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.RequestMethodMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.RequestMethodMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RequestMethodMatchConditionParameters """ super().__init__(**kwargs) - self.name = "RequestMethod" # type: str + self.name: str = "RequestMethod" self.parameters = parameters @@ -4492,13 +4658,13 @@ class DeliveryRuleRequestSchemeCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "RequestSchemeMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.RequestSchemeMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.RequestSchemeMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RequestSchemeMatchConditionParameters """ super().__init__(**kwargs) - self.name = "RequestScheme" # type: str + self.name: str = "RequestScheme" self.parameters = parameters @@ -4526,13 +4692,13 @@ class DeliveryRuleRequestUriCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "RequestUriMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.RequestUriMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.RequestUriMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RequestUriMatchConditionParameters """ super().__init__(**kwargs) - self.name = "RequestUri" # type: str + self.name: str = "RequestUri" self.parameters = parameters @@ -4560,18 +4726,19 @@ class DeliveryRuleResponseHeaderAction(DeliveryRuleAction): "parameters": {"key": "parameters", "type": "HeaderActionParameters"}, } - def __init__(self, *, parameters: "_models.HeaderActionParameters", **kwargs): + def __init__(self, *, parameters: "_models.HeaderActionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.HeaderActionParameters """ super().__init__(**kwargs) - self.name = "ModifyResponseHeader" # type: str + self.name: str = "ModifyResponseHeader" self.parameters = parameters class DeliveryRuleRouteConfigurationOverrideAction(DeliveryRuleAction): - """Defines the route configuration override action for the delivery rule. Only applicable to Frontdoor Standard/Premium Profiles. + """Defines the route configuration override action for the delivery rule. Only applicable to + Frontdoor Standard/Premium Profiles. All required parameters must be populated in order to send to Azure. @@ -4594,13 +4761,13 @@ class DeliveryRuleRouteConfigurationOverrideAction(DeliveryRuleAction): "parameters": {"key": "parameters", "type": "RouteConfigurationOverrideActionParameters"}, } - def __init__(self, *, parameters: "_models.RouteConfigurationOverrideActionParameters", **kwargs): + def __init__(self, *, parameters: "_models.RouteConfigurationOverrideActionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.RouteConfigurationOverrideActionParameters """ super().__init__(**kwargs) - self.name = "RouteConfigurationOverride" # type: str + self.name: str = "RouteConfigurationOverride" self.parameters = parameters @@ -4628,13 +4795,13 @@ class DeliveryRuleServerPortCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "ServerPortMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.ServerPortMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.ServerPortMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.ServerPortMatchConditionParameters """ super().__init__(**kwargs) - self.name = "ServerPort" # type: str + self.name: str = "ServerPort" self.parameters = parameters @@ -4662,13 +4829,13 @@ class DeliveryRuleSocketAddrCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "SocketAddrMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.SocketAddrMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.SocketAddrMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.SocketAddrMatchConditionParameters """ super().__init__(**kwargs) - self.name = "SocketAddr" # type: str + self.name: str = "SocketAddr" self.parameters = parameters @@ -4696,13 +4863,13 @@ class DeliveryRuleSslProtocolCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "SslProtocolMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.SslProtocolMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.SslProtocolMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.SslProtocolMatchConditionParameters """ super().__init__(**kwargs) - self.name = "SslProtocol" # type: str + self.name: str = "SslProtocol" self.parameters = parameters @@ -4730,13 +4897,13 @@ class DeliveryRuleUrlFileExtensionCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "UrlFileExtensionMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.UrlFileExtensionMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.UrlFileExtensionMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlFileExtensionMatchConditionParameters """ super().__init__(**kwargs) - self.name = "UrlFileExtension" # type: str + self.name: str = "UrlFileExtension" self.parameters = parameters @@ -4764,13 +4931,13 @@ class DeliveryRuleUrlFileNameCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "UrlFileNameMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.UrlFileNameMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.UrlFileNameMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlFileNameMatchConditionParameters """ super().__init__(**kwargs) - self.name = "UrlFileName" # type: str + self.name: str = "UrlFileName" self.parameters = parameters @@ -4798,13 +4965,13 @@ class DeliveryRuleUrlPathCondition(DeliveryRuleCondition): "parameters": {"key": "parameters", "type": "UrlPathMatchConditionParameters"}, } - def __init__(self, *, parameters: "_models.UrlPathMatchConditionParameters", **kwargs): + def __init__(self, *, parameters: "_models.UrlPathMatchConditionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the condition. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlPathMatchConditionParameters """ super().__init__(**kwargs) - self.name = "UrlPath" # type: str + self.name: str = "UrlPath" self.parameters = parameters @@ -4831,8 +4998,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, internal_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of dimension. :paramtype name: str @@ -4868,7 +5035,7 @@ class DomainValidationProperties(_serialization.Model): "expiration_date": {"key": "expirationDate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.validation_token = None @@ -4907,7 +5074,7 @@ class EdgeNode(ProxyResource): "ip_address_groups": {"key": "properties.ipAddressGroups", "type": "[IpAddressGroup]"}, } - def __init__(self, *, ip_address_groups: Optional[List["_models.IpAddressGroup"]] = None, **kwargs): + def __init__(self, *, ip_address_groups: Optional[List["_models.IpAddressGroup"]] = None, **kwargs: Any) -> None: """ :keyword ip_address_groups: List of ip address groups. :paramtype ip_address_groups: list[~azure.mgmt.cdn.models.IpAddressGroup] @@ -4917,7 +5084,8 @@ def __init__(self, *, ip_address_groups: Optional[List["_models.IpAddressGroup"] 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. + """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. @@ -4936,7 +5104,7 @@ class EdgenodeResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of edgenode list results if there are any. :paramtype next_link: str @@ -4947,7 +5115,9 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs): 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. + """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. @@ -5092,8 +5262,8 @@ def __init__( # pylint: disable=too-many-locals 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, + is_http_allowed: bool = True, + is_https_allowed: bool = True, query_string_caching_behavior: Optional[Union[str, "_models.QueryStringCachingBehavior"]] = None, optimization_type: Optional[Union[str, "_models.OptimizationType"]] = None, probe_path: Optional[str] = None, @@ -5106,8 +5276,8 @@ def __init__( # pylint: disable=too-many-locals ] = None, origins: Optional[List["_models.DeepCreatedOrigin"]] = None, origin_groups: Optional[List["_models.DeepCreatedOriginGroup"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. Required. :paramtype location: str @@ -5197,7 +5367,8 @@ def __init__( # pylint: disable=too-many-locals 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. + """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. @@ -5216,7 +5387,7 @@ class EndpointListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of endpoint objects if there is any. :paramtype next_link: str @@ -5311,8 +5482,8 @@ def __init__( 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, + is_http_allowed: bool = True, + is_https_allowed: bool = True, query_string_caching_behavior: Optional[Union[str, "_models.QueryStringCachingBehavior"]] = None, optimization_type: Optional[Union[str, "_models.OptimizationType"]] = None, probe_path: Optional[str] = None, @@ -5323,8 +5494,8 @@ def __init__( web_application_firewall_policy_link: Optional[ "_models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword origin_path: A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. @@ -5518,8 +5689,8 @@ def __init__( 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, + is_http_allowed: bool = True, + is_https_allowed: bool = True, query_string_caching_behavior: Optional[Union[str, "_models.QueryStringCachingBehavior"]] = None, optimization_type: Optional[Union[str, "_models.OptimizationType"]] = None, probe_path: Optional[str] = None, @@ -5531,8 +5702,8 @@ def __init__( "_models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink" ] = None, origin_groups: Optional[List["_models.DeepCreatedOriginGroup"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword origin_path: A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. @@ -5639,7 +5810,9 @@ class EndpointPropertiesUpdateParametersDeliveryPolicy(_serialization.Model): "rules": {"key": "rules", "type": "[DeliveryRule]"}, } - def __init__(self, *, rules: List["_models.DeliveryRule"], description: Optional[str] = None, **kwargs): + def __init__( + self, *, rules: List["_models.DeliveryRule"], description: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword description: User-friendly description of the policy. :paramtype description: str @@ -5662,7 +5835,7 @@ class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(_serial "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -5763,8 +5936,8 @@ def __init__( 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, + is_http_allowed: bool = True, + is_https_allowed: bool = True, query_string_caching_behavior: Optional[Union[str, "_models.QueryStringCachingBehavior"]] = None, optimization_type: Optional[Union[str, "_models.OptimizationType"]] = None, probe_path: Optional[str] = None, @@ -5775,8 +5948,8 @@ def __init__( web_application_firewall_policy_link: Optional[ "_models.EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Endpoint tags. :paramtype tags: dict[str, str] @@ -5874,7 +6047,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -5914,7 +6087,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -5925,7 +6098,8 @@ def __init__(self, **kwargs): 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. + """Error response indicates Azure Front Door Standard or Azure Front Door Premium or CDN service + is not able to process the incoming request. The reason is provided in the error message. :ivar error: The error object. :vartype error: ~azure.mgmt.cdn.models.ErrorDetail @@ -5935,7 +6109,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.cdn.models.ErrorDetail @@ -5973,8 +6147,13 @@ class GeoFilter(_serialization.Model): } def __init__( - self, *, relative_path: str, action: Union[str, "_models.GeoFilterActions"], country_codes: List[str], **kwargs - ): + self, + *, + relative_path: str, + action: Union[str, "_models.GeoFilterActions"], + country_codes: List[str], + **kwargs: Any + ) -> None: """ :keyword relative_path: Relative path applicable to geo filter. (e.g. '/mypictures', '/mypicture/kitty.jpg', and etc.). Required. @@ -6028,8 +6207,8 @@ def __init__( header_action: Union[str, "_models.HeaderAction"], header_name: str, value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleHeaderActionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.HeaderActionParametersTypeName @@ -6082,8 +6261,8 @@ def __init__( 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 - ): + **kwargs: Any + ) -> None: """ :keyword probe_path: The path relative to the origin that is used to determine the health of the origin. @@ -6142,11 +6321,11 @@ def __init__( *, type_name: Union[str, "_models.HostNameMatchConditionParametersTypeName"], operator: Union[str, "_models.HostNameOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleHostNameConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.HostNameMatchConditionParametersTypeName @@ -6188,7 +6367,7 @@ class HttpErrorRangeParameters(_serialization.Model): "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: Any) -> None: """ :keyword begin: The inclusive start of the http status code range. :paramtype begin: int @@ -6235,11 +6414,11 @@ def __init__( *, type_name: Union[str, "_models.HttpVersionMatchConditionParametersTypeName"], operator: Union[str, "_models.HttpVersionOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleHttpVersionConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.HttpVersionMatchConditionParametersTypeName @@ -6283,8 +6462,8 @@ def __init__( delivery_region: Optional[str] = None, ipv4_addresses: Optional[List["_models.CidrIpAddress"]] = None, ipv6_addresses: Optional[List["_models.CidrIpAddress"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword delivery_region: The delivery region of the ip address group. :paramtype delivery_region: str @@ -6335,11 +6514,11 @@ def __init__( *, type_name: Union[str, "_models.IsDeviceMatchConditionParametersTypeName"], operator: Union[str, "_models.IsDeviceOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[Union[str, "_models.IsDeviceMatchConditionParametersMatchValuesItem"]]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleIsDeviceConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.IsDeviceMatchConditionParametersTypeName @@ -6421,8 +6600,8 @@ def __init__( update_rule: Union[str, "_models.UpdateRule"], delete_rule: Union[str, "_models.DeleteRule"], secret_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "KeyVaultCertificateSourceParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.KeyVaultCertificateSourceParametersTypeName @@ -6504,8 +6683,8 @@ def __init__( vault_name: str, secret_name: str, secret_version: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "KeyVaultSigningKeyParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.KeyVaultSigningKeyParametersTypeName @@ -6556,8 +6735,8 @@ def __init__( sample_size: Optional[int] = None, successful_samples_required: Optional[int] = None, additional_latency_in_milliseconds: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sample_size: The number of samples to consider for load balancing decisions. :paramtype sample_size: int @@ -6592,7 +6771,7 @@ class LoadParameters(_serialization.Model): "content_paths": {"key": "contentPaths", "type": "[str]"}, } - def __init__(self, *, content_paths: List[str], **kwargs): + def __init__(self, *, content_paths: List[str], **kwargs: Any) -> None: """ :keyword content_paths: The path to the content to be loaded. Path should be a relative file URL of the origin. Required. @@ -6629,8 +6808,8 @@ def __init__( display_name: Optional[str] = None, blob_duration: Optional[str] = None, log_filter_pattern: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of log specification. :paramtype name: str @@ -6673,7 +6852,7 @@ class ManagedCertificate(Certificate): "expiration_date": {"key": "expirationDate", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.SecretType"]] = None, **kwargs): + def __init__(self, *, type: Optional[Union[str, "_models.SecretType"]] = None, **kwargs: Any) -> None: """ :keyword type: The type of the secret resource. Known values are: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". @@ -6710,10 +6889,10 @@ class ManagedCertificateParameters(SecretParameters): "expiration_date": {"key": "expirationDate", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = "ManagedCertificate" # type: str + self.type: str = "ManagedCertificate" self.subject = None self.expiration_date = None @@ -6739,7 +6918,7 @@ class ManagedRuleDefinition(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.rule_id = None @@ -6771,7 +6950,7 @@ class ManagedRuleGroupDefinition(_serialization.Model): "rules": {"key": "rules", "type": "[ManagedRuleDefinition]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.rule_group_name = None @@ -6801,7 +6980,9 @@ class ManagedRuleGroupOverride(_serialization.Model): "rules": {"key": "rules", "type": "[ManagedRuleOverride]"}, } - def __init__(self, *, rule_group_name: str, rules: Optional[List["_models.ManagedRuleOverride"]] = None, **kwargs): + def __init__( + self, *, rule_group_name: str, rules: Optional[List["_models.ManagedRuleOverride"]] = None, **kwargs: Any + ) -> None: """ :keyword rule_group_name: Describes the managed rule group within the rule set to override. Required. @@ -6846,8 +7027,8 @@ def __init__( rule_id: str, enabled_state: Optional[Union[str, "_models.ManagedRuleEnabledState"]] = None, action: Optional[Union[str, "_models.ActionType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword rule_id: Identifier for the managed rule. Required. :paramtype rule_id: str @@ -6900,8 +7081,8 @@ def __init__( rule_set_version: str, anomaly_score: Optional[int] = None, rule_group_overrides: Optional[List["_models.ManagedRuleGroupOverride"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword rule_set_type: Defines the rule set type to use. Required. :paramtype rule_set_type: str @@ -6969,7 +7150,7 @@ class ManagedRuleSetDefinition(Resource): "rule_groups": {"key": "properties.ruleGroups", "type": "[ManagedRuleGroupDefinition]"}, } - def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs): + def __init__(self, *, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> None: """ :keyword sku: The pricing tier (defines a CDN provider, feature list and rate) of the CdnWebApplicationFirewallPolicy. @@ -7003,7 +7184,7 @@ class ManagedRuleSetDefinitionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to retrieve next set of managed rule set definitions. :paramtype next_link: str @@ -7024,7 +7205,7 @@ class ManagedRuleSetList(_serialization.Model): "managed_rule_sets": {"key": "managedRuleSets", "type": "[ManagedRuleSet]"}, } - def __init__(self, *, managed_rule_sets: Optional[List["_models.ManagedRuleSet"]] = None, **kwargs): + def __init__(self, *, managed_rule_sets: Optional[List["_models.ManagedRuleSet"]] = None, **kwargs: Any) -> None: """ :keyword managed_rule_sets: List of rule sets. :paramtype managed_rule_sets: list[~azure.mgmt.cdn.models.ManagedRuleSet] @@ -7033,6 +7214,68 @@ def __init__(self, *, managed_rule_sets: Optional[List["_models.ManagedRuleSet"] self.managed_rule_sets = managed_rule_sets +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + 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 principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned, UserAssigned". + :vartype type: str or ~azure.mgmt.cdn.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.cdn.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned, UserAssigned". + :paramtype type: str or ~azure.mgmt.cdn.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, ~azure.mgmt.cdn.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + class MatchCondition(_serialization.Model): """Define match conditions. @@ -7081,8 +7324,8 @@ def __init__( selector: Optional[str] = None, negate_condition: Optional[bool] = None, transforms: Optional[List[Union[str, "_models.TransformType"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword match_variable: Match variable to compare against. Required. Known values are: "RemoteAddr", "SocketAddr", "RequestMethod", "RequestHeader", "RequestUri", "QueryString", @@ -7125,7 +7368,7 @@ class MetricAvailability(_serialization.Model): "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: Any) -> None: """ :keyword time_grain: :paramtype time_grain: str @@ -7193,8 +7436,8 @@ def __init__( fill_gap_with_zero: Optional[bool] = None, metric_filter_pattern: Optional[str] = None, is_internal: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of metric specification. :paramtype name: str @@ -7242,7 +7485,7 @@ class MetricsResponse(_serialization.Model): :ivar date_time_end: :vartype date_time_end: ~datetime.datetime :ivar granularity: Known values are: "PT5M", "PT1H", and "P1D". - :vartype granularity: str or ~azure.mgmt.cdn.models.MetricsResponseGranularity + :vartype granularity: str or ~azure.mgmt.cdn.models.MetricsGranularity :ivar series: :vartype series: list[~azure.mgmt.cdn.models.MetricsResponseSeriesItem] """ @@ -7259,17 +7502,17 @@ def __init__( *, date_time_begin: Optional[datetime.datetime] = None, date_time_end: Optional[datetime.datetime] = None, - granularity: Optional[Union[str, "_models.MetricsResponseGranularity"]] = None, + granularity: Optional[Union[str, "_models.MetricsGranularity"]] = None, series: Optional[List["_models.MetricsResponseSeriesItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword date_time_begin: :paramtype date_time_begin: ~datetime.datetime :keyword date_time_end: :paramtype date_time_end: ~datetime.datetime :keyword granularity: Known values are: "PT5M", "PT1H", and "P1D". - :paramtype granularity: str or ~azure.mgmt.cdn.models.MetricsResponseGranularity + :paramtype granularity: str or ~azure.mgmt.cdn.models.MetricsGranularity :keyword series: :paramtype series: list[~azure.mgmt.cdn.models.MetricsResponseSeriesItem] """ @@ -7286,7 +7529,7 @@ class MetricsResponseSeriesItem(_serialization.Model): :ivar metric: :vartype metric: str :ivar unit: Known values are: "count", "bytes", "bitsPerSecond", and "milliSeconds". - :vartype unit: str or ~azure.mgmt.cdn.models.MetricsResponseSeriesItemUnit + :vartype unit: str or ~azure.mgmt.cdn.models.MetricsSeriesUnit :ivar groups: :vartype groups: list[~azure.mgmt.cdn.models.MetricsResponseSeriesPropertiesItemsItem] :ivar data: @@ -7308,18 +7551,18 @@ def __init__( self, *, metric: Optional[str] = None, - unit: Optional[Union[str, "_models.MetricsResponseSeriesItemUnit"]] = None, + unit: Optional[Union[str, "_models.MetricsSeriesUnit"]] = None, groups: Optional[List["_models.MetricsResponseSeriesPropertiesItemsItem"]] = None, data: Optional[ List["_models.Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric: :paramtype metric: str :keyword unit: Known values are: "count", "bytes", "bitsPerSecond", and "milliSeconds". - :paramtype unit: str or ~azure.mgmt.cdn.models.MetricsResponseSeriesItemUnit + :paramtype unit: str or ~azure.mgmt.cdn.models.MetricsSeriesUnit :keyword groups: :paramtype groups: list[~azure.mgmt.cdn.models.MetricsResponseSeriesPropertiesItemsItem] :keyword data: @@ -7347,7 +7590,7 @@ class MetricsResponseSeriesPropertiesItemsItem(_serialization.Model): "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: Any) -> None: """ :keyword name: :paramtype name: str @@ -7359,6 +7602,173 @@ def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, * self.value = value +class MigrateResult(_serialization.Model): + """Result for migrate operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar type: Resource type. + :vartype type: str + :ivar migrated_profile_resource_id: Arm resource id of the migrated profile. + :vartype migrated_profile_resource_id: ~azure.mgmt.cdn.models.ResourceReference + """ + + _validation = { + "id": {"readonly": True}, + "type": {"readonly": True}, + "migrated_profile_resource_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "migrated_profile_resource_id": {"key": "properties.migratedProfileResourceId", "type": "ResourceReference"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.type = None + self.migrated_profile_resource_id = None + + +class MigrationErrorType(_serialization.Model): + """Error response indicates CDN service is not able to process the incoming request. The reason is + provided in the error message. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar resource_name: Resource which has the problem. + :vartype resource_name: str + :ivar error_message: Error message indicating why the operation failed. + :vartype error_message: str + :ivar next_steps: Describes what needs to be done to fix the problem. + :vartype next_steps: str + """ + + _validation = { + "code": {"readonly": True}, + "resource_name": {"readonly": True}, + "error_message": {"readonly": True}, + "next_steps": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "resource_name": {"key": "resourceName", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "next_steps": {"key": "nextSteps", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.resource_name = None + self.error_message = None + self.next_steps = None + + +class MigrationParameters(_serialization.Model): + """Request body for Migrate operation. + + All required parameters must be populated in order to send to Azure. + + :ivar sku: Sku for the migration. Required. + :vartype sku: ~azure.mgmt.cdn.models.Sku + :ivar classic_resource_reference: Resource reference of the classic cdn profile or classic + frontdoor that need to be migrated. Required. + :vartype classic_resource_reference: ~azure.mgmt.cdn.models.ResourceReference + :ivar profile_name: Name of the new profile that need to be created. Required. + :vartype profile_name: str + :ivar migration_web_application_firewall_mappings: Waf mapping for the migrated profile. + :vartype migration_web_application_firewall_mappings: + list[~azure.mgmt.cdn.models.MigrationWebApplicationFirewallMapping] + """ + + _validation = { + "sku": {"required": True}, + "classic_resource_reference": {"required": True}, + "profile_name": {"required": True}, + } + + _attribute_map = { + "sku": {"key": "sku", "type": "Sku"}, + "classic_resource_reference": {"key": "classicResourceReference", "type": "ResourceReference"}, + "profile_name": {"key": "profileName", "type": "str"}, + "migration_web_application_firewall_mappings": { + "key": "migrationWebApplicationFirewallMappings", + "type": "[MigrationWebApplicationFirewallMapping]", + }, + } + + def __init__( + self, + *, + sku: "_models.Sku", + classic_resource_reference: "_models.ResourceReference", + profile_name: str, + migration_web_application_firewall_mappings: Optional[ + List["_models.MigrationWebApplicationFirewallMapping"] + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword sku: Sku for the migration. Required. + :paramtype sku: ~azure.mgmt.cdn.models.Sku + :keyword classic_resource_reference: Resource reference of the classic cdn profile or classic + frontdoor that need to be migrated. Required. + :paramtype classic_resource_reference: ~azure.mgmt.cdn.models.ResourceReference + :keyword profile_name: Name of the new profile that need to be created. Required. + :paramtype profile_name: str + :keyword migration_web_application_firewall_mappings: Waf mapping for the migrated profile. + :paramtype migration_web_application_firewall_mappings: + list[~azure.mgmt.cdn.models.MigrationWebApplicationFirewallMapping] + """ + super().__init__(**kwargs) + self.sku = sku + self.classic_resource_reference = classic_resource_reference + self.profile_name = profile_name + self.migration_web_application_firewall_mappings = migration_web_application_firewall_mappings + + +class MigrationWebApplicationFirewallMapping(_serialization.Model): + """Web Application Firewall Mapping. + + :ivar migrated_from: Migration From Waf policy. + :vartype migrated_from: ~azure.mgmt.cdn.models.ResourceReference + :ivar migrated_to: Migration to Waf policy. + :vartype migrated_to: ~azure.mgmt.cdn.models.ResourceReference + """ + + _attribute_map = { + "migrated_from": {"key": "migratedFrom", "type": "ResourceReference"}, + "migrated_to": {"key": "migratedTo", "type": "ResourceReference"}, + } + + def __init__( + self, + *, + migrated_from: Optional["_models.ResourceReference"] = None, + migrated_to: Optional["_models.ResourceReference"] = None, + **kwargs: Any + ) -> None: + """ + :keyword migrated_from: Migration From Waf policy. + :paramtype migrated_from: ~azure.mgmt.cdn.models.ResourceReference + :keyword migrated_to: Migration to Waf policy. + :paramtype migrated_to: ~azure.mgmt.cdn.models.ResourceReference + """ + super().__init__(**kwargs) + self.migrated_from = migrated_from + self.migrated_to = migrated_to + + class Operation(_serialization.Model): """CDN REST API operation. @@ -7395,8 +7805,8 @@ def __init__( is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, service_specification: Optional["_models.ServiceSpecification"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword is_data_action: Indicates whether the operation is a data action. :paramtype is_data_action: bool @@ -7442,7 +7852,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -7452,7 +7862,8 @@ def __init__(self, **kwargs): 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. + """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. :vartype value: list[~azure.mgmt.cdn.models.Operation] @@ -7465,7 +7876,9 @@ class OperationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of CDN operations supported by the CDN resource provider. :paramtype value: list[~azure.mgmt.cdn.models.Operation] @@ -7478,7 +7891,9 @@ def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_li 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. + """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. @@ -7583,8 +7998,8 @@ def __init__( private_link_resource_id: Optional[str] = None, private_link_location: Optional[str] = None, private_link_approval_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. @@ -7638,7 +8053,8 @@ def __init__( class OriginGroup(ProxyResource): - """Origin group comprising of origins is used for load balancing to origins when the content cannot be served from CDN. + """Origin group comprising of origins is used for load balancing to origins when the content + cannot be served from CDN. Variables are only populated by the server, and will be ignored when sending a request. @@ -7710,8 +8126,8 @@ def __init__( response_based_origin_error_detection_settings: Optional[ "_models.ResponseBasedOriginErrorDetectionParameters" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. @@ -7740,7 +8156,8 @@ def __init__( 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. + """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. @@ -7759,7 +8176,7 @@ class OriginGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of origin objects if there are any. :paramtype next_link: str @@ -7790,8 +8207,8 @@ def __init__( *, origin_group: Optional["_models.ResourceReference"] = None, forwarding_protocol: Optional[Union[str, "_models.ForwardingProtocol"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword origin_group: defines the OriginGroup that would override the DefaultOriginGroup on route. @@ -7829,13 +8246,13 @@ class OriginGroupOverrideAction(DeliveryRuleAction): "parameters": {"key": "parameters", "type": "OriginGroupOverrideActionParameters"}, } - def __init__(self, *, parameters: "_models.OriginGroupOverrideActionParameters", **kwargs): + def __init__(self, *, parameters: "_models.OriginGroupOverrideActionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.OriginGroupOverrideActionParameters """ super().__init__(**kwargs) - self.name = "OriginGroupOverride" # type: str + self.name: str = "OriginGroupOverride" self.parameters = parameters @@ -7866,8 +8283,8 @@ def __init__( *, type_name: Union[str, "_models.OriginGroupOverrideActionParametersTypeName"], origin_group: "_models.ResourceReference", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleOriginGroupOverrideActionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.OriginGroupOverrideActionParametersTypeName @@ -7925,8 +8342,8 @@ def __init__( response_based_origin_error_detection_settings: Optional[ "_models.ResponseBasedOriginErrorDetectionParameters" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. @@ -8009,8 +8426,8 @@ def __init__( response_based_origin_error_detection_settings: Optional[ "_models.ResponseBasedOriginErrorDetectionParameters" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. @@ -8083,8 +8500,8 @@ def __init__( response_based_origin_error_detection_settings: Optional[ "_models.ResponseBasedOriginErrorDetectionParameters" ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword health_probe_settings: Health probe settings to the origin that is used to determine the health of the origin. @@ -8111,7 +8528,8 @@ def __init__( 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. + """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. @@ -8130,7 +8548,7 @@ class OriginListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of origin objects if there are any. :paramtype next_link: str @@ -8213,8 +8631,8 @@ def __init__( private_link_resource_id: Optional[str] = None, private_link_location: Optional[str] = None, private_link_approval_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. @@ -8354,8 +8772,8 @@ def __init__( private_link_resource_id: Optional[str] = None, private_link_location: Optional[str] = None, private_link_approval_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. @@ -8483,8 +8901,8 @@ def __init__( private_link_resource_id: Optional[str] = None, private_link_location: Optional[str] = None, private_link_approval_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword host_name: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. @@ -8580,8 +8998,8 @@ def __init__( Union[int, "_models.PolicySettingsDefaultCustomBlockResponseStatusCode"] ] = None, default_custom_block_response_body: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled_state: describes if the policy is in enabled state or disabled state. Known values are: "Disabled" and "Enabled". @@ -8650,11 +9068,11 @@ def __init__( type_name: Union[str, "_models.PostArgsMatchConditionParametersTypeName"], operator: Union[str, "_models.PostArgsOperator"], selector: Optional[str] = None, - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRulePostArgsConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.PostArgsMatchConditionParametersTypeName @@ -8705,12 +9123,17 @@ class Profile(TrackedResource): # pylint: disable=too-many-instance-attributes :ivar kind: Kind of the profile. Used by portal to differentiate traditional CDN profile and new AFD profile. :vartype kind: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.cdn.models.ManagedServiceIdentity :ivar resource_state: Resource status of the profile. Known values are: "Creating", "Active", - "Deleting", and "Disabled". + "Deleting", "Disabled", "Migrating", "Migrated", "PendingMigrationCommit", + "CommittingMigration", and "AbortingMigration". :vartype resource_state: str or ~azure.mgmt.cdn.models.ProfileResourceState :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 extended_properties: Key-Value pair representing additional properties for profiles. + :vartype extended_properties: dict[str, str] :ivar front_door_id: The Id of the frontdoor. :vartype front_door_id: str :ivar origin_response_timeout_seconds: Send and receive timeout on forwarding request to the @@ -8728,6 +9151,7 @@ class Profile(TrackedResource): # pylint: disable=too-many-instance-attributes "kind": {"readonly": True}, "resource_state": {"readonly": True}, "provisioning_state": {"readonly": True}, + "extended_properties": {"readonly": True}, "front_door_id": {"readonly": True}, "origin_response_timeout_seconds": {"minimum": 16}, } @@ -8741,8 +9165,10 @@ class Profile(TrackedResource): # pylint: disable=too-many-instance-attributes "tags": {"key": "tags", "type": "{str}"}, "sku": {"key": "sku", "type": "Sku"}, "kind": {"key": "kind", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "resource_state": {"key": "properties.resourceState", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "extended_properties": {"key": "properties.extendedProperties", "type": "{str}"}, "front_door_id": {"key": "properties.frontDoorId", "type": "str"}, "origin_response_timeout_seconds": {"key": "properties.originResponseTimeoutSeconds", "type": "int"}, } @@ -8753,9 +9179,10 @@ def __init__( location: str, sku: "_models.Sku", tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, origin_response_timeout_seconds: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Resource location. Required. :paramtype location: str @@ -8764,6 +9191,8 @@ def __init__( :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 identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.cdn.models.ManagedServiceIdentity :keyword origin_response_timeout_seconds: Send and receive timeout on forwarding request to the origin. When timeout is reached, the request fails and returns. :paramtype origin_response_timeout_seconds: int @@ -8771,14 +9200,52 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.kind = None + self.identity = identity self.resource_state = None self.provisioning_state = None + self.extended_properties = None self.front_door_id = None self.origin_response_timeout_seconds = origin_response_timeout_seconds +class ProfileChangeSkuWafMapping(_serialization.Model): + """Parameters required for profile upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar security_policy_name: The security policy name. Required. + :vartype security_policy_name: str + :ivar change_to_waf_policy: The new waf resource for the security policy to use. Required. + :vartype change_to_waf_policy: ~azure.mgmt.cdn.models.ResourceReference + """ + + _validation = { + "security_policy_name": {"required": True}, + "change_to_waf_policy": {"required": True}, + } + + _attribute_map = { + "security_policy_name": {"key": "securityPolicyName", "type": "str"}, + "change_to_waf_policy": {"key": "changeToWafPolicy", "type": "ResourceReference"}, + } + + def __init__( + self, *, security_policy_name: str, change_to_waf_policy: "_models.ResourceReference", **kwargs: Any + ) -> None: + """ + :keyword security_policy_name: The security policy name. Required. + :paramtype security_policy_name: str + :keyword change_to_waf_policy: The new waf resource for the security policy to use. Required. + :paramtype change_to_waf_policy: ~azure.mgmt.cdn.models.ResourceReference + """ + super().__init__(**kwargs) + self.security_policy_name = security_policy_name + self.change_to_waf_policy = change_to_waf_policy + + 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. + """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. @@ -8797,7 +9264,7 @@ class ProfileListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of profile objects if there are any. :paramtype next_link: str @@ -8812,6 +9279,8 @@ class ProfileUpdateParameters(_serialization.Model): :ivar tags: Profile tags. :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.cdn.models.ManagedServiceIdentity :ivar origin_response_timeout_seconds: Send and receive timeout on forwarding request to the origin. When timeout is reached, the request fails and returns. :vartype origin_response_timeout_seconds: int @@ -8823,24 +9292,61 @@ class ProfileUpdateParameters(_serialization.Model): _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "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, + identity: Optional["_models.ManagedServiceIdentity"] = None, + origin_response_timeout_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Profile tags. :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.cdn.models.ManagedServiceIdentity :keyword origin_response_timeout_seconds: Send and receive timeout on forwarding request to the origin. When timeout is reached, the request fails and returns. :paramtype origin_response_timeout_seconds: int """ super().__init__(**kwargs) self.tags = tags + self.identity = identity self.origin_response_timeout_seconds = origin_response_timeout_seconds +class ProfileUpgradeParameters(_serialization.Model): + """Parameters required for profile upgrade. + + All required parameters must be populated in order to send to Azure. + + :ivar waf_mapping_list: Web Application Firewall (WAF) and security policy mapping for the + profile upgrade. Required. + :vartype waf_mapping_list: list[~azure.mgmt.cdn.models.ProfileChangeSkuWafMapping] + """ + + _validation = { + "waf_mapping_list": {"required": True}, + } + + _attribute_map = { + "waf_mapping_list": {"key": "wafMappingList", "type": "[ProfileChangeSkuWafMapping]"}, + } + + def __init__(self, *, waf_mapping_list: List["_models.ProfileChangeSkuWafMapping"], **kwargs: Any) -> None: + """ + :keyword waf_mapping_list: Web Application Firewall (WAF) and security policy mapping for the + profile upgrade. Required. + :paramtype waf_mapping_list: list[~azure.mgmt.cdn.models.ProfileChangeSkuWafMapping] + """ + super().__init__(**kwargs) + self.waf_mapping_list = waf_mapping_list + + class PurgeParameters(_serialization.Model): """Parameters required for content purge. @@ -8859,7 +9365,7 @@ class PurgeParameters(_serialization.Model): "content_paths": {"key": "contentPaths", "type": "[str]"}, } - def __init__(self, *, content_paths: List[str], **kwargs): + def __init__(self, *, content_paths: List[str], **kwargs: Any) -> None: """ :keyword content_paths: The path to the content to be purged. Can describe a file path or a wild card directory. Required. @@ -8906,11 +9412,11 @@ def __init__( *, type_name: Union[str, "_models.QueryStringMatchConditionParametersTypeName"], operator: Union[str, "_models.QueryStringOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleQueryStringConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.QueryStringMatchConditionParametersTypeName @@ -8956,8 +9462,8 @@ def __init__( date_time_begin: Optional[datetime.datetime] = None, date_time_end: Optional[datetime.datetime] = None, tables: Optional[List["_models.RankingsResponseTablesItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword date_time_begin: :paramtype date_time_begin: ~datetime.datetime @@ -8991,8 +9497,8 @@ def __init__( *, ranking: Optional[str] = None, data: Optional[List["_models.RankingsResponseTablesPropertiesItemsItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword ranking: :paramtype ranking: str @@ -9023,8 +9529,8 @@ def __init__( *, name: Optional[str] = None, metrics: Optional[List["_models.RankingsResponseTablesPropertiesItemsMetricsItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: :paramtype name: str @@ -9055,8 +9561,13 @@ class RankingsResponseTablesPropertiesItemsMetricsItem(_serialization.Model): } 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: Any + ) -> None: """ :keyword metric: :paramtype metric: str @@ -9125,8 +9636,8 @@ def __init__( rate_limit_threshold: int, rate_limit_duration_in_minutes: int, enabled_state: Optional[Union[str, "_models.CustomRuleEnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Defines the name of the custom rule. Required. :paramtype name: str @@ -9170,7 +9681,7 @@ class RateLimitRuleList(_serialization.Model): "rules": {"key": "rules", "type": "[RateLimitRule]"}, } - def __init__(self, *, rules: Optional[List["_models.RateLimitRule"]] = None, **kwargs): + def __init__(self, *, rules: Optional[List["_models.RateLimitRule"]] = None, **kwargs: Any) -> None: """ :keyword rules: List of rules. :paramtype rules: list[~azure.mgmt.cdn.models.RateLimitRule] @@ -9217,11 +9728,11 @@ def __init__( *, type_name: Union[str, "_models.RemoteAddressMatchConditionParametersTypeName"], operator: Union[str, "_models.RemoteAddressOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleRemoteAddressConditionParameters" :paramtype type_name: str or @@ -9283,11 +9794,11 @@ def __init__( *, type_name: Union[str, "_models.RequestBodyMatchConditionParametersTypeName"], operator: Union[str, "_models.RequestBodyOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleRequestBodyConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.RequestBodyMatchConditionParametersTypeName @@ -9351,11 +9862,11 @@ def __init__( type_name: Union[str, "_models.RequestHeaderMatchConditionParametersTypeName"], operator: Union[str, "_models.RequestHeaderOperator"], selector: Optional[str] = None, - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleRequestHeaderConditionParameters" :paramtype type_name: str or @@ -9418,11 +9929,11 @@ def __init__( *, type_name: Union[str, "_models.RequestMethodMatchConditionParametersTypeName"], operator: Union[str, "_models.RequestMethodOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, match_values: Optional[List[Union[str, "_models.RequestMethodMatchConditionParametersMatchValuesItem"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleRequestMethodConditionParameters" :paramtype type_name: str or @@ -9481,11 +9992,11 @@ def __init__( *, type_name: Union[str, "_models.RequestSchemeMatchConditionParametersTypeName"], operator: Union[str, "_models.RequestSchemeMatchConditionParametersOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, match_values: Optional[List[Union[str, "_models.RequestSchemeMatchConditionParametersMatchValuesItem"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleRequestSchemeConditionParameters" :paramtype type_name: str or @@ -9546,11 +10057,11 @@ def __init__( *, type_name: Union[str, "_models.RequestUriMatchConditionParametersTypeName"], operator: Union[str, "_models.RequestUriOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleRequestUriConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.RequestUriMatchConditionParametersTypeName @@ -9584,7 +10095,7 @@ class ResourceReference(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. :paramtype id: str @@ -9612,8 +10123,8 @@ def __init__( *, endpoints: Optional[List["_models.ResourcesResponseEndpointsItem"]] = None, custom_domains: Optional[List["_models.ResourcesResponseCustomDomainsItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword endpoints: :paramtype endpoints: list[~azure.mgmt.cdn.models.ResourcesResponseEndpointsItem] @@ -9652,8 +10163,8 @@ def __init__( name: Optional[str] = None, endpoint_id: Optional[str] = None, history: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: :paramtype id: str @@ -9699,8 +10210,8 @@ def __init__( name: Optional[str] = None, history: Optional[bool] = None, custom_domains: Optional[List["_models.ResourcesResponseEndpointsPropertiesItemsItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: :paramtype id: str @@ -9746,8 +10257,8 @@ def __init__( name: Optional[str] = None, endpoint_id: Optional[str] = None, history: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: :paramtype id: str @@ -9794,7 +10305,7 @@ class ResourceUsage(_serialization.Model): "limit": {"key": "limit", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_type = None @@ -9823,7 +10334,7 @@ class ResourceUsageListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of custom domain objects if there are any. :paramtype next_link: str @@ -9834,7 +10345,8 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs): class ResponseBasedOriginErrorDetectionParameters(_serialization.Model): - """The JSON object that contains the properties to determine origin health using real requests/responses. + """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. Known values are: "None", "TcpErrorsOnly", and @@ -9868,8 +10380,8 @@ def __init__( response_based_detected_error_types: Optional[Union[str, "_models.ResponseBasedDetectedErrorTypes"]] = None, response_based_failover_threshold_percentage: Optional[int] = None, http_error_ranges: Optional[List["_models.HttpErrorRangeParameters"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword response_based_detected_error_types: Type of response errors for real user requests for which origin will be deemed unhealthy. Known values are: "None", "TcpErrorsOnly", and @@ -9979,15 +10491,15 @@ def __init__( origin_group: Optional["_models.ResourceReference"] = None, origin_path: Optional[str] = None, rule_sets: Optional[List["_models.ResourceReference"]] = None, - supported_protocols: Optional[List[Union[str, "_models.AFDEndpointProtocols"]]] = None, + supported_protocols: List[Union[str, "_models.AFDEndpointProtocols"]] = ["Http", "Https"], patterns_to_match: Optional[List[str]] = 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, + link_to_default_domain: Union[str, "_models.LinkToDefaultDomain"] = "Disabled", + https_redirect: Union[str, "_models.HttpsRedirect"] = "Disabled", enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword custom_domains: Domains referenced by this endpoint. :paramtype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] @@ -10068,8 +10580,8 @@ def __init__( type_name: Union[str, "_models.RouteConfigurationOverrideActionParametersTypeName"], origin_group_override: Optional["_models.OriginGroupOverride"] = None, cache_configuration: Optional["_models.CacheConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleRouteConfigurationOverrideActionParameters" :paramtype type_name: str or @@ -10088,7 +10600,8 @@ def __init__( 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. + """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. @@ -10107,7 +10620,7 @@ class RouteListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of route objects if there are any. :paramtype next_link: str @@ -10181,15 +10694,15 @@ def __init__( origin_group: Optional["_models.ResourceReference"] = None, origin_path: Optional[str] = None, rule_sets: Optional[List["_models.ResourceReference"]] = None, - supported_protocols: Optional[List[Union[str, "_models.AFDEndpointProtocols"]]] = None, + supported_protocols: List[Union[str, "_models.AFDEndpointProtocols"]] = ["Http", "Https"], patterns_to_match: Optional[List[str]] = 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, + link_to_default_domain: Union[str, "_models.LinkToDefaultDomain"] = "Disabled", + https_redirect: Union[str, "_models.HttpsRedirect"] = "Disabled", enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword custom_domains: Domains referenced by this endpoint. :paramtype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] @@ -10312,15 +10825,15 @@ def __init__( origin_group: Optional["_models.ResourceReference"] = None, origin_path: Optional[str] = None, rule_sets: Optional[List["_models.ResourceReference"]] = None, - supported_protocols: Optional[List[Union[str, "_models.AFDEndpointProtocols"]]] = None, + supported_protocols: List[Union[str, "_models.AFDEndpointProtocols"]] = ["Http", "Https"], patterns_to_match: Optional[List[str]] = 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, + link_to_default_domain: Union[str, "_models.LinkToDefaultDomain"] = "Disabled", + https_redirect: Union[str, "_models.HttpsRedirect"] = "Disabled", enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword custom_domains: Domains referenced by this endpoint. :paramtype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] @@ -10446,15 +10959,15 @@ def __init__( origin_group: Optional["_models.ResourceReference"] = None, origin_path: Optional[str] = None, rule_sets: Optional[List["_models.ResourceReference"]] = None, - supported_protocols: Optional[List[Union[str, "_models.AFDEndpointProtocols"]]] = None, + supported_protocols: List[Union[str, "_models.AFDEndpointProtocols"]] = ["Http", "Https"], patterns_to_match: Optional[List[str]] = 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, + link_to_default_domain: Union[str, "_models.LinkToDefaultDomain"] = "Disabled", + https_redirect: Union[str, "_models.HttpsRedirect"] = "Disabled", enabled_state: Optional[Union[str, "_models.EnabledState"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword custom_domains: Domains referenced by this endpoint. :paramtype custom_domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] @@ -10528,7 +11041,7 @@ class Rule(ProxyResource): # pylint: disable=too-many-instance-attributes :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. Known values are: - "Continue" and "Stop". + "Continue", "Stop", and "Continue". :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior :ivar provisioning_state: Provisioning status. Known values are: "Succeeded", "Failed", "Updating", "Deleting", and "Creating". @@ -10568,9 +11081,9 @@ def __init__( order: Optional[int] = None, conditions: Optional[List["_models.DeliveryRuleCondition"]] = None, actions: Optional[List["_models.DeliveryRuleAction"]] = None, - match_processing_behavior: Optional[Union[str, "_models.MatchProcessingBehavior"]] = None, - **kwargs - ): + match_processing_behavior: Union[str, "_models.MatchProcessingBehavior"] = "Continue", + **kwargs: Any + ) -> None: """ :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. @@ -10584,7 +11097,7 @@ def __init__( :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. Known values are: - "Continue" and "Stop". + "Continue", "Stop", and "Continue". :paramtype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ super().__init__(**kwargs) @@ -10598,7 +11111,8 @@ def __init__( 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. + """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. @@ -10617,7 +11131,7 @@ class RuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of rule objects if there are any. :paramtype next_link: str @@ -10646,7 +11160,7 @@ class RuleUpdatePropertiesParameters(_serialization.Model): :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. Known values are: - "Continue" and "Stop". + "Continue", "Stop", and "Continue". :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ @@ -10668,9 +11182,9 @@ def __init__( order: Optional[int] = None, conditions: Optional[List["_models.DeliveryRuleCondition"]] = None, actions: Optional[List["_models.DeliveryRuleAction"]] = None, - match_processing_behavior: Optional[Union[str, "_models.MatchProcessingBehavior"]] = None, - **kwargs - ): + match_processing_behavior: Union[str, "_models.MatchProcessingBehavior"] = "Continue", + **kwargs: Any + ) -> None: """ :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. @@ -10684,7 +11198,7 @@ def __init__( :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. Known values are: - "Continue" and "Stop". + "Continue", "Stop", and "Continue". :paramtype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ super().__init__(**kwargs) @@ -10720,7 +11234,7 @@ class RuleProperties(RuleUpdatePropertiesParameters, AFDStateProperties): :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. Known values are: - "Continue" and "Stop". + "Continue", "Stop", and "Continue". :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ @@ -10746,9 +11260,9 @@ def __init__( order: Optional[int] = None, conditions: Optional[List["_models.DeliveryRuleCondition"]] = None, actions: Optional[List["_models.DeliveryRuleAction"]] = None, - match_processing_behavior: Optional[Union[str, "_models.MatchProcessingBehavior"]] = None, - **kwargs - ): + match_processing_behavior: Union[str, "_models.MatchProcessingBehavior"] = "Continue", + **kwargs: Any + ) -> None: """ :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. @@ -10762,7 +11276,7 @@ def __init__( :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. Known values are: - "Continue" and "Stop". + "Continue", "Stop", and "Continue". :paramtype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ super().__init__( @@ -10824,7 +11338,7 @@ class RuleSet(ProxyResource): "profile_name": {"key": "properties.profileName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -10833,7 +11347,8 @@ def __init__(self, **kwargs): 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. + """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. @@ -10852,7 +11367,7 @@ class RuleSetListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of rule set objects if there are any. :paramtype next_link: str @@ -10889,7 +11404,7 @@ class RuleSetProperties(AFDStateProperties): "profile_name": {"key": "profileName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.profile_name = None @@ -10914,7 +11429,7 @@ class RuleUpdateParameters(_serialization.Model): :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. Known values are: - "Continue" and "Stop". + "Continue", "Stop", and "Continue". :vartype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ @@ -10936,9 +11451,9 @@ def __init__( order: Optional[int] = None, conditions: Optional[List["_models.DeliveryRuleCondition"]] = None, actions: Optional[List["_models.DeliveryRuleAction"]] = None, - match_processing_behavior: Optional[Union[str, "_models.MatchProcessingBehavior"]] = None, - **kwargs - ): + match_processing_behavior: Union[str, "_models.MatchProcessingBehavior"] = "Continue", + **kwargs: Any + ) -> None: """ :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. @@ -10952,7 +11467,7 @@ def __init__( :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. Known values are: - "Continue" and "Stop". + "Continue", "Stop", and "Continue". :paramtype match_processing_behavior: str or ~azure.mgmt.cdn.models.MatchProcessingBehavior """ super().__init__(**kwargs) @@ -11009,7 +11524,7 @@ class Secret(ProxyResource): "parameters": {"key": "properties.parameters", "type": "SecretParameters"}, } - def __init__(self, *, parameters: Optional["_models.SecretParameters"] = None, **kwargs): + def __init__(self, *, parameters: Optional["_models.SecretParameters"] = None, **kwargs: Any) -> None: """ :keyword parameters: object which contains secret parameters. :paramtype parameters: ~azure.mgmt.cdn.models.SecretParameters @@ -11022,7 +11537,8 @@ def __init__(self, *, parameters: Optional["_models.SecretParameters"] = None, * 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. + """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. @@ -11041,7 +11557,7 @@ class SecretListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of Secret objects if there are any. :paramtype next_link: str @@ -11081,7 +11597,7 @@ class SecretProperties(AFDStateProperties): "parameters": {"key": "parameters", "type": "SecretParameters"}, } - def __init__(self, *, parameters: Optional["_models.SecretParameters"] = None, **kwargs): + def __init__(self, *, parameters: Optional["_models.SecretParameters"] = None, **kwargs: Any) -> None: """ :keyword parameters: object which contains secret parameters. :paramtype parameters: ~azure.mgmt.cdn.models.SecretParameters @@ -11137,7 +11653,9 @@ class SecurityPolicy(ProxyResource): "parameters": {"key": "properties.parameters", "type": "SecurityPolicyPropertiesParameters"}, } - def __init__(self, *, parameters: Optional["_models.SecurityPolicyPropertiesParameters"] = None, **kwargs): + def __init__( + self, *, parameters: Optional["_models.SecurityPolicyPropertiesParameters"] = None, **kwargs: Any + ) -> None: """ :keyword parameters: object which contains security policy parameters. :paramtype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters @@ -11150,7 +11668,8 @@ def __init__(self, *, parameters: Optional["_models.SecurityPolicyPropertiesPara 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. + """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. @@ -11169,7 +11688,7 @@ class SecurityPolicyListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: URL to get the next set of security policy objects if there is any. :paramtype next_link: str @@ -11209,7 +11728,9 @@ class SecurityPolicyProperties(AFDStateProperties): "parameters": {"key": "parameters", "type": "SecurityPolicyPropertiesParameters"}, } - def __init__(self, *, parameters: Optional["_models.SecurityPolicyPropertiesParameters"] = None, **kwargs): + def __init__( + self, *, parameters: Optional["_models.SecurityPolicyPropertiesParameters"] = None, **kwargs: Any + ) -> None: """ :keyword parameters: object which contains security policy parameters. :paramtype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters @@ -11241,10 +11762,10 @@ class SecurityPolicyPropertiesParameters(_serialization.Model): _subtype_map = {"type": {"WebApplicationFirewall": "SecurityPolicyWebApplicationFirewallParameters"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None # type: Optional[str] + self.type: Optional[str] = None class SecurityPolicyUpdateParameters(_serialization.Model): @@ -11258,7 +11779,9 @@ class SecurityPolicyUpdateParameters(_serialization.Model): "parameters": {"key": "properties.parameters", "type": "SecurityPolicyPropertiesParameters"}, } - def __init__(self, *, parameters: Optional["_models.SecurityPolicyPropertiesParameters"] = None, **kwargs): + def __init__( + self, *, parameters: Optional["_models.SecurityPolicyPropertiesParameters"] = None, **kwargs: Any + ) -> None: """ :keyword parameters: object which contains security policy parameters. :paramtype parameters: ~azure.mgmt.cdn.models.SecurityPolicyPropertiesParameters @@ -11286,8 +11809,8 @@ def __init__( *, domains: Optional[List["_models.ActivatedResourceReference"]] = None, patterns_to_match: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword domains: List of domains. :paramtype domains: list[~azure.mgmt.cdn.models.ActivatedResourceReference] @@ -11328,8 +11851,8 @@ def __init__( *, waf_policy: Optional["_models.ResourceReference"] = None, associations: Optional[List["_models.SecurityPolicyWebApplicationFirewallAssociation"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword waf_policy: Resource ID. :paramtype waf_policy: ~azure.mgmt.cdn.models.ResourceReference @@ -11338,7 +11861,7 @@ def __init__( list[~azure.mgmt.cdn.models.SecurityPolicyWebApplicationFirewallAssociation] """ super().__init__(**kwargs) - self.type = "WebApplicationFirewall" # type: str + self.type: str = "WebApplicationFirewall" self.waf_policy = waf_policy self.associations = associations @@ -11380,11 +11903,11 @@ def __init__( *, type_name: Union[str, "_models.ServerPortMatchConditionParametersTypeName"], operator: Union[str, "_models.ServerPortOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleServerPortConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.ServerPortMatchConditionParametersTypeName @@ -11426,8 +11949,8 @@ def __init__( *, log_specifications: Optional[List["_models.LogSpecification"]] = None, metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword log_specifications: Log specifications of operation. :paramtype log_specifications: list[~azure.mgmt.cdn.models.LogSpecification] @@ -11440,7 +11963,8 @@ def __init__( class SharedPrivateLinkResourceProperties(_serialization.Model): - """Describes the properties of an existing Shared Private Link Resource to use when connecting to a private origin. + """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. :vartype private_link: ~azure.mgmt.cdn.models.ResourceReference @@ -11474,8 +11998,8 @@ def __init__( group_id: Optional[str] = None, request_message: Optional[str] = None, status: Optional[Union[str, "_models.SharedPrivateLinkResourceStatus"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_link: The resource id of the resource the shared private link resource is for. :paramtype private_link: ~azure.mgmt.cdn.models.ResourceReference @@ -11505,29 +12029,35 @@ class Sku(_serialization.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_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. 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 + 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. 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"}, } - def __init__(self, *, name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs): + def __init__(self, *, name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs: Any) -> None: """ :keyword name: Name of the pricing tier. Known values are: "Standard_Verizon", "Premium_Verizon", "Custom_Verizon", "Standard_Akamai", "Standard_ChinaCdn", @@ -11576,11 +12106,11 @@ def __init__( *, type_name: Union[str, "_models.SocketAddrMatchConditionParametersTypeName"], operator: Union[str, "_models.SocketAddrOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleSocketAddrConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.SocketAddrMatchConditionParametersTypeName @@ -11637,11 +12167,11 @@ def __init__( *, type_name: Union[str, "_models.SslProtocolMatchConditionParametersTypeName"], operator: Union[str, "_models.SslProtocolOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[Union[str, "_models.SslProtocol"]]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleSslProtocolConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.SslProtocolMatchConditionParametersTypeName @@ -11679,7 +12209,7 @@ class SsoUri(_serialization.Model): "sso_uri_value": {"key": "ssoUriValue", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.sso_uri_value = None @@ -11702,7 +12232,7 @@ class SupportedOptimizationTypesListResult(_serialization.Model): "supported_optimization_types": {"key": "supportedOptimizationTypes", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.supported_optimization_types = None @@ -11745,8 +12275,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.IdentityType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: An identifier for the identity that created the resource. :paramtype created_by: str @@ -11810,11 +12340,11 @@ def __init__( *, type_name: Union[str, "_models.UrlFileExtensionMatchConditionParametersTypeName"], operator: Union[str, "_models.UrlFileExtensionOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleUrlFileExtensionMatchConditionParameters" :paramtype type_name: str or @@ -11875,11 +12405,11 @@ def __init__( *, type_name: Union[str, "_models.UrlFileNameMatchConditionParametersTypeName"], operator: Union[str, "_models.UrlFileNameOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleUrlFilenameConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.UrlFileNameMatchConditionParametersTypeName @@ -11939,11 +12469,11 @@ def __init__( *, type_name: Union[str, "_models.UrlPathMatchConditionParametersTypeName"], operator: Union[str, "_models.UrlPathOperator"], - negate_condition: Optional[bool] = None, + negate_condition: bool = False, match_values: Optional[List[str]] = None, transforms: Optional[List[Union[str, "_models.Transform"]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleUrlPathMatchConditionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.UrlPathMatchConditionParametersTypeName @@ -11990,13 +12520,13 @@ class UrlRedirectAction(DeliveryRuleAction): "parameters": {"key": "parameters", "type": "UrlRedirectActionParameters"}, } - def __init__(self, *, parameters: "_models.UrlRedirectActionParameters", **kwargs): + def __init__(self, *, parameters: "_models.UrlRedirectActionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlRedirectActionParameters """ super().__init__(**kwargs) - self.name = "UrlRedirect" # type: str + self.name: str = "UrlRedirect" self.parameters = parameters @@ -12054,8 +12584,8 @@ def __init__( custom_hostname: Optional[str] = None, custom_query_string: Optional[str] = None, custom_fragment: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleUrlRedirectActionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.UrlRedirectActionParametersTypeName @@ -12114,13 +12644,13 @@ class UrlRewriteAction(DeliveryRuleAction): "parameters": {"key": "parameters", "type": "UrlRewriteActionParameters"}, } - def __init__(self, *, parameters: "_models.UrlRewriteActionParameters", **kwargs): + def __init__(self, *, parameters: "_models.UrlRewriteActionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlRewriteActionParameters """ super().__init__(**kwargs) - self.name = "UrlRewrite" # type: str + self.name: str = "UrlRewrite" self.parameters = parameters @@ -12161,8 +12691,8 @@ def __init__( source_pattern: str, destination: str, preserve_unmatched_path: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleUrlRewriteActionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.UrlRewriteActionParametersTypeName @@ -12206,13 +12736,13 @@ class UrlSigningAction(DeliveryRuleAction): "parameters": {"key": "parameters", "type": "UrlSigningActionParameters"}, } - def __init__(self, *, parameters: "_models.UrlSigningActionParameters", **kwargs): + def __init__(self, *, parameters: "_models.UrlSigningActionParameters", **kwargs: Any) -> None: """ :keyword parameters: Defines the parameters for the action. Required. :paramtype parameters: ~azure.mgmt.cdn.models.UrlSigningActionParameters """ super().__init__(**kwargs) - self.name = "UrlSigning" # type: str + self.name: str = "UrlSigning" self.parameters = parameters @@ -12246,8 +12776,8 @@ def __init__( type_name: Union[str, "_models.UrlSigningActionParametersTypeName"], algorithm: Optional[Union[str, "_models.Algorithm"]] = None, parameter_name_override: Optional[List["_models.UrlSigningParamIdentifier"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type_name: Required. "DeliveryRuleUrlSigningActionParameters" :paramtype type_name: str or ~azure.mgmt.cdn.models.UrlSigningActionParametersTypeName @@ -12286,7 +12816,9 @@ class UrlSigningKey(_serialization.Model): "key_source_parameters": {"key": "keySourceParameters", "type": "KeyVaultSigningKeyParameters"}, } - def __init__(self, *, key_id: str, key_source_parameters: "_models.KeyVaultSigningKeyParameters", **kwargs): + def __init__( + self, *, key_id: str, key_source_parameters: "_models.KeyVaultSigningKeyParameters", **kwargs: Any + ) -> None: """ :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. @@ -12334,8 +12866,13 @@ class UrlSigningKeyParameters(SecretParameters): } def __init__( - self, *, key_id: str, secret_source: "_models.ResourceReference", secret_version: Optional[str] = None, **kwargs - ): + self, + *, + key_id: str, + secret_source: "_models.ResourceReference", + secret_version: Optional[str] = None, + **kwargs: Any + ) -> None: """ :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. @@ -12349,7 +12886,7 @@ def __init__( :paramtype secret_version: str """ super().__init__(**kwargs) - self.type = "UrlSigningKey" # type: str + self.type: str = "UrlSigningKey" self.key_id = key_id self.secret_source = secret_source self.secret_version = secret_version @@ -12377,7 +12914,9 @@ class UrlSigningParamIdentifier(_serialization.Model): "param_name": {"key": "paramName", "type": "str"}, } - def __init__(self, *, param_indicator: Union[str, "_models.ParamIndicator"], param_name: str, **kwargs): + def __init__( + self, *, param_indicator: Union[str, "_models.ParamIndicator"], param_name: str, **kwargs: Any + ) -> None: """ :keyword param_indicator: Indicates the purpose of the parameter. Required. Known values are: "Expires", "KeyId", and "Signature". @@ -12432,8 +12971,8 @@ def __init__( current_value: int, limit: int, name: "_models.UsageName", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword unit: An enum describing the unit of measurement. Required. "Count" :paramtype unit: str or ~azure.mgmt.cdn.models.UsageUnit @@ -12466,7 +13005,7 @@ class UsageName(_serialization.Model): "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: Any) -> None: """ :keyword value: A string describing the resource name. :paramtype value: str @@ -12492,7 +13031,9 @@ class UsagesListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Usage"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Usage"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of resource usages. :paramtype value: list[~azure.mgmt.cdn.models.Usage] @@ -12504,6 +13045,34 @@ def __init__(self, *, value: Optional[List["_models.Usage"]] = None, next_link: self.next_link = next_link +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + class UserManagedHttpsParameters(CustomDomainHttpsParameters): """Defines the certificate source parameters using user's keyvault certificate for enabling SSL. @@ -12546,8 +13115,8 @@ def __init__( protocol_type: Union[str, "_models.ProtocolType"], certificate_source_parameters: "_models.KeyVaultCertificateSourceParameters", minimum_tls_version: Optional[Union[str, "_models.MinimumTlsVersion"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword protocol_type: Defines the TLS extension protocol that is used for secure delivery. Required. Known values are: "ServerNameIndication" and "IPBased". @@ -12561,7 +13130,7 @@ def __init__( ~azure.mgmt.cdn.models.KeyVaultCertificateSourceParameters """ super().__init__(protocol_type=protocol_type, minimum_tls_version=minimum_tls_version, **kwargs) - self.certificate_source = "AzureKeyVault" # type: str + self.certificate_source: str = "AzureKeyVault" self.certificate_source_parameters = certificate_source_parameters @@ -12582,7 +13151,7 @@ class ValidateCustomDomainInput(_serialization.Model): "host_name": {"key": "hostName", "type": "str"}, } - def __init__(self, *, host_name: str, **kwargs): + def __init__(self, *, host_name: str, **kwargs: Any) -> None: """ :keyword host_name: The host name of the custom domain. Must be a domain name. Required. :paramtype host_name: str @@ -12616,7 +13185,7 @@ class ValidateCustomDomainOutput(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.custom_domain_validated = None @@ -12641,7 +13210,7 @@ class ValidateProbeInput(_serialization.Model): "probe_url": {"key": "probeURL", "type": "str"}, } - def __init__(self, *, probe_url: str, **kwargs): + def __init__(self, *, probe_url: str, **kwargs: Any) -> None: """ :keyword probe_url: The probe URL to validate. Required. :paramtype probe_url: str @@ -12675,7 +13244,7 @@ class ValidateProbeOutput(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.is_valid = None @@ -12717,8 +13286,8 @@ def __init__( secret_type: Union[str, "_models.SecretType"], secret_source: "_models.ResourceReference", secret_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword secret_type: The secret type. Required. Known values are: "UrlSigningKey", "CustomerCertificate", "ManagedCertificate", and "AzureFirstPartyManagedCertificate". @@ -12753,8 +13322,8 @@ class ValidateSecretOutput(_serialization.Model): } def __init__( - self, *, status: Optional[Union[str, "_models.Status"]] = None, message: Optional[str] = None, **kwargs - ): + self, *, status: Optional[Union[str, "_models.Status"]] = None, message: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword status: The validation status. Known values are: "Valid", "Invalid", "AccessDenied", and "CertificateExpired". @@ -12784,7 +13353,7 @@ class ValidationToken(_serialization.Model): "token": {"key": "token", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.token = None @@ -12798,7 +13367,7 @@ class WafMetricsResponse(_serialization.Model): :ivar date_time_end: :vartype date_time_end: ~datetime.datetime :ivar granularity: Known values are: "PT5M", "PT1H", and "P1D". - :vartype granularity: str or ~azure.mgmt.cdn.models.WafMetricsResponseGranularity + :vartype granularity: str or ~azure.mgmt.cdn.models.WafMetricsGranularity :ivar series: :vartype series: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesItem] """ @@ -12815,17 +13384,17 @@ def __init__( *, date_time_begin: Optional[datetime.datetime] = None, date_time_end: Optional[datetime.datetime] = None, - granularity: Optional[Union[str, "_models.WafMetricsResponseGranularity"]] = None, + granularity: Optional[Union[str, "_models.WafMetricsGranularity"]] = None, series: Optional[List["_models.WafMetricsResponseSeriesItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword date_time_begin: :paramtype date_time_begin: ~datetime.datetime :keyword date_time_end: :paramtype date_time_end: ~datetime.datetime :keyword granularity: Known values are: "PT5M", "PT1H", and "P1D". - :paramtype granularity: str or ~azure.mgmt.cdn.models.WafMetricsResponseGranularity + :paramtype granularity: str or ~azure.mgmt.cdn.models.WafMetricsGranularity :keyword series: :paramtype series: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesItem] """ @@ -12842,7 +13411,7 @@ class WafMetricsResponseSeriesItem(_serialization.Model): :ivar metric: :vartype metric: str :ivar unit: "count" - :vartype unit: str or ~azure.mgmt.cdn.models.WafMetricsResponseSeriesItemUnit + :vartype unit: str or ~azure.mgmt.cdn.models.WafMetricsSeriesUnit :ivar groups: :vartype groups: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesPropertiesItemsItem] :ivar data: @@ -12864,18 +13433,18 @@ def __init__( self, *, metric: Optional[str] = None, - unit: Optional[Union[str, "_models.WafMetricsResponseSeriesItemUnit"]] = None, + unit: Optional[Union[str, "_models.WafMetricsSeriesUnit"]] = None, groups: Optional[List["_models.WafMetricsResponseSeriesPropertiesItemsItem"]] = None, data: Optional[ List["_models.Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric: :paramtype metric: str :keyword unit: "count" - :paramtype unit: str or ~azure.mgmt.cdn.models.WafMetricsResponseSeriesItemUnit + :paramtype unit: str or ~azure.mgmt.cdn.models.WafMetricsSeriesUnit :keyword groups: :paramtype groups: list[~azure.mgmt.cdn.models.WafMetricsResponseSeriesPropertiesItemsItem] :keyword data: @@ -12903,7 +13472,7 @@ class WafMetricsResponseSeriesPropertiesItemsItem(_serialization.Model): "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: Any) -> None: """ :keyword name: :paramtype name: str @@ -12942,8 +13511,8 @@ def __init__( date_time_end: Optional[datetime.datetime] = None, groups: Optional[List[str]] = None, data: Optional[List["_models.WafRankingsResponseDataItem"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword date_time_begin: :paramtype date_time_begin: ~datetime.datetime @@ -12986,8 +13555,8 @@ def __init__( metrics: Optional[ List["_models.ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems"] ] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword group_values: :paramtype group_values: list[str] 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 558a501919e22..ebcf7eb374376 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 @@ -17,7 +17,6 @@ from ._rules_operations import RulesOperations from ._security_policies_operations import SecurityPoliciesOperations from ._secrets_operations import SecretsOperations -from ._validate_operations import ValidateOperations from ._log_analytics_operations import LogAnalyticsOperations from ._profiles_operations import ProfilesOperations from ._endpoints_operations import EndpointsOperations @@ -31,7 +30,7 @@ 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 * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -46,7 +45,6 @@ "RulesOperations", "SecurityPoliciesOperations", "SecretsOperations", - "ValidateOperations", "LogAnalyticsOperations", "ProfilesOperations", "EndpointsOperations", 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 4cdd06ee80f9d..91cc84f7faf1d 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_profile_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +61,7 @@ def build_list_by_profile_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +78,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +95,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +112,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +130,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +149,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +167,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,7 +186,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +203,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +220,7 @@ def build_refresh_validation_token_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +237,7 @@ def build_refresh_validation_token_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -275,7 +276,7 @@ def list_by_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 - or CDN profile which is unique within the resource group. Required. + 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 AFDDomain or the result of cls(response) @@ -285,8 +286,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDDomainListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -309,7 +310,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -325,7 +326,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -333,14 +334,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AFDDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -353,7 +355,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get( @@ -386,8 +390,8 @@ def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDDomain] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -400,10 +404,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,7 +425,9 @@ def get( 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}" + } def _create_initial( self, @@ -441,14 +448,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDDomain] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain, (IO, bytes)): + if isinstance(custom_domain, (IOBase, bytes)): _content = custom_domain else: _json = self._serialize.body(custom_domain, "AFDDomain") @@ -467,10 +474,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,21 +488,26 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 201: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 202: deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -593,7 +606,7 @@ def begin_create( :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. Is either a model type or a IO type. Required. + :param custom_domain: Domain properties. Is either a AFDDomain 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. @@ -613,14 +626,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDDomain] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, @@ -641,9 +654,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -655,9 +668,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -678,14 +693,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDDomain] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain_update_properties, (IO, bytes)): + if isinstance(custom_domain_update_properties, (IOBase, bytes)): _content = custom_domain_update_properties else: _json = self._serialize.body(custom_domain_update_properties, "AFDDomainUpdateParameters") @@ -704,10 +719,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -717,18 +733,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDDomain", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -827,8 +848,8 @@ def begin_update( :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. Is either a model type or a IO type. - Required. + :param custom_domain_update_properties: Domain properties. Is either a + AFDDomainUpdateParameters 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. @@ -848,14 +869,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDDomain] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, custom_domain_name=custom_domain_name, @@ -876,9 +897,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -890,9 +911,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, custom_domain_name: str, **kwargs: Any @@ -908,8 +931,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -922,10 +945,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -935,10 +959,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -970,11 +1000,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -993,9 +1023,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -1007,9 +1037,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _refresh_validation_token_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, custom_domain_name: str, **kwargs: Any @@ -1025,8 +1057,8 @@ def _refresh_validation_token_initial( # pylint: disable=inconsistent-return-st _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_validation_token_request( resource_group_name=resource_group_name, @@ -1039,10 +1071,11 @@ def _refresh_validation_token_initial( # pylint: disable=inconsistent-return-st params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1052,10 +1085,16 @@ def _refresh_validation_token_initial( # pylint: disable=inconsistent-return-st error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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" + } @distributed_trace def begin_refresh_validation_token( @@ -1086,11 +1125,11 @@ def begin_refresh_validation_token( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._refresh_validation_token_initial( # type: ignore resource_group_name=resource_group_name, @@ -1109,9 +1148,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -1123,6 +1162,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } 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 69fae98d7abd1..afb0402a413f4 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_profile_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +61,7 @@ def build_list_by_profile_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +78,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +95,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +112,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +130,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +149,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +167,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,7 +186,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +203,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,8 +220,8 @@ def build_purge_content_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +238,7 @@ def build_purge_content_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,7 +257,7 @@ def build_list_resource_usage_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -273,7 +274,7 @@ def build_list_resource_usage_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,8 +291,8 @@ def build_validate_custom_domain_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -308,7 +309,7 @@ def build_validate_custom_domain_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -359,8 +360,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDEndpointListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -383,7 +384,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -399,7 +400,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -407,14 +408,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AFDEndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -427,7 +429,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get( @@ -460,8 +464,8 @@ def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDEndpoint] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -474,10 +478,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,7 +499,9 @@ def get( 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}" + } def _create_initial( self, @@ -515,14 +522,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDEndpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(endpoint, (IO, bytes)): + if isinstance(endpoint, (IOBase, bytes)): _content = endpoint else: _json = self._serialize.body(endpoint, "AFDEndpoint") @@ -541,10 +548,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,6 +562,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDEndpoint", pipeline_response) @@ -561,14 +570,18 @@ def _create_initial( deserialized = self._deserialize("AFDEndpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -672,7 +685,7 @@ def begin_create( :param endpoint_name: Name of the endpoint under the profile which is unique globally. Required. :type endpoint_name: str - :param endpoint: Endpoint properties. Is either a model type or a IO type. Required. + :param endpoint: Endpoint properties. Is either a AFDEndpoint 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. @@ -693,14 +706,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -721,9 +734,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -735,9 +748,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -758,14 +773,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDEndpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(endpoint_update_properties, (IO, bytes)): + if isinstance(endpoint_update_properties, (IOBase, bytes)): _content = endpoint_update_properties else: _json = self._serialize.body(endpoint_update_properties, "AFDEndpointUpdateParameters") @@ -784,10 +799,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -797,18 +813,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDEndpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDEndpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -918,8 +939,8 @@ def begin_update( :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. Is either a model type or a IO - type. Required. + :param endpoint_update_properties: Endpoint update properties. Is either a + AFDEndpointUpdateParameters 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. @@ -940,14 +961,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -968,9 +989,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -982,9 +1003,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any @@ -1000,8 +1023,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1014,10 +1037,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1027,10 +1051,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -1062,11 +1092,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1085,9 +1115,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -1099,9 +1129,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _purge_content_initial( # pylint: disable=inconsistent-return-statements self, @@ -1122,14 +1154,14 @@ def _purge_content_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(contents, (IO, bytes)): + if isinstance(contents, (IOBase, bytes)): _content = contents else: _json = self._serialize.body(contents, "AfdPurgeParameters") @@ -1148,10 +1180,11 @@ def _purge_content_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1161,10 +1194,16 @@ def _purge_content_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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" + } @overload def begin_purge_content( @@ -1272,7 +1311,7 @@ def begin_purge_content( :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. + either a AfdPurgeParameters 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. @@ -1292,12 +1331,12 @@ def begin_purge_content( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._purge_content_initial( # type: ignore resource_group_name=resource_group_name, @@ -1318,9 +1357,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -1332,16 +1371,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } @distributed_trace def list_resource_usage( 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. + """Checks the quota and actual usage of endpoints under the given Azure Front Door profile. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -1359,8 +1399,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1384,7 +1424,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1400,7 +1440,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1408,14 +1448,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1428,7 +1469,9 @@ def get_next(next_link=None): 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" + } @overload def validate_custom_domain( @@ -1441,8 +1484,8 @@ def validate_custom_domain( 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. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door endpoint + in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -1474,8 +1517,8 @@ def validate_custom_domain( 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. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door endpoint + in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -1505,8 +1548,8 @@ def validate_custom_domain( 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. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door endpoint + in DNS. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -1516,8 +1559,8 @@ def validate_custom_domain( :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. + :param custom_domain_properties: Custom domain to be validated. Is either a + ValidateCustomDomainInput 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. @@ -1538,14 +1581,14 @@ def validate_custom_domain( _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.ValidateCustomDomainOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateCustomDomainOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain_properties, (IO, bytes)): + if isinstance(custom_domain_properties, (IOBase, bytes)): _content = custom_domain_properties else: _json = self._serialize.body(custom_domain_properties, "ValidateCustomDomainInput") @@ -1564,10 +1607,11 @@ def validate_custom_domain( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1584,4 +1628,6 @@ def validate_custom_domain( 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" + } 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 3e48ba219706e..ac81758ffb260 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_profile_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +61,7 @@ def build_list_by_profile_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +78,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +95,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +112,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +130,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +149,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +167,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,7 +186,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +203,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +220,7 @@ def build_list_resource_usage_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +237,7 @@ def build_list_resource_usage_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -285,8 +286,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDOriginGroupListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -309,7 +310,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -325,7 +326,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -333,14 +334,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AFDOriginGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -353,7 +355,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get( @@ -385,8 +389,8 @@ def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDOriginGroup] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -399,10 +403,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -419,7 +424,9 @@ def get( 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}" + } def _create_initial( self, @@ -440,14 +447,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOriginGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_group, (IO, bytes)): + if isinstance(origin_group, (IOBase, bytes)): _content = origin_group else: _json = self._serialize.body(origin_group, "AFDOriginGroup") @@ -466,10 +473,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,6 +487,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDOriginGroup", pipeline_response) @@ -486,14 +495,18 @@ def _create_initial( deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -594,7 +607,8 @@ def begin_create( :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. Is either a model type or a IO type. Required. + :param origin_group: Origin group properties. Is either a AFDOriginGroup 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. @@ -615,14 +629,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOriginGroup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, @@ -643,9 +657,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -657,9 +671,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -680,14 +696,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOriginGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_group_update_properties, (IO, bytes)): + if isinstance(origin_group_update_properties, (IOBase, bytes)): _content = origin_group_update_properties else: _json = self._serialize.body(origin_group_update_properties, "AFDOriginGroupUpdateParameters") @@ -706,10 +722,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -719,18 +736,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDOriginGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -831,8 +853,8 @@ def begin_update( :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. Is either a model type or a IO - type. Required. + :param origin_group_update_properties: Origin group properties. Is either a + AFDOriginGroupUpdateParameters 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'. @@ -854,14 +876,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOriginGroup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, @@ -882,9 +904,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -896,9 +918,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, origin_group_name: str, **kwargs: Any @@ -914,8 +938,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -928,10 +952,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -941,10 +966,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -975,11 +1006,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -998,9 +1029,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -1012,16 +1043,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace def list_resource_usage( 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. + """Checks the quota and actual usage of endpoints under the given Azure Front Door profile.. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -1039,8 +1071,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1064,7 +1096,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1080,7 +1112,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1088,14 +1120,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1108,4 +1141,6 @@ def get_next(next_link=None): 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" + } 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 6e8b75d6a6e5a..b55e1a604a3a6 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_origin_group_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +62,7 @@ def build_list_by_origin_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +102,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,8 +124,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +143,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,8 +167,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +186,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +210,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -227,7 +228,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -279,8 +280,8 @@ def list_by_origin_group( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDOriginListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -304,7 +305,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -320,7 +321,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -328,14 +329,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AFDOriginListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -348,7 +350,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get( @@ -382,8 +386,8 @@ def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AFDOrigin] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -397,10 +401,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -417,7 +422,9 @@ def get( 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}" + } def _create_initial( self, @@ -439,14 +446,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOrigin] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin, (IO, bytes)): + if isinstance(origin, (IOBase, bytes)): _content = origin else: _json = self._serialize.body(origin, "AFDOrigin") @@ -466,10 +473,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,6 +487,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDOrigin", pipeline_response) @@ -486,14 +495,18 @@ def _create_initial( deserialized = self._deserialize("AFDOrigin", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -601,7 +614,7 @@ def begin_create( :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. Is either a model type or a IO type. Required. + :param origin: Origin properties. Is either a AFDOrigin 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. @@ -621,14 +634,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOrigin] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, @@ -650,9 +663,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -664,9 +677,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -688,14 +703,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOrigin] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_update_properties, (IO, bytes)): + if isinstance(origin_update_properties, (IOBase, bytes)): _content = origin_update_properties else: _json = self._serialize.body(origin_update_properties, "AFDOriginUpdateParameters") @@ -715,10 +730,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -728,18 +744,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("AFDOrigin", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("AFDOrigin", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -847,8 +868,8 @@ def begin_update( :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. Is either a model type or a IO type. - Required. + :param origin_update_properties: Origin properties. Is either a AFDOriginUpdateParameters 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. @@ -868,14 +889,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AFDOrigin] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, origin_group_name=origin_group_name, @@ -897,9 +918,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -911,9 +932,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 @@ -929,8 +952,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -944,10 +967,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -957,10 +981,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -993,11 +1023,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1017,9 +1047,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -1031,6 +1061,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 c35bd65022b5d..fd8258f3ed097 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 @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -20,14 +21,16 @@ 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 .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,13 +39,51 @@ _SERIALIZER.client_side_validation = False +def build_check_endpoint_name_availability_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/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\._\(\)]+$" + ), + "profileName": _SERIALIZER.url( + "profile_name", profile_name, "str", max_length=260, min_length=1, pattern=r"^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _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_list_resource_usage_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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +99,7 @@ def build_list_resource_usage_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,8 +116,8 @@ def build_check_host_name_availability_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +133,83 @@ def build_check_host_name_availability_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _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_secret_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/validateSecret", + ) # 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", max_length=260, min_length=1, pattern=r"^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _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_upgrade_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/upgrade", + ) # 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", max_length=260, min_length=1, pattern=r"^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,16 +241,164 @@ def __init__(self, *args, **kwargs): 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") + @overload + def check_endpoint_name_availability( + self, + resource_group_name: str, + profile_name: str, + check_endpoint_name_availability_input: _models.CheckEndpointNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckEndpointNameAvailabilityOutput: + """Check the availability of an afdx endpoint name, and return the globally unique endpoint 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 which is + unique within the resource group. Required. + :type profile_name: str + :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, + profile_name: str, + check_endpoint_name_availability_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckEndpointNameAvailabilityOutput: + """Check the availability of an afdx endpoint name, and return the globally unique endpoint 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 which is + unique within the resource group. Required. + :type profile_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, + profile_name: str, + check_endpoint_name_availability_input: Union[_models.CheckEndpointNameAvailabilityInput, IO], + **kwargs: Any + ) -> _models.CheckEndpointNameAvailabilityOutput: + """Check the availability of an afdx endpoint name, and return the globally unique endpoint 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 which is + unique within the resource group. Required. + :type profile_name: str + :param check_endpoint_name_availability_input: Input to check. Is either a + CheckEndpointNameAvailabilityInput 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckEndpointNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(check_endpoint_name_availability_input, (IOBase, 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( + 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, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CheckEndpointNameAvailabilityOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_endpoint_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkEndpointNameAvailability" + } + @distributed_trace def list_resource_usage( 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. + """Checks the quota and actual usage of endpoints under the given Azure Front Door 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 or CDN - profile which is unique within the resource group. Required. + :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 :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Usage or the result of cls(response) @@ -143,8 +408,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -167,7 +432,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -183,7 +448,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -191,14 +456,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -211,7 +477,9 @@ def get_next(next_link=None): 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" + } @overload def check_host_name_availability( @@ -223,12 +491,13 @@ def check_host_name_availability( content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: - """Check the name availability of a host name. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door 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 Azure Front Door Standard or Azure Front Door Premium or CDN - profile which is unique within the resource group. Required. + :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 check_host_name_availability_input: Custom domain to be validated. Required. :type check_host_name_availability_input: ~azure.mgmt.cdn.models.CheckHostNameAvailabilityInput @@ -251,12 +520,13 @@ def check_host_name_availability( content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: - """Check the name availability of a host name. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door 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 Azure Front Door Standard or Azure Front Door Premium or CDN - profile which is unique within the resource group. Required. + :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 check_host_name_availability_input: Custom domain to be validated. Required. :type check_host_name_availability_input: IO @@ -277,15 +547,16 @@ def check_host_name_availability( check_host_name_availability_input: Union[_models.CheckHostNameAvailabilityInput, IO], **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: - """Check the name availability of a host name. + """Validates the custom domain mapping to ensure it maps to the correct Azure Front Door 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 Azure Front Door Standard or Azure Front Door Premium or CDN - profile which is unique within the resource group. Required. + :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 check_host_name_availability_input: Custom domain to be validated. Is either a model - type or a IO type. Required. + :param check_host_name_availability_input: Custom domain to be validated. Is either a + CheckHostNameAvailabilityInput 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'. @@ -307,14 +578,14 @@ def check_host_name_availability( _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.CheckNameAvailabilityOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_host_name_availability_input, (IO, bytes)): + if isinstance(check_host_name_availability_input, (IOBase, bytes)): _content = check_host_name_availability_input else: _json = self._serialize.body(check_host_name_availability_input, "CheckHostNameAvailabilityInput") @@ -332,10 +603,11 @@ def check_host_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -352,4 +624,377 @@ def check_host_name_availability( 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" + } + + @overload + def validate_secret( + self, + resource_group_name: str, + profile_name: str, + validate_secret_input: _models.ValidateSecretInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidateSecretOutput: + """Validate a Secret in the 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 which is + unique within the resource group. Required. + :type profile_name: str + :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 validate_secret( + self, + resource_group_name: str, + profile_name: str, + validate_secret_input: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidateSecretOutput: + """Validate a Secret in the 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 which is + unique within the resource group. Required. + :type profile_name: str + :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) + :rtype: ~azure.mgmt.cdn.models.ValidateSecretOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate_secret( + self, + resource_group_name: str, + profile_name: str, + validate_secret_input: Union[_models.ValidateSecretInput, IO], + **kwargs: Any + ) -> _models.ValidateSecretOutput: + """Validate a Secret in the 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 which is + unique within the resource group. Required. + :type profile_name: str + :param validate_secret_input: The Secret source. Is either a ValidateSecretInput 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateSecretOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(validate_secret_input, (IOBase, bytes)): + _content = validate_secret_input + else: + _json = self._serialize.body(validate_secret_input, "ValidateSecretInput") + + request = build_validate_secret_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, + content=_content, + template_url=self.validate_secret.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ValidateSecretOutput", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_secret.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/validateSecret" + } + + def _upgrade_initial( + self, + resource_group_name: str, + profile_name: str, + profile_upgrade_parameters: Union[_models.ProfileUpgradeParameters, IO], + **kwargs: Any + ) -> _models.Profile: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(profile_upgrade_parameters, (IOBase, bytes)): + _content = profile_upgrade_parameters + else: + _json = self._serialize.body(profile_upgrade_parameters, "ProfileUpgradeParameters") + + request = build_upgrade_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, + content=_content, + template_url=self._upgrade_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Profile", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = self._deserialize("Profile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _upgrade_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/upgrade" + } + + @overload + def begin_upgrade( + self, + resource_group_name: str, + profile_name: str, + profile_upgrade_parameters: _models.ProfileUpgradeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Profile]: + """Upgrade a profile from Standard_AzureFrontDoor to Premium_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 which is + unique within the resource group. Required. + :type profile_name: str + :param profile_upgrade_parameters: Profile upgrade input parameter. Required. + :type profile_upgrade_parameters: ~azure.mgmt.cdn.models.ProfileUpgradeParameters + :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 Profile or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.Profile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_upgrade( + self, + resource_group_name: str, + profile_name: str, + profile_upgrade_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Profile]: + """Upgrade a profile from Standard_AzureFrontDoor to Premium_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 which is + unique within the resource group. Required. + :type profile_name: str + :param profile_upgrade_parameters: Profile upgrade input parameter. Required. + :type profile_upgrade_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_upgrade( + self, + resource_group_name: str, + profile_name: str, + profile_upgrade_parameters: Union[_models.ProfileUpgradeParameters, IO], + **kwargs: Any + ) -> LROPoller[_models.Profile]: + """Upgrade a profile from Standard_AzureFrontDoor to Premium_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 which is + unique within the resource group. Required. + :type profile_name: str + :param profile_upgrade_parameters: Profile upgrade input parameter. Is either a + ProfileUpgradeParameters type or a IO type. Required. + :type profile_upgrade_parameters: ~azure.mgmt.cdn.models.ProfileUpgradeParameters 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._upgrade_initial( + resource_group_name=resource_group_name, + profile_name=profile_name, + profile_upgrade_parameters=profile_upgrade_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("Profile", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + 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) # type: ignore + + begin_upgrade.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/upgrade" + } 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 3da143430d57f..009039d53364d 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,8 +41,8 @@ def build_check_endpoint_name_availability_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +57,7 @@ def build_check_endpoint_name_availability_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,8 +74,8 @@ 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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,8 +96,8 @@ def build_check_name_availability_with_subscription_request(subscription_id: 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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +106,7 @@ def build_check_name_availability_with_subscription_request(subscription_id: str "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,8 +123,8 @@ def build_validate_probe_request(subscription_id: str, **kwargs: Any) -> HttpReq _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +133,7 @@ def build_validate_probe_request(subscription_id: str, **kwargs: Any) -> HttpReq "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +146,7 @@ def build_validate_probe_request(subscription_id: str, **kwargs: Any) -> HttpReq return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class CdnManagementClientOperationsMixin(MixinABC): +class CdnManagementClientOperationsMixin(CdnManagementClientMixinABC): @overload def check_endpoint_name_availability( self, @@ -209,8 +210,8 @@ def check_endpoint_name_availability( :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. + :param check_endpoint_name_availability_input: Input to check. Is either a + CheckEndpointNameAvailabilityInput 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'. @@ -232,14 +233,14 @@ def check_endpoint_name_availability( _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.CheckEndpointNameAvailabilityOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckEndpointNameAvailabilityOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_endpoint_name_availability_input, (IO, bytes)): + if isinstance(check_endpoint_name_availability_input, (IOBase, bytes)): _content = check_endpoint_name_availability_input else: _json = self._serialize.body(check_endpoint_name_availability_input, "CheckEndpointNameAvailabilityInput") @@ -256,10 +257,11 @@ def check_endpoint_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -276,7 +278,9 @@ def check_endpoint_name_availability( 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" + } @overload def check_name_availability( @@ -325,8 +329,8 @@ def check_name_availability( """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. + :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput + 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. @@ -347,14 +351,14 @@ def check_name_availability( _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.CheckNameAvailabilityOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_input, (IO, bytes)): + if isinstance(check_name_availability_input, (IOBase, bytes)): _content = check_name_availability_input else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") @@ -369,10 +373,11 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +394,7 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/providers/Microsoft.Cdn/checkNameAvailability"} # type: ignore + check_name_availability.metadata = {"url": "/providers/Microsoft.Cdn/checkNameAvailability"} @overload def check_name_availability_with_subscription( @@ -438,8 +443,8 @@ def check_name_availability_with_subscription( """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. + :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput + 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. @@ -460,14 +465,14 @@ def check_name_availability_with_subscription( _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.CheckNameAvailabilityOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_input, (IO, bytes)): + if isinstance(check_name_availability_input, (IOBase, bytes)): _content = check_name_availability_input else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") @@ -483,10 +488,11 @@ def check_name_availability_with_subscription( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -503,7 +509,9 @@ def check_name_availability_with_subscription( 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" + } @overload def validate_probe( @@ -551,7 +559,8 @@ def validate_probe( 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. Is either a model type or a IO type. Required. + :param validate_probe_input: Input to check. Is either a ValidateProbeInput 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. @@ -572,14 +581,14 @@ def validate_probe( _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.ValidateProbeOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateProbeOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(validate_probe_input, (IO, bytes)): + if isinstance(validate_probe_input, (IOBase, bytes)): _content = validate_probe_input else: _json = self._serialize.body(validate_probe_input, "ValidateProbeInput") @@ -595,10 +604,11 @@ def validate_probe( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -615,4 +625,4 @@ def validate_probe( return deserialized - validate_probe.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe"} # type: ignore + validate_probe.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe"} 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 13d96386c276d..e15a88fc08c1c 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_endpoint_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +62,7 @@ def build_list_by_endpoint_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +102,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,8 +124,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +143,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,7 +167,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +185,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,7 +207,7 @@ def build_disable_custom_https_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,7 +225,7 @@ def build_disable_custom_https_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -246,8 +247,8 @@ def build_enable_custom_https_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -265,7 +266,7 @@ def build_enable_custom_https_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -319,8 +320,8 @@ def list_by_endpoint( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomainListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -344,7 +345,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -360,7 +361,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -368,14 +369,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomDomainListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -388,7 +390,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get( @@ -422,8 +426,8 @@ def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -437,10 +441,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,7 +462,9 @@ def get( 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}" + } def _create_initial( self, @@ -479,14 +486,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain_properties, (IO, bytes)): + if isinstance(custom_domain_properties, (IOBase, bytes)): _content = custom_domain_properties else: _json = self._serialize.body(custom_domain_properties, "CustomDomainParameters") @@ -506,10 +513,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -519,6 +527,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CustomDomain", pipeline_response) @@ -526,14 +535,18 @@ def _create_initial( deserialized = self._deserialize("CustomDomain", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -644,7 +657,7 @@ def begin_create( :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. Is either a - model type or a IO type. Required. + CustomDomainParameters 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. @@ -665,14 +678,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -694,7 +707,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -706,9 +719,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _delete_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any @@ -724,8 +739,8 @@ def _delete_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]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.CustomDomain]] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -739,10 +754,11 @@ def _delete_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -753,20 +769,25 @@ def _delete_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) 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}" + } @distributed_trace def begin_delete( self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any - ) -> LROPoller[None]: + ) -> LROPoller[_models.CustomDomain]: """Deletes an existing custom domain within an endpoint. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. @@ -795,13 +816,13 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -815,13 +836,17 @@ def begin_delete( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -833,9 +858,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}" + } def _disable_custom_https_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, custom_domain_name: str, **kwargs: Any @@ -851,8 +878,8 @@ def _disable_custom_https_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[_models.CustomDomain] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) request = build_disable_custom_https_request( resource_group_name=resource_group_name, @@ -866,10 +893,11 @@ def _disable_custom_https_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -879,18 +907,23 @@ def _disable_custom_https_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CustomDomain", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _disable_custom_https_initial.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" + } @distributed_trace def begin_disable_custom_https( @@ -924,13 +957,13 @@ def begin_disable_custom_https( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._disable_custom_https_initial( # type: ignore + raw_result = self._disable_custom_https_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -950,7 +983,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -962,9 +995,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_disable_custom_https.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps"} # type: ignore + begin_disable_custom_https.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps" + } def _enable_custom_https_initial( self, @@ -986,14 +1021,14 @@ def _enable_custom_https_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain_https_parameters, (IO, bytes)): + if isinstance(custom_domain_https_parameters, (IOBase, bytes)): _content = custom_domain_https_parameters else: if custom_domain_https_parameters is not None: @@ -1016,10 +1051,11 @@ def _enable_custom_https_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1029,18 +1065,23 @@ def _enable_custom_https_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CustomDomain", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CustomDomain", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _enable_custom_https_initial.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" + } @overload def begin_enable_custom_https( @@ -1156,8 +1197,8 @@ def begin_enable_custom_https( :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. + enabling ssl uses CDN managed certificate by default. Is either a CustomDomainHttpsParameters + 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. @@ -1178,14 +1219,14 @@ def begin_enable_custom_https( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomDomain] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._enable_custom_https_initial( # type: ignore + raw_result = self._enable_custom_https_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -1207,7 +1248,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1219,6 +1260,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_enable_custom_https.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps"} # type: ignore + begin_enable_custom_https.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps" + } 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 d1f9c24f5991c..3476584d71475 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 @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ 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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,8 +87,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.EdgeNode"]: _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EdgenodeResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +124,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,14 +132,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EdgenodeResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,4 +153,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Cdn/edgenodes"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Cdn/edgenodes"} 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 b933271e1570f..4b99ac380ba20 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_profile_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +61,7 @@ def build_list_by_profile_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +78,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +95,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +112,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +130,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +149,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +167,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,7 +186,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +203,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +220,7 @@ def build_start_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +237,7 @@ def build_start_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -253,7 +254,7 @@ def build_stop_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +271,7 @@ def build_stop_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,8 +288,8 @@ def build_purge_content_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -305,7 +306,7 @@ def build_purge_content_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,8 +325,8 @@ def build_load_content_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -342,7 +343,7 @@ def build_load_content_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -361,8 +362,8 @@ def build_validate_custom_domain_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -379,7 +380,7 @@ def build_validate_custom_domain_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -398,7 +399,7 @@ def build_list_resource_usage_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -415,7 +416,7 @@ def build_list_resource_usage_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -464,8 +465,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -488,7 +489,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -504,7 +505,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -512,14 +513,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -532,7 +534,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get(self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any) -> _models.Endpoint: @@ -563,8 +567,8 @@ def get(self, resource_group_name: str, profile_name: str, endpoint_name: 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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -577,10 +581,11 @@ def get(self, resource_group_name: str, profile_name: str, endpoint_name: str, * params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -597,7 +602,9 @@ def get(self, resource_group_name: str, profile_name: str, endpoint_name: str, * 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}" + } def _create_initial( self, @@ -618,14 +625,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(endpoint, (IO, bytes)): + if isinstance(endpoint, (IOBase, bytes)): _content = endpoint else: _json = self._serialize.body(endpoint, "Endpoint") @@ -644,10 +651,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,6 +665,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Endpoint", pipeline_response) @@ -664,14 +673,18 @@ def _create_initial( deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -773,7 +786,7 @@ def begin_create( :param endpoint_name: Name of the endpoint under the profile which is unique globally. Required. :type endpoint_name: str - :param endpoint: Endpoint properties. Is either a model type or a IO type. Required. + :param endpoint: Endpoint properties. Is either a Endpoint 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. @@ -793,14 +806,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -821,7 +834,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -833,9 +846,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -856,14 +871,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(endpoint_update_properties, (IO, bytes)): + if isinstance(endpoint_update_properties, (IOBase, bytes)): _content = endpoint_update_properties else: _json = self._serialize.body(endpoint_update_properties, "EndpointUpdateParameters") @@ -882,10 +897,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -895,18 +911,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -1014,8 +1035,8 @@ def begin_update( :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. Is either a model type or a IO - type. Required. + :param endpoint_update_properties: Endpoint update properties. Is either a + EndpointUpdateParameters 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. @@ -1035,14 +1056,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -1063,7 +1084,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1075,9 +1096,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any @@ -1093,8 +1116,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1107,10 +1130,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1120,10 +1144,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -1155,11 +1185,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1178,7 +1208,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1190,9 +1220,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _start_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any @@ -1208,8 +1240,8 @@ def _start_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[_models.Endpoint] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -1222,10 +1254,11 @@ def _start_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1235,18 +1268,23 @@ def _start_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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" + } @distributed_trace def begin_start( @@ -1277,13 +1315,13 @@ def begin_start( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_initial( # type: ignore + raw_result = self._start_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -1302,7 +1340,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1314,9 +1352,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } def _stop_initial( self, resource_group_name: str, profile_name: str, endpoint_name: str, **kwargs: Any @@ -1332,8 +1372,8 @@ def _stop_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[_models.Endpoint] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) request = build_stop_request( resource_group_name=resource_group_name, @@ -1346,10 +1386,11 @@ def _stop_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1359,18 +1400,23 @@ def _stop_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Endpoint", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Endpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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" + } @distributed_trace def begin_stop( @@ -1401,13 +1447,13 @@ def begin_stop( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Endpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._stop_initial( # type: ignore + raw_result = self._stop_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -1426,7 +1472,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1438,9 +1484,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } def _purge_content_initial( # pylint: disable=inconsistent-return-statements self, @@ -1461,14 +1509,14 @@ def _purge_content_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(content_file_paths, (IO, bytes)): + if isinstance(content_file_paths, (IOBase, bytes)): _content = content_file_paths else: _json = self._serialize.body(content_file_paths, "PurgeParameters") @@ -1487,10 +1535,11 @@ def _purge_content_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1500,10 +1549,16 @@ def _purge_content_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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" + } @overload def begin_purge_content( @@ -1608,8 +1663,8 @@ def begin_purge_content( :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. Is either a model type or a - IO type. Required. + '/pictures/*' which removes all folders and files in the directory. Is either a PurgeParameters + 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. @@ -1629,12 +1684,12 @@ def begin_purge_content( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._purge_content_initial( # type: ignore resource_group_name=resource_group_name, @@ -1655,7 +1710,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1667,9 +1722,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } def _load_content_initial( # pylint: disable=inconsistent-return-statements self, @@ -1690,14 +1747,14 @@ def _load_content_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(content_file_paths, (IO, bytes)): + if isinstance(content_file_paths, (IOBase, bytes)): _content = content_file_paths else: _json = self._serialize.body(content_file_paths, "LoadParameters") @@ -1716,10 +1773,11 @@ def _load_content_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1729,10 +1787,16 @@ def _load_content_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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" + } @overload def begin_load_content( @@ -1834,8 +1898,8 @@ def begin_load_content( 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. Is either a model type or a IO type. - Required. + e.g. ‘/pictures/city.png' which loads a single file. Is either a LoadParameters 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. @@ -1855,12 +1919,12 @@ def begin_load_content( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._load_content_initial( # type: ignore resource_group_name=resource_group_name, @@ -1881,7 +1945,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1893,9 +1957,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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" + } @overload def validate_custom_domain( @@ -1980,8 +2046,8 @@ def validate_custom_domain( :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. + :param custom_domain_properties: Custom domain to be validated. Is either a + ValidateCustomDomainInput 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. @@ -2002,14 +2068,14 @@ def validate_custom_domain( _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.ValidateCustomDomainOutput] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateCustomDomainOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_domain_properties, (IO, bytes)): + if isinstance(custom_domain_properties, (IOBase, bytes)): _content = custom_domain_properties else: _json = self._serialize.body(custom_domain_properties, "ValidateCustomDomainInput") @@ -2028,10 +2094,11 @@ def validate_custom_domain( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2048,7 +2115,9 @@ def validate_custom_domain( 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" + } @distributed_trace def list_resource_usage( @@ -2072,8 +2141,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceUsageListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -2097,7 +2166,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -2113,7 +2182,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -2121,14 +2190,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2141,4 +2211,6 @@ def get_next(next_link=None): 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" + } 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 0c81764d0d77b..c487a8cd8004f 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 @@ -26,7 +26,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_get_log_analytics_metrics_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +70,7 @@ def build_get_log_analytics_metrics_request( "profileName": _SERIALIZER.url("profile_name", profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +113,7 @@ def build_get_log_analytics_rankings_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_log_analytics_rankings_request( "profileName": _SERIALIZER.url("profile_name", profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +155,7 @@ def build_get_log_analytics_locations_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +171,7 @@ def build_get_log_analytics_locations_request( "profileName": _SERIALIZER.url("profile_name", profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +188,7 @@ def build_get_log_analytics_resources_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,7 +204,7 @@ def build_get_log_analytics_resources_request( "profileName": _SERIALIZER.url("profile_name", profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -232,7 +232,7 @@ def build_get_waf_log_analytics_metrics_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +248,7 @@ def build_get_waf_log_analytics_metrics_request( "profileName": _SERIALIZER.url("profile_name", profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -286,7 +286,7 @@ def build_get_waf_log_analytics_rankings_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +302,7 @@ def build_get_waf_log_analytics_rankings_request( "profileName": _SERIALIZER.url("profile_name", profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -398,8 +398,8 @@ def get_log_analytics_metrics( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MetricsResponse] = kwargs.pop("cls", None) request = build_get_log_analytics_metrics_request( resource_group_name=resource_group_name, @@ -420,10 +420,11 @@ def get_log_analytics_metrics( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -440,7 +441,9 @@ def get_log_analytics_metrics( 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" + } @distributed_trace def get_log_analytics_rankings( @@ -490,8 +493,8 @@ def get_log_analytics_rankings( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RankingsResponse] = kwargs.pop("cls", None) request = build_get_log_analytics_rankings_request( resource_group_name=resource_group_name, @@ -509,10 +512,11 @@ def get_log_analytics_rankings( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -529,7 +533,9 @@ def get_log_analytics_rankings( 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" + } @distributed_trace def get_log_analytics_locations( @@ -558,8 +564,8 @@ def get_log_analytics_locations( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContinentsResponse] = kwargs.pop("cls", None) request = build_get_log_analytics_locations_request( resource_group_name=resource_group_name, @@ -571,10 +577,11 @@ def get_log_analytics_locations( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -591,7 +598,9 @@ def get_log_analytics_locations( 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" + } @distributed_trace def get_log_analytics_resources( @@ -620,8 +629,8 @@ def get_log_analytics_resources( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourcesResponse] = kwargs.pop("cls", None) request = build_get_log_analytics_resources_request( resource_group_name=resource_group_name, @@ -633,10 +642,11 @@ def get_log_analytics_resources( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -653,7 +663,9 @@ def get_log_analytics_resources( 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" + } @distributed_trace def get_waf_log_analytics_metrics( @@ -706,8 +718,8 @@ def get_waf_log_analytics_metrics( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WafMetricsResponse] = kwargs.pop("cls", None) request = build_get_waf_log_analytics_metrics_request( resource_group_name=resource_group_name, @@ -726,10 +738,11 @@ def get_waf_log_analytics_metrics( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -746,7 +759,9 @@ def get_waf_log_analytics_metrics( 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" + } @distributed_trace def get_waf_log_analytics_rankings( @@ -799,8 +814,8 @@ def get_waf_log_analytics_rankings( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WafRankingsResponse] = kwargs.pop("cls", None) request = build_get_waf_log_analytics_rankings_request( resource_group_name=resource_group_name, @@ -819,10 +834,11 @@ def get_waf_log_analytics_rankings( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -839,4 +855,6 @@ def get_waf_log_analytics_rankings( 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" + } 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 434a8795e9edd..450b3804a3cf7 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 @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ 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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,8 +95,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.ManagedRuleSetDefinition"]: _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ManagedRuleSetDefinitionList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -117,7 +117,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -133,7 +133,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -141,14 +141,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ManagedRuleSetDefinitionList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -161,4 +162,6 @@ def get_next(next_link=None): 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" + } 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 1112601542897..0a325b720da96 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 @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ 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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,8 +86,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -123,7 +123,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,14 +131,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,4 +152,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Cdn/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Cdn/operations"} 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 1d24b3553efd1..a7b7d4a559cae 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_endpoint_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +62,7 @@ def build_list_by_endpoint_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +102,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,8 +124,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +143,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,8 +167,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +186,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +210,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -227,7 +228,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -279,8 +280,8 @@ def list_by_endpoint( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OriginGroupListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -304,7 +305,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -320,7 +321,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -328,14 +329,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OriginGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -348,7 +350,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get( @@ -383,8 +387,8 @@ def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OriginGroup] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -398,10 +402,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +423,9 @@ def get( 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}" + } def _create_initial( self, @@ -440,14 +447,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OriginGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_group, (IO, bytes)): + if isinstance(origin_group, (IOBase, bytes)): _content = origin_group else: _json = self._serialize.body(origin_group, "OriginGroup") @@ -467,10 +474,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,6 +488,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("OriginGroup", pipeline_response) @@ -487,14 +496,18 @@ def _create_initial( deserialized = self._deserialize("OriginGroup", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -607,7 +620,8 @@ def begin_create( :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. Is either a model type or a IO type. Required. + :param origin_group: Origin group properties. Is either a OriginGroup 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. @@ -628,14 +642,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OriginGroup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -657,7 +671,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -669,9 +683,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -693,14 +709,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OriginGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_group_update_properties, (IO, bytes)): + if isinstance(origin_group_update_properties, (IOBase, bytes)): _content = origin_group_update_properties else: _json = self._serialize.body(origin_group_update_properties, "OriginGroupUpdateParameters") @@ -720,10 +736,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -733,18 +750,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("OriginGroup", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("OriginGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -857,8 +879,8 @@ def begin_update( :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. Is either a model type or a IO - type. Required. + :param origin_group_update_properties: Origin group properties. Is either a + OriginGroupUpdateParameters 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. @@ -879,14 +901,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OriginGroup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -908,7 +930,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -920,9 +942,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 @@ -938,8 +962,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -953,10 +977,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -966,10 +991,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -1003,11 +1034,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1027,7 +1058,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1039,6 +1070,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 e73e1b6245f44..14567dd263bb1 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_endpoint_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +62,7 @@ def build_list_by_endpoint_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +102,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,8 +124,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +143,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,8 +167,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +186,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +210,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -227,7 +228,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -279,8 +280,8 @@ def list_by_endpoint( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OriginListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -304,7 +305,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -320,7 +321,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -328,14 +329,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OriginListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -348,7 +350,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get( @@ -382,8 +386,8 @@ def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Origin] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -397,10 +401,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -417,7 +422,9 @@ def get( 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}" + } def _create_initial( self, @@ -439,14 +446,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Origin] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin, (IO, bytes)): + if isinstance(origin, (IOBase, bytes)): _content = origin else: _json = self._serialize.body(origin, "Origin") @@ -466,10 +473,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -479,6 +487,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Origin", pipeline_response) @@ -486,14 +495,18 @@ def _create_initial( deserialized = self._deserialize("Origin", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Origin", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -601,7 +614,7 @@ def begin_create( :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. Is either a model type or a IO type. Required. + :param origin: Origin properties. Is either a Origin 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. @@ -621,14 +634,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Origin] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -650,7 +663,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -662,9 +675,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -686,14 +701,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Origin] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(origin_update_properties, (IO, bytes)): + if isinstance(origin_update_properties, (IOBase, bytes)): _content = origin_update_properties else: _json = self._serialize.body(origin_update_properties, "OriginUpdateParameters") @@ -713,10 +728,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -726,18 +742,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Origin", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Origin", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -845,8 +866,8 @@ def begin_update( :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. Is either a model type or a IO type. - Required. + :param origin_update_properties: Origin properties. Is either a OriginUpdateParameters 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. @@ -866,14 +887,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Origin] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -895,7 +916,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -907,9 +928,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, origin_name: str, **kwargs: Any @@ -925,8 +948,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -940,10 +963,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -953,10 +977,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -989,11 +1019,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1013,7 +1043,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1025,6 +1055,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 05b9850a9ffd5..a8792e1b4e392 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +63,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +78,7 @@ def build_get_request(resource_group_name: str, policy_name: str, subscription_i _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +99,7 @@ def build_get_request(resource_group_name: str, policy_name: str, subscription_i "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,8 +116,8 @@ def build_create_or_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +138,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,8 +157,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +179,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,7 +198,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +219,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -263,8 +264,8 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Cdn _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicyList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -286,7 +287,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -302,7 +303,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -310,14 +311,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CdnWebApplicationFirewallPolicyList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -330,7 +332,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get(self, resource_group_name: str, policy_name: str, **kwargs: Any) -> _models.CdnWebApplicationFirewallPolicy: @@ -356,8 +360,8 @@ def get(self, resource_group_name: str, policy_name: str, **kwargs: Any) -> _mod _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -369,10 +373,11 @@ def get(self, resource_group_name: str, policy_name: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,7 +394,9 @@ def get(self, resource_group_name: str, policy_name: str, **kwargs: Any) -> _mod 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}" + } def _create_or_update_initial( self, @@ -409,14 +416,14 @@ def _create_or_update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cdn_web_application_firewall_policy, (IO, bytes)): + if isinstance(cdn_web_application_firewall_policy, (IOBase, bytes)): _content = cdn_web_application_firewall_policy else: _json = self._serialize.body(cdn_web_application_firewall_policy, "CdnWebApplicationFirewallPolicy") @@ -434,10 +441,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -447,6 +455,7 @@ def _create_or_update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) @@ -454,14 +463,18 @@ def _create_or_update_initial( deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create_or_update( @@ -548,8 +561,8 @@ def begin_create_or_update( :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. Is either a model type or a - IO type. Required. + :param cdn_web_application_firewall_policy: Policy to be created. Is either a + CdnWebApplicationFirewallPolicy type or a IO type. Required. :type cdn_web_application_firewall_policy: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -571,14 +584,14 @@ def begin_create_or_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy=cdn_web_application_firewall_policy, @@ -598,7 +611,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -610,9 +623,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -634,14 +649,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(cdn_web_application_firewall_policy_patch_parameters, (IO, bytes)): + if isinstance(cdn_web_application_firewall_policy_patch_parameters, (IOBase, bytes)): _content = cdn_web_application_firewall_policy_patch_parameters else: _json = self._serialize.body( @@ -661,10 +676,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -674,18 +690,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("CdnWebApplicationFirewallPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -780,7 +801,8 @@ def begin_update( :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. Is either a model type or a IO type. Required. + parameters to be patched. Is either a CdnWebApplicationFirewallPolicyPatchParameters type or a + IO type. Required. :type cdn_web_application_firewall_policy_patch_parameters: ~azure.mgmt.cdn.models.CdnWebApplicationFirewallPolicyPatchParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -802,14 +824,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CdnWebApplicationFirewallPolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, policy_name=policy_name, cdn_web_application_firewall_policy_patch_parameters=cdn_web_application_firewall_policy_patch_parameters, @@ -829,7 +851,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -841,9 +863,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -871,8 +895,8 @@ def delete( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -884,10 +908,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -900,4 +925,6 @@ def delete( # pylint: disable=inconsistent-return-statements 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}" + } 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 5c360c7bd7c4b..544ad94c80979 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +43,7 @@ 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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -66,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +82,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,7 +97,7 @@ def build_get_request(resource_group_name: str, profile_name: str, subscription_ _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +113,7 @@ def build_get_request(resource_group_name: str, profile_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -129,8 +130,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +147,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,8 +166,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +183,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -201,7 +202,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,7 +218,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,13 +229,112 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_can_migrate_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/canMigrate", + ) # 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _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_migrate_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/migrate", + ) # 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _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_migration_commit_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/migrationCommit", + ) # 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", 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 ) -> 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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -250,7 +350,7 @@ def build_generate_sso_uri_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -267,7 +367,7 @@ def build_list_supported_optimization_types_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -283,7 +383,7 @@ def build_list_supported_optimization_types_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -300,7 +400,7 @@ def build_list_resource_usage_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -316,7 +416,7 @@ def build_list_resource_usage_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -359,8 +459,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Profile"]: _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProfileListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -381,7 +481,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -397,7 +497,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -405,14 +505,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,7 +526,7 @@ def get_next(next_link=None): 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"} @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Profile"]: @@ -442,8 +543,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProfileListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -465,7 +566,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -481,7 +582,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -489,14 +590,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,7 +611,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> _models.Profile: @@ -537,8 +641,8 @@ def get(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> _mo _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -550,10 +654,11 @@ def get(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -570,7 +675,9 @@ def get(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> _mo 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}" + } def _create_initial( self, resource_group_name: str, profile_name: str, profile: Union[_models.Profile, IO], **kwargs: Any @@ -586,14 +693,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(profile, (IO, bytes)): + if isinstance(profile, (IOBase, bytes)): _content = profile else: _json = self._serialize.body(profile, "Profile") @@ -611,10 +718,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -624,6 +732,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Profile", pipeline_response) @@ -631,14 +740,18 @@ def _create_initial( deserialized = self._deserialize("Profile", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Profile", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -724,8 +837,8 @@ def begin_create( :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. + :param profile: Profile properties needed to create a new profile. Is either a Profile 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. @@ -745,14 +858,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, profile=profile, @@ -772,7 +885,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -784,9 +897,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -806,14 +921,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(profile_update_parameters, (IO, bytes)): + if isinstance(profile_update_parameters, (IOBase, bytes)): _content = profile_update_parameters else: _json = self._serialize.body(profile_update_parameters, "ProfileUpdateParameters") @@ -831,10 +946,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -844,18 +960,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Profile", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Profile", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -948,7 +1069,7 @@ def begin_update( 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. + either a ProfileUpdateParameters 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. @@ -968,14 +1089,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Profile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, profile_update_parameters=profile_update_parameters, @@ -995,7 +1116,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1007,9 +1128,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, **kwargs: Any @@ -1025,8 +1148,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1038,10 +1161,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1051,10 +1175,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1082,11 +1212,11 @@ def begin_delete(self, resource_group_name: str, profile_name: str, **kwargs: An _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1104,7 +1234,549 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}" + } + + def _can_migrate_initial( + self, resource_group_name: str, can_migrate_parameters: Union[_models.CanMigrateParameters, IO], **kwargs: Any + ) -> Optional[_models.CanMigrateResult]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CanMigrateResult]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(can_migrate_parameters, (IOBase, bytes)): + _content = can_migrate_parameters + else: + _json = self._serialize.body(can_migrate_parameters, "CanMigrateParameters") + + request = build_can_migrate_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._can_migrate_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CanMigrateResult", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _can_migrate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/canMigrate" + } + + @overload + def begin_can_migrate( + self, + resource_group_name: str, + can_migrate_parameters: _models.CanMigrateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CanMigrateResult]: + """Checks if CDN profile can be migrated to Azure Frontdoor(Standard/Premium) profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param can_migrate_parameters: Properties needed to check if cdn profile or classic frontdoor + can be migrated. Required. + :type can_migrate_parameters: ~azure.mgmt.cdn.models.CanMigrateParameters + :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 CanMigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CanMigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_can_migrate( + self, + resource_group_name: str, + can_migrate_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CanMigrateResult]: + """Checks if CDN profile can be migrated to Azure Frontdoor(Standard/Premium) profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param can_migrate_parameters: Properties needed to check if cdn profile or classic frontdoor + can be migrated. Required. + :type can_migrate_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 CanMigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CanMigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_can_migrate( + self, resource_group_name: str, can_migrate_parameters: Union[_models.CanMigrateParameters, IO], **kwargs: Any + ) -> LROPoller[_models.CanMigrateResult]: + """Checks if CDN profile can be migrated to Azure Frontdoor(Standard/Premium) profile. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param can_migrate_parameters: Properties needed to check if cdn profile or classic frontdoor + can be migrated. Is either a CanMigrateParameters type or a IO type. Required. + :type can_migrate_parameters: ~azure.mgmt.cdn.models.CanMigrateParameters 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 CanMigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.CanMigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CanMigrateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._can_migrate_initial( + resource_group_name=resource_group_name, + can_migrate_parameters=can_migrate_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("CanMigrateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + 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) # type: ignore + + begin_can_migrate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/canMigrate" + } + + def _migrate_initial( + self, resource_group_name: str, migration_parameters: Union[_models.MigrationParameters, IO], **kwargs: Any + ) -> _models.MigrateResult: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrateResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(migration_parameters, (IOBase, bytes)): + _content = migration_parameters + else: + _json = self._serialize.body(migration_parameters, "MigrationParameters") + + request = build_migrate_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._migrate_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("MigrateResult", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = self._deserialize("MigrateResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _migrate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/migrate" + } + + @overload + def begin_migrate( + self, + resource_group_name: str, + migration_parameters: _models.MigrationParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrateResult]: + """Migrate the CDN profile to Azure Frontdoor(Standard/Premium) profile. The change need to be + committed after this. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param migration_parameters: Properties needed to migrate the profile. Required. + :type migration_parameters: ~azure.mgmt.cdn.models.MigrationParameters + :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 MigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.MigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_migrate( + self, + resource_group_name: str, + migration_parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MigrateResult]: + """Migrate the CDN profile to Azure Frontdoor(Standard/Premium) profile. The change need to be + committed after this. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param migration_parameters: Properties needed to migrate the profile. Required. + :type migration_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 MigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.MigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_migrate( + self, resource_group_name: str, migration_parameters: Union[_models.MigrationParameters, IO], **kwargs: Any + ) -> LROPoller[_models.MigrateResult]: + """Migrate the CDN profile to Azure Frontdoor(Standard/Premium) profile. The change need to be + committed after this. + + :param resource_group_name: Name of the Resource group within the Azure subscription. Required. + :type resource_group_name: str + :param migration_parameters: Properties needed to migrate the profile. Is either a + MigrationParameters type or a IO type. Required. + :type migration_parameters: ~azure.mgmt.cdn.models.MigrationParameters 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 MigrateResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cdn.models.MigrateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._migrate_initial( + resource_group_name=resource_group_name, + migration_parameters=migration_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("MigrateResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + 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) # type: ignore + + begin_migrate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/migrate" + } + + def _migration_commit_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, profile_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_migration_commit_request( + resource_group_name=resource_group_name, + profile_name=profile_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._migration_commit_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _migration_commit_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/migrationCommit" + } + + @distributed_trace + def begin_migration_commit(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> LROPoller[None]: + """Commit the migrated Azure Frontdoor(Standard/Premium) 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 + :keyword callable cls: A custom type or function 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 = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._migration_commit_initial( # type: ignore + resource_group_name=resource_group_name, + profile_name=profile_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): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1116,9 +1788,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"} # type: ignore + begin_migration_commit.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/migrationCommit" + } @distributed_trace def generate_sso_uri(self, resource_group_name: str, profile_name: str, **kwargs: Any) -> _models.SsoUri: @@ -1149,8 +1823,8 @@ def generate_sso_uri(self, resource_group_name: str, profile_name: str, **kwargs _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SsoUri] = kwargs.pop("cls", None) request = build_generate_sso_uri_request( resource_group_name=resource_group_name, @@ -1162,10 +1836,11 @@ def generate_sso_uri(self, resource_group_name: str, profile_name: str, **kwargs params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1182,7 +1857,9 @@ def generate_sso_uri(self, resource_group_name: str, profile_name: str, **kwargs 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" + } @distributed_trace def list_supported_optimization_types( @@ -1212,8 +1889,8 @@ def list_supported_optimization_types( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportedOptimizationTypesListResult] = kwargs.pop("cls", None) request = build_list_supported_optimization_types_request( resource_group_name=resource_group_name, @@ -1225,10 +1902,11 @@ def list_supported_optimization_types( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1245,7 +1923,9 @@ def list_supported_optimization_types( 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" + } @distributed_trace def list_resource_usage( @@ -1267,8 +1947,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceUsageListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1291,7 +1971,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1307,7 +1987,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1315,14 +1995,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1335,4 +2016,6 @@ def get_next(next_link=None): 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" + } 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 c2152fab97733..4f3afd191cb90 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 @@ -27,7 +27,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ 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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -91,8 +91,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceUsage"]: _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ResourceUsageListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -113,7 +113,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -129,7 +129,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -137,14 +137,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ResourceUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,4 +158,4 @@ def get_next(next_link=None): 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"} 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 53d8bb1341e8f..b32b6c93fb2d9 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_endpoint_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +62,7 @@ def build_list_by_endpoint_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +102,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -123,8 +124,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +143,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,8 +167,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +186,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,7 +210,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -227,7 +228,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -279,8 +280,8 @@ def list_by_endpoint( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RouteListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -304,7 +305,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -320,7 +321,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -328,14 +329,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RouteListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -348,7 +350,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get( @@ -383,8 +387,8 @@ def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -398,10 +402,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -418,7 +423,9 @@ def get( 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}" + } def _create_initial( self, @@ -440,14 +447,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(route, (IO, bytes)): + if isinstance(route, (IOBase, bytes)): _content = route else: _json = self._serialize.body(route, "Route") @@ -467,10 +474,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,6 +488,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Route", pipeline_response) @@ -487,14 +496,18 @@ def _create_initial( deserialized = self._deserialize("Route", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Route", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -605,7 +618,7 @@ def begin_create( :type endpoint_name: str :param route_name: Name of the routing rule. Required. :type route_name: str - :param route: Route properties. Is either a model type or a IO type. Required. + :param route: Route properties. Is either a Route 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. @@ -625,14 +638,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -654,9 +667,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -668,9 +681,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -692,14 +707,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(route_update_properties, (IO, bytes)): + if isinstance(route_update_properties, (IOBase, bytes)): _content = route_update_properties else: _json = self._serialize.body(route_update_properties, "RouteUpdateParameters") @@ -719,10 +734,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -732,18 +748,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Route", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Route", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -854,8 +875,8 @@ def begin_update( :type endpoint_name: str :param route_name: Name of the routing rule. Required. :type route_name: str - :param route_update_properties: Route update properties. Is either a model type or a IO type. - Required. + :param route_update_properties: Route update properties. Is either a RouteUpdateParameters 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. @@ -875,14 +896,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Route] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, endpoint_name=endpoint_name, @@ -904,9 +925,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -918,9 +939,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, endpoint_name: str, route_name: str, **kwargs: Any @@ -936,8 +959,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -951,10 +974,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -964,10 +988,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -1001,11 +1031,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1025,9 +1055,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -1039,6 +1069,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 21031ade600c9..f714c7c27254c 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 @@ -29,7 +29,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +44,7 @@ def build_list_by_profile_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +60,7 @@ def build_list_by_profile_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +77,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +94,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,7 +111,7 @@ def build_create_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +128,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +145,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +162,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -179,7 +179,7 @@ def build_list_resource_usage_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +196,7 @@ def build_list_resource_usage_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,8 +245,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuleSetListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -269,7 +269,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -285,7 +285,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -293,14 +293,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RuleSetListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,7 +314,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get(self, resource_group_name: str, profile_name: str, rule_set_name: str, **kwargs: Any) -> _models.RuleSet: @@ -344,8 +347,8 @@ def get(self, resource_group_name: str, profile_name: str, rule_set_name: 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.RuleSet] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuleSet] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -358,10 +361,11 @@ def get(self, resource_group_name: str, profile_name: str, rule_set_name: str, * params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -378,7 +382,9 @@ def get(self, resource_group_name: str, profile_name: str, rule_set_name: str, * 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}" + } @distributed_trace def create(self, resource_group_name: str, profile_name: str, rule_set_name: str, **kwargs: Any) -> _models.RuleSet: @@ -408,8 +414,8 @@ def create(self, resource_group_name: str, profile_name: str, rule_set_name: 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.RuleSet] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuleSet] = kwargs.pop("cls", None) request = build_create_request( resource_group_name=resource_group_name, @@ -422,10 +428,11 @@ def create(self, resource_group_name: str, profile_name: str, rule_set_name: str params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -442,11 +449,13 @@ def create(self, resource_group_name: str, profile_name: str, rule_set_name: str deserialized = self._deserialize("RuleSet", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, rule_set_name: str, **kwargs: Any @@ -462,8 +471,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -476,10 +485,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -489,10 +499,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -524,11 +540,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -547,9 +563,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -561,16 +577,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } @distributed_trace def list_resource_usage( 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. + """Checks the quota and actual usage of endpoints under the given Azure Front Door profile.. :param resource_group_name: Name of the Resource group within the Azure subscription. Required. :type resource_group_name: str @@ -588,8 +605,8 @@ def list_resource_usage( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -613,7 +630,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -629,7 +646,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -637,14 +654,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("UsagesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,4 +675,6 @@ def get_next(next_link=None): 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" + } 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 3c0bf344e70d8..20299ed5169bc 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_rule_set_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +62,7 @@ def build_list_by_rule_set_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +79,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +97,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,8 +114,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +133,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,8 +152,8 @@ def build_update_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +171,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,7 +190,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +208,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -258,8 +259,8 @@ def list_by_rule_set( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RuleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -283,7 +284,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -299,7 +300,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -307,14 +308,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -327,7 +329,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get( @@ -360,8 +364,8 @@ def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -375,10 +379,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -395,7 +400,9 @@ def get( 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}" + } def _create_initial( self, @@ -417,14 +424,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(rule, (IO, bytes)): + if isinstance(rule, (IOBase, bytes)): _content = rule else: _json = self._serialize.body(rule, "Rule") @@ -444,10 +451,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,6 +465,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Rule", pipeline_response) @@ -464,14 +473,18 @@ def _create_initial( deserialized = self._deserialize("Rule", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Rule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -576,7 +589,7 @@ def begin_create( :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. Is either a model type or a IO type. Required. + :param rule: The delivery rule properties. Is either a Rule 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. @@ -596,14 +609,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, @@ -625,9 +638,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -639,9 +652,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _update_initial( self, @@ -663,14 +678,14 @@ def _update_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(rule_update_properties, (IO, bytes)): + if isinstance(rule_update_properties, (IOBase, bytes)): _content = rule_update_properties else: _json = self._serialize.body(rule_update_properties, "RuleUpdateParameters") @@ -690,10 +705,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -703,18 +719,23 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Rule", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Rule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_update( @@ -819,8 +840,8 @@ def begin_update( :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. Is either a model type or a IO type. - Required. + :param rule_update_properties: Delivery rule properties. Is either a RuleUpdateParameters 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. @@ -840,14 +861,14 @@ def begin_update( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Rule] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, profile_name=profile_name, rule_set_name=rule_set_name, @@ -869,9 +890,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -883,9 +904,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 @@ -901,8 +924,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -916,10 +939,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -929,10 +953,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -964,11 +994,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -988,9 +1018,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -1002,6 +1032,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 37955db735483..bf81cf87d8ec2 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_profile_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +61,7 @@ def build_list_by_profile_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +78,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +95,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +112,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +130,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,7 +149,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +166,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -212,8 +213,8 @@ def list_by_profile(self, resource_group_name: str, profile_name: str, **kwargs: _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SecretListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -236,7 +237,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -252,7 +253,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -260,14 +261,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecretListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -280,7 +282,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get(self, resource_group_name: str, profile_name: str, secret_name: str, **kwargs: Any) -> _models.Secret: @@ -309,8 +313,8 @@ def get(self, resource_group_name: str, profile_name: str, secret_name: str, **k _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -323,10 +327,11 @@ def get(self, resource_group_name: str, profile_name: str, secret_name: str, **k params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,7 +348,9 @@ def get(self, resource_group_name: str, profile_name: str, secret_name: str, **k 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}" + } def _create_initial( self, @@ -364,14 +371,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(secret, (IO, bytes)): + if isinstance(secret, (IOBase, bytes)): _content = secret else: _json = self._serialize.body(secret, "Secret") @@ -390,10 +397,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,6 +411,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("Secret", pipeline_response) @@ -410,14 +419,18 @@ def _create_initial( deserialized = self._deserialize("Secret", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("Secret", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -513,7 +526,7 @@ def begin_create( :type profile_name: str :param secret_name: Name of the Secret under the profile. Required. :type secret_name: str - :param secret: The Secret properties. Is either a model type or a IO type. Required. + :param secret: The Secret properties. Is either a Secret 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. @@ -533,14 +546,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, secret_name=secret_name, @@ -561,9 +574,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -575,9 +588,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, secret_name: str, **kwargs: Any @@ -593,8 +608,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -607,10 +622,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -620,10 +636,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -653,11 +675,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -676,9 +698,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -690,6 +712,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 f18b20d0a579d..4673ff3035782 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import CdnManagementClientMixinABC, _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +45,7 @@ def build_list_by_profile_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +61,7 @@ def build_list_by_profile_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +78,7 @@ def build_get_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +95,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +112,8 @@ def build_create_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +130,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,8 +149,8 @@ def build_patch_request( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +167,7 @@ def build_patch_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,7 +186,7 @@ def build_delete_request( _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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +203,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -251,8 +252,8 @@ def list_by_profile( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SecurityPolicyListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -275,7 +276,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -291,7 +292,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -299,14 +300,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SecurityPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,7 +321,9 @@ def get_next(next_link=None): 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" + } @distributed_trace def get( @@ -350,8 +354,8 @@ def get( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SecurityPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -364,10 +368,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -384,7 +389,9 @@ def get( 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}" + } def _create_initial( self, @@ -405,14 +412,14 @@ def _create_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_policy, (IO, bytes)): + if isinstance(security_policy, (IOBase, bytes)): _content = security_policy else: _json = self._serialize.body(security_policy, "SecurityPolicy") @@ -431,10 +438,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,6 +452,7 @@ def _create_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SecurityPolicy", pipeline_response) @@ -451,14 +460,18 @@ def _create_initial( deserialized = self._deserialize("SecurityPolicy", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_create( @@ -556,8 +569,8 @@ def begin_create( :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. Is either a model type or a IO type. - Required. + :param security_policy: The security policy properties. Is either a SecurityPolicy 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. @@ -578,14 +591,14 @@ def begin_create( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, @@ -606,9 +619,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -620,9 +633,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _patch_initial( self, @@ -643,14 +658,14 @@ def _patch_initial( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_policy_update_properties, (IO, bytes)): + if isinstance(security_policy_update_properties, (IOBase, bytes)): _content = security_policy_update_properties else: _json = self._serialize.body(security_policy_update_properties, "SecurityPolicyUpdateParameters") @@ -669,10 +684,11 @@ def _patch_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -682,18 +698,23 @@ def _patch_initial( error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SecurityPolicy", pipeline_response) if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = self._deserialize("SecurityPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _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}" + } @overload def begin_patch( @@ -791,8 +812,8 @@ def begin_patch( :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. Is either a model - type or a IO type. Required. + :param security_policy_update_properties: Security policy update properties. Is either a + SecurityPolicyUpdateParameters 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'. @@ -814,14 +835,14 @@ def begin_patch( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SecurityPolicy] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._patch_initial( # type: ignore + raw_result = self._patch_initial( resource_group_name=resource_group_name, profile_name=profile_name, security_policy_name=security_policy_name, @@ -842,9 +863,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -856,9 +877,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, profile_name: str, security_policy_name: str, **kwargs: Any @@ -874,8 +897,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -888,10 +911,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -901,10 +925,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _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}" + } @distributed_trace def begin_delete( @@ -934,11 +964,11 @@ def begin_delete( _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] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -957,9 +987,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = 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: @@ -971,6 +1001,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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}" + } 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 deleted file mode 100644 index e7924848f6b83..0000000000000 --- a/sdk/cdn/azure-mgmt-cdn/azure/mgmt/cdn/operations/_validate_operations.py +++ /dev/null @@ -1,191 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, 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 .. import models as _models -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, **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") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _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, *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") - - @overload - def secret( - self, - validate_secret_input: _models.ValidateSecretInput, - *, - 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: ~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) - :rtype: ~azure.mgmt.cdn.models.ValidateSecretOutput - :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: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _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.ValidateSecretOutput] - - 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, - content=_content, - template_url=self.secret.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - 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 - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.AfdErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ValidateSecretOutput", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - secret.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateSecret"} # type: ignore diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_create.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_create.py index 023cd3b72c4b9..fa6395ea5f0f7 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python afd_custom_domains_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDCustomDomains_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index da4c86be53114..6505cac26a2c0 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python afd_custom_domains_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.afd_custom_domains.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 0977c4c90a6b4..06a3a0e6eba66 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python afd_custom_domains_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDCustomDomains_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 3a2059281ef13..f078178580ddd 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDCustomDomains_ListByProfile.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDCustomDomains_ListByProfile.json if __name__ == "__main__": main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_refresh_validation_token.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_refresh_validation_token.py new file mode 100644 index 0000000000000..268eedb647e1a --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_custom_domains_refresh_validation_token.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 afd_custom_domains_refresh_validation_token.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", + ) + + client.afd_custom_domains.begin_refresh_validation_token( + resource_group_name="RG", + profile_name="profile1", + custom_domain_name="domain1", + ).result() + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDCustomDomains_RefreshValidationToken.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 index 19e869599c05c..75b75f15d28a6 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python afd_custom_domains_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDCustomDomains_Update.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 178dc9965f2e1..64231376b1f33 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_create.py @@ -16,7 +16,7 @@ # USAGE python afd_endpoints_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 68da13cbb465a..d144c87a9398c 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_delete.py @@ -16,7 +16,7 @@ # USAGE python afd_endpoints_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.afd_endpoints.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 5655f10e5e461..fff1c94b2ad5d 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_get.py @@ -16,7 +16,7 @@ # USAGE python afd_endpoints_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index adc75199bb691..2d91b13c1129a 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_ListByProfile.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 116b7f09d1f84..8dc7f49025daa 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_ListResourceUsage.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index b7d47510b0c8d..26702ef272b40 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python afd_endpoints_purge_content.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.afd_endpoints.begin_purge_content( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index de2a2d5fb9efe..036bfec598f7c 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_update.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_update.py @@ -16,7 +16,7 @@ # USAGE python afd_endpoints_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_Update.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDEndpoints_Update.json if __name__ == "__main__": main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_validate_custom_domain.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_endpoints_validate_custom_domain.py new file mode 100644 index 0000000000000..c5c40ea09632a --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_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 afd_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/2023-05-01/examples/AFDEndpoints_ValidateCustomDomain.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 index af2745031c48f..6b5b69190459e 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python afd_origin_groups_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index b576422088327..03bd89b6aff80 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python afd_origin_groups_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.afd_origin_groups.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 61c8a1ed11c65..e7c258c214c7a 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python afd_origin_groups_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 06acb34bf8aeb..aec67d1a806e3 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_ListByProfile.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 9bd18407efc3b..f8de8aec8390d 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_ListResourceUsage.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index ec85dc7ecf3dc..771ab8fffb2f6 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python afd_origin_groups_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOriginGroups_Update.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index c0d1d0b1cc3eb..fc98e195c658f 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_create.py @@ -16,7 +16,7 @@ # USAGE python afd_origins_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOrigins_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index def5310a1e92b..e4388e376e745 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_delete.py @@ -16,7 +16,7 @@ # USAGE python afd_origins_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.afd_origins.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index effe0479e809a..792c61858a8dd 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_get.py @@ -16,7 +16,7 @@ # USAGE python afd_origins_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOrigins_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index d07d8c9b6d79c..a9a5da807de71 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOrigins_ListByOriginGroup.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 5d9d55075840b..691f9761ac12c 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_update.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_origins_update.py @@ -16,7 +16,7 @@ # USAGE python afd_origins_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDOrigins_Update.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDOrigins_Update.json if __name__ == "__main__": main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_check_endpoint_name_availability.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_check_endpoint_name_availability.py new file mode 100644 index 0000000000000..b0de61c629aa6 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_check_endpoint_name_availability.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 afd_profiles_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.afd_profiles.check_endpoint_name_availability( + resource_group_name="myResourceGroup", + profile_name="profile1", + 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/2023-05-01/examples/AFDProfiles_CheckEndpointNameAvailability.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 index 04553b0a14eef..3a4f7c70ecf68 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDProfiles_CheckHostNameAvailability.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 39bcea08247bc..8a3c7d93a9ba5 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDProfiles_ListResourceUsage.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDProfiles_ListResourceUsage.json if __name__ == "__main__": main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_upgrade.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_upgrade.py new file mode 100644 index 0000000000000..f9620e1342a70 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_upgrade.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_profiles_upgrade.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.begin_upgrade( + resource_group_name="RG", + profile_name="profile1", + profile_upgrade_parameters={ + "wafMappingList": [ + { + "changeToWafPolicy": { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/waf2" + }, + "securityPolicyName": "securityPolicy1", + } + ] + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDProfiles_Upgrade.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/afd_profiles_validate_secret.py similarity index 85% rename from sdk/cdn/azure-mgmt-cdn/generated_samples/validate_secret.py rename to sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_validate_secret.py index 0074220f2b980..5d9fcf5e03b30 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/validate_secret.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/afd_profiles_validate_secret.py @@ -14,9 +14,9 @@ pip install azure-identity pip install azure-mgmt-cdn # USAGE - python validate_secret.py + python afd_profiles_validate_secret.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,7 +29,9 @@ def main(): subscription_id="subid", ) - response = client.validate.secret( + response = client.afd_profiles.validate_secret( + resource_group_name="RG", + profile_name="profile1", validate_secret_input={ "secretSource": { "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.KeyVault/vault/kvName/certificate/certName" @@ -40,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Validate_Secret.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDProfiles_ValidateSecret.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 index f62a3e337d2d3..eff40ca4bf647 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python check_endpoint_name_availability.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CheckEndpointNameAvailability.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 52eb072e398bd..df6de4195977c 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/check_name_availability.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/check_name_availability.py @@ -16,7 +16,7 @@ # USAGE python check_name_availability.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CheckNameAvailability.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 73024f9357149..547741a924427 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CheckNameAvailabilityWithSubscription.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/CheckNameAvailabilityWithSubscription.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 index 69b1b2ceca591..e6382132190c8 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_create.py @@ -16,7 +16,7 @@ # USAGE python custom_domains_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index a6329d05e6635..f9c3385a76aca 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_delete.py @@ -16,7 +16,7 @@ # USAGE python custom_domains_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_Delete.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index d3195e38a25cf..0d33897052fcd 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_DisableCustomHttps.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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_your_own_certificate.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_enable_custom_https_using_byoc.py similarity index 89% rename from sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_enable_custom_https_using_your_own_certificate.py rename to sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_enable_custom_https_using_byoc.py index 1b936658e1d9c..110c0a67094ea 100644 --- 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_byoc.py @@ -14,9 +14,9 @@ pip install azure-identity pip install azure-mgmt-cdn # USAGE - python custom_domains_enable_custom_https_using_your_own_certificate.py + python custom_domains_enable_custom_https_using_byoc.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_EnableCustomHttpsUsingBYOC.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/CustomDomains_EnableCustomHttpsUsingBYOC.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 index 19d4bf970b626..0faf7b473da4b 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_EnableCustomHttpsUsingCDNManagedCertificate.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/CustomDomains_EnableCustomHttpsUsingCDNManagedCertificate.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 index 5abe71bb343a9..fad1235f9c32e 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/custom_domains_get.py @@ -16,7 +16,7 @@ # USAGE python custom_domains_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index eccfbe2719b54..13f196a03b80d 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/CustomDomains_ListByEndpoint.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/CustomDomains_ListByEndpoint.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 index f62585f716125..40e4f5356bf6e 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/edge_nodes_list.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/edge_nodes_list.py @@ -16,7 +16,7 @@ # USAGE python edge_nodes_list.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/EdgeNodes_List.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 5f14a5a94ece7..c0bdd9170d5a3 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_create.py @@ -16,7 +16,7 @@ # USAGE python endpoints_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -153,6 +153,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index fd412dc443c5a..2b502bc52e7b7 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_delete.py @@ -16,7 +16,7 @@ # USAGE python endpoints_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.endpoints.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 43bbe80352ee3..08338765c9bf3 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_get.py @@ -16,7 +16,7 @@ # USAGE python endpoints_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 450791ffc953c..a3e76ee908522 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python endpoints_list_by_profile.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_ListByProfile.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 4df4cdca72f15..f4fb4f2adacd0 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python endpoints_list_resource_usage.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_ListResourceUsage.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 1cd586daa0748..3d824cc886e24 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_load_content.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_load_content.py @@ -16,7 +16,7 @@ # USAGE python endpoints_load_content.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.endpoints.begin_load_content( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index cf356f689a238..7d8bcab6fe3e8 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_purge_content.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_purge_content.py @@ -16,7 +16,7 @@ # USAGE python endpoints_purge_content.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.endpoints.begin_purge_content( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index c89ae1aef22c8..17da60b2ddc6e 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_start.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_start.py @@ -16,7 +16,7 @@ # USAGE python endpoints_start.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Start.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 7aa0592246ec9..d085a2f393e6e 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_stop.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_stop.py @@ -16,7 +16,7 @@ # USAGE python endpoints_stop.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Stop.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 6b45fcaa0169b..5566b23e8aa96 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_update.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/endpoints_update.py @@ -16,7 +16,7 @@ # USAGE python endpoints_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Endpoints_Update.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 326ca6f8e89f1..4bea9fc5dc75a 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python endpoints_validate_custom_domain.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.afd_endpoints.validate_custom_domain( + response = client.endpoints.validate_custom_domain( resource_group_name="RG", profile_name="profile1", endpoint_name="endpoint1", @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/AFDEndpoints_ValidateCustomDomain.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/Endpoints_ValidateCustomDomain.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 index 5da45693d6c84..396b850574263 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/LogAnalytics_GetLogAnalyticsLocations.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 49a7af9c1525f..e733695c48e5a 100644 --- 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 @@ -6,6 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import isodate + from azure.identity import DefaultAzureCredential from azure.mgmt.cdn import CdnManagementClient @@ -16,7 +18,7 @@ # 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 + 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 @@ -33,8 +35,8 @@ def main(): 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", + date_time_begin=isodate.parse_datetime("2020-11-04T04:30:00.000Z"), + date_time_end=isodate.parse_datetime("2020-11-04T05:00:00.000Z"), granularity="PT5M", custom_domains=["customdomain1.azurecdn.net", "customdomain2.azurecdn.net"], protocols=["https"], @@ -42,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/LogAnalytics_GetLogAnalyticsMetrics.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index cad527c35c503..7911f82042b99 100644 --- 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 @@ -6,6 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import isodate + from azure.identity import DefaultAzureCredential from azure.mgmt.cdn import CdnManagementClient @@ -16,7 +18,7 @@ # 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 + 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 @@ -35,12 +37,12 @@ def main(): 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", + date_time_begin=isodate.parse_datetime("2020-11-04T06:49:27.554Z"), + date_time_end=isodate.parse_datetime("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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index c71e49b2be171..66a565efaf124 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/LogAnalytics_GetLogAnalyticsResources.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index e24eb5f97da1d..1e6c5c700c227 100644 --- 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 @@ -6,6 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import isodate + from azure.identity import DefaultAzureCredential from azure.mgmt.cdn import CdnManagementClient @@ -16,7 +18,7 @@ # 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 + 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 @@ -33,13 +35,13 @@ def main(): 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", + date_time_begin=isodate.parse_datetime("2020-11-04T06:49:27.554Z"), + date_time_end=isodate.parse_datetime("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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index ce002312ad387..36ff61107cb31 100644 --- 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 @@ -6,6 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import isodate + from azure.identity import DefaultAzureCredential from azure.mgmt.cdn import CdnManagementClient @@ -16,7 +18,7 @@ # 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 + 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 @@ -33,14 +35,14 @@ def main(): 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", + date_time_begin=isodate.parse_datetime("2020-11-04T06:49:27.554Z"), + date_time_end=isodate.parse_datetime("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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 4711701b0748c..d2c4314fde2dc 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/operations_list.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/operations_list.py @@ -16,7 +16,7 @@ # USAGE python operations_list.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Operations_List.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 858d1bdf9897a..339e989c45f38 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_create.py @@ -16,7 +16,7 @@ # USAGE python origin_groups_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/OriginGroups_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index c67395df21c70..d03ad85f22aaa 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_delete.py @@ -16,7 +16,7 @@ # USAGE python origin_groups_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.origin_groups.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index a2386c975d56b..2e92b682b1de6 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_get.py @@ -16,7 +16,7 @@ # USAGE python origin_groups_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/OriginGroups_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/OriginGroups_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/origin_groups_list_by_endpoint.py similarity index 91% rename from sdk/cdn/azure-mgmt-cdn/generated_samples/origins_groups_list_by_endpoint.py rename to sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_list_by_endpoint.py index 545b4b994eebe..0aa0e55bf9070 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_groups_list_by_endpoint.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_list_by_endpoint.py @@ -14,9 +14,9 @@ pip install azure-identity pip install azure-mgmt-cdn # USAGE - python origins_groups_list_by_endpoint.py + python origin_groups_list_by_endpoint.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/OriginGroups_ListByEndpoint.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/OriginGroups_ListByEndpoint.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 index 7a4ecaf20a6a2..a80bdd682ba71 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_update.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origin_groups_update.py @@ -16,7 +16,7 @@ # USAGE python origin_groups_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/OriginGroups_Update.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index a4edaeb2fc58d..27900a8610755 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_create.py @@ -16,7 +16,7 @@ # USAGE python origins_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Origins_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 7eae431786575..c368409908482 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_delete.py @@ -16,7 +16,7 @@ # USAGE python origins_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.origins.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 4fd90004ad9f2..cf77f18a233f7 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_get.py @@ -16,7 +16,7 @@ # USAGE python origins_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Origins_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/Origins_Get.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 index 2a0a52118f5cb..3fe8360cbda91 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python origins_list_by_endpoint.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Origins_ListByEndpoint.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index c91cbf2f3737f..c4023d1d05e91 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_update.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/origins_update.py @@ -16,7 +16,7 @@ # USAGE python origins_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Origins_Update.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/Origins_Update.json if __name__ == "__main__": main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_can_migrate.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_can_migrate.py new file mode 100644 index 0000000000000..ed386fa7b2f2d --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_can_migrate.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 profiles_can_migrate.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_can_migrate( + resource_group_name="RG", + can_migrate_parameters={ + "classicResourceReference": { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Network/frontdoors/frontdoorname" + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/Profiles_CanMigrate.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 index 31cf98ab3157a..19e2350b7c4aa 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_create.py @@ -16,7 +16,7 @@ # USAGE python profiles_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 32a63feba2f99..60cb6946eb347 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_delete.py @@ -16,7 +16,7 @@ # USAGE python profiles_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.profiles.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 5dadc8860e3f2..7c6b60c9370b4 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python profiles_generate_sso_uri.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_GenerateSsoUri.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index cc68245f49e67..afa7f63fee596 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_get.py @@ -16,7 +16,7 @@ # USAGE python profiles_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 5fd0cc68eea1b..4add99bf2ae81 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_list.py @@ -16,7 +16,7 @@ # USAGE python profiles_list.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_List.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 9b7579d5f6f99..e5ed0520f27f9 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_ListByResourceGroup.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 00759b40cf315..c675bd803d146 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python profiles_list_resource_usage.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_ListResourceUsage.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index bebdd3153864a..515e0efd5fe9b 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_ListSupportedOptimizationTypes.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/Profiles_ListSupportedOptimizationTypes.json if __name__ == "__main__": main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_migrate.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_migrate.py new file mode 100644 index 0000000000000..c372b688383f2 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_migrate.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 profiles_migrate.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_migrate( + resource_group_name="RG", + migration_parameters={ + "classicResourceReference": { + "id": "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Network/frontdoors/frontdoorname" + }, + "profileName": "profile1", + "sku": {"name": "Standard_AzureFrontDoor"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/Profiles_Migrate.json +if __name__ == "__main__": + main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_migration_commit.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_migration_commit.py new file mode 100644 index 0000000000000..b22da89162989 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_migration_commit.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 profiles_migration_commit.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", + ) + + client.profiles.begin_migration_commit( + resource_group_name="RG", + profile_name="profile1", + ).result() + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/Profiles_MigrationCommit.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 index fd3b6e3360275..5c6d3c38610d7 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_update.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/profiles_update.py @@ -16,7 +16,7 @@ # USAGE python profiles_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Profiles_Update.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index d94b03c920fc1..c3d76c9c682f4 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/resource_usage_list.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/resource_usage_list.py @@ -16,7 +16,7 @@ # USAGE python resource_usage_list.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/ResourceUsage_List.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index f9b6b18ce3f0c..8cbf915263662 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_create.py @@ -16,7 +16,7 @@ # USAGE python routes_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -70,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Routes_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 3a80e2afec95b..6414290347528 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_delete.py @@ -16,7 +16,7 @@ # USAGE python routes_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.routes.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 29c0adadb185a..31e18d413b51c 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_get.py @@ -16,7 +16,7 @@ # USAGE python routes_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Routes_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index c8c84acfc14e4..21623cfa6e8e2 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python routes_list_by_endpoint.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Routes_ListByEndpoint.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 1820bb807035a..d195966625630 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_update.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/routes_update.py @@ -16,7 +16,7 @@ # USAGE python routes_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -69,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Routes_Update.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 5df1a35afe528..e10d673138232 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_create.py @@ -16,7 +16,7 @@ # USAGE python rule_sets_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/RuleSets_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index fe82ecf3d2cde..d26f39b416e51 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_delete.py @@ -16,7 +16,7 @@ # USAGE python rule_sets_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.rule_sets.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 77b289949d3d5..b994c4330f236 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rule_sets_get.py @@ -16,7 +16,7 @@ # USAGE python rule_sets_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/RuleSets_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 3f73bba2cd640..8bdfdac3c6090 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/RuleSets_ListByProfile.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 2ae1c4471680b..502c03ddd3c4d 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/RuleSets_ListResourceUsage.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 77c329e779877..4a5c09b5750e2 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_create.py @@ -16,7 +16,7 @@ # USAGE python rules_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -65,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Rules_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 783849c0779f5..2056decc1f930 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_delete.py @@ -16,7 +16,7 @@ # USAGE python rules_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,15 +29,14 @@ def main(): subscription_id="subid", ) - response = client.rules.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 9cc5154c4318b..36664316f57ea 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_get.py @@ -16,7 +16,7 @@ # USAGE python rules_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Rules_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 0aa47e09312bc..12da638f70d25 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Rules_ListByRuleSet.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index d7038993ac206..2aafce7790ba7 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_update.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/rules_update.py @@ -16,7 +16,7 @@ # USAGE python rules_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Rules_Update.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index adc452f54e53f..e3ed807ce6695 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_create.py @@ -16,7 +16,7 @@ # USAGE python secrets_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Secrets_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index c8c405beab8bd..c46e8d4722ce1 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_delete.py @@ -16,7 +16,7 @@ # USAGE python secrets_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.secrets.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 772c7307e7a25..3c012ee66b101 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/secrets_get.py @@ -16,7 +16,7 @@ # USAGE python secrets_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Secrets_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index a59803006ee13..01dcf4635796f 100644 --- 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 @@ -16,7 +16,7 @@ # USAGE python secrets_list_by_profile.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/Secrets_ListByProfile.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 769c06d5c0222..49c6295930cc5 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_create.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_create.py @@ -16,7 +16,7 @@ # USAGE python security_policies_create.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/SecurityPolicies_Create.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index a1a5744376c9f..b589933839697 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_delete.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_delete.py @@ -16,7 +16,7 @@ # USAGE python security_policies_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.security_policies.begin_delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 20a9de1a93976..eaedf2278c3bc 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_get.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_get.py @@ -16,7 +16,7 @@ # USAGE python security_policies_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/SecurityPolicies_Get.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 85788f39502dc..eb6a6cacd6821 100644 --- 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 @@ -16,7 +16,7 @@ # 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 + 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/SecurityPolicies_ListByProfile.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 34a9758bbf1dd..54c670801cc7c 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_patch.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/security_policies_patch.py @@ -16,7 +16,7 @@ # USAGE python security_policies_patch.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/SecurityPolicies_Patch.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-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 index 3618f68faf762..15ef4da097fa0 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/validate_probe.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/validate_probe.py @@ -16,7 +16,7 @@ # USAGE python validate_probe.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/ValidateProbe.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/ValidateProbe.json if __name__ == "__main__": main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/waf_list_managed_rule_sets.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/waf_list_managed_rule_sets.py new file mode 100644 index 0000000000000..d148f719d7807 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/waf_list_managed_rule_sets.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 waf_list_managed_rule_sets.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.managed_rule_sets.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/WafListManagedRuleSets.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/waf_list_policies.py similarity index 90% rename from sdk/cdn/azure-mgmt-cdn/generated_samples/list_policies_in_a_resource_group.py rename to sdk/cdn/azure-mgmt-cdn/generated_samples/waf_list_policies.py index d36afb5f75574..46d1110440223 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/list_policies_in_a_resource_group.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/waf_list_policies.py @@ -14,9 +14,9 @@ pip install azure-identity pip install azure-mgmt-cdn # USAGE - python list_policies_in_a_resource_group.py + python waf_list_policies.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/WafListPolicies.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/WafListPolicies.json if __name__ == "__main__": main() diff --git a/sdk/cdn/azure-mgmt-cdn/generated_samples/waf_patch_policy.py b/sdk/cdn/azure-mgmt-cdn/generated_samples/waf_patch_policy.py new file mode 100644 index 0000000000000..84e9500287070 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/waf_patch_policy.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 waf_patch_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_update( + resource_group_name="rg1", + policy_name="MicrosoftCdnWafPolicy", + cdn_web_application_firewall_policy_patch_parameters={"tags": {"foo": "bar"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/WafPatchPolicy.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/waf_policy_create_or_update.py similarity index 97% rename from sdk/cdn/azure-mgmt-cdn/generated_samples/creates_specific_policy.py rename to sdk/cdn/azure-mgmt-cdn/generated_samples/waf_policy_create_or_update.py index ac3ff54f4b2cc..5f8238aff1933 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/creates_specific_policy.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/waf_policy_create_or_update.py @@ -14,9 +14,9 @@ pip install azure-identity pip install azure-mgmt-cdn # USAGE - python creates_specific_policy.py + python waf_policy_create_or_update.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -122,6 +122,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/WafPolicyCreateOrUpdate.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/WafPolicyCreateOrUpdate.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/waf_policy_delete.py similarity index 87% rename from sdk/cdn/azure-mgmt-cdn/generated_samples/delete_protection_policy.py rename to sdk/cdn/azure-mgmt-cdn/generated_samples/waf_policy_delete.py index 12689bfa9c449..0dd91e351b55f 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/delete_protection_policy.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/waf_policy_delete.py @@ -14,9 +14,9 @@ pip install azure-identity pip install azure-mgmt-cdn # USAGE - python delete_protection_policy.py + python waf_policy_delete.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.policies.delete( + 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 +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/WafPolicyDelete.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/waf_policy_get.py similarity index 92% rename from sdk/cdn/azure-mgmt-cdn/generated_samples/get_policy.py rename to sdk/cdn/azure-mgmt-cdn/generated_samples/waf_policy_get.py index a9c908a83ad9d..b9fcfd734459a 100644 --- a/sdk/cdn/azure-mgmt-cdn/generated_samples/get_policy.py +++ b/sdk/cdn/azure-mgmt-cdn/generated_samples/waf_policy_get.py @@ -14,9 +14,9 @@ pip install azure-identity pip install azure-mgmt-cdn # USAGE - python get_policy.py + python waf_policy_get.py - Before run the sample, please set the values of the client ID, tenant ID and client secret + 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2021-06-01/examples/WafPolicyGet.json +# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/WafPolicyGet.json if __name__ == "__main__": main()